From patchwork Thu Jul 13 08:54:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 107631 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1936653qge; Thu, 13 Jul 2017 01:55:46 -0700 (PDT) X-Received: by 10.98.158.29 with SMTP id s29mr60829844pfd.126.1499936146633; Thu, 13 Jul 2017 01:55:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499936146; cv=none; d=google.com; s=arc-20160816; b=i6/9mrkICpjgnM6yWCT1/G1yq74+XN7J+SdCTyaUSoP2JB1srU3f3uVur9ZBxLWFTq HgbgGH5oDLJHlHZfidnlmuXPU4Fuz4/FfMlAYXPHRNYgrjcqi2iYQeEyOOeqKR30rJVA Xr/p0hnNdDFD0ciEvaR6MBnwjUoUTvnWuvc+NfZ0rxlLPK/CXM+wJ1DN3GdCzBodVs/a rd8YV6w/uv9qOzsLhEZN0cAJGmVRyG4HUt606tzET8SxrLITLx63c9LtBSGTGNoBikZJ NJw1w5dMluPB/iQ+dTpdB2XroUiBVoon7N5buVTOIcfa7ttaN7Pld7Gu6EY0RC17DAzr +ZhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:mail-followup-to:to:from:delivered-to:sender:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=dN9zilmCTBoAuIhOpgZV7Lw5xeg059V2oQvNNJliLqg=; b=ED//eG1SYtsJGrEy6f+TZewnH0lsPGnauBcC55c9348DjKz00mu3OTQ8WOJgr9Y7q5 3blNbM/qTWNJHcH/Nz/TsuJLRm5PKQY98VBr1KWRFg757WaY0hd3OhbJYPL4YZVdIe2h /ht8+M7yUPnlSbB39UdCxR6AzTCHq4iTb8YYSdI3FENybbC6xg0cT8XGcWItQKZWD7kn AuH1NIZPuhLaE7q8bhe/BVDexv7SLmhmdZC3GaHpkX7pP3Lc2ep/v31Pv1gxaTJJ3TMN BqXlkDtD7Rwluc4bFHFkkcfF7K1sqe/gUf13b70sou7ukTed/f5ZyjcNocotVpAWLYcv oyow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.b=owJQsaB2; spf=pass (google.com: domain of gcc-patches-return-458036-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458036-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id a10si4012449plt.344.2017.07.13.01.55.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 01:55:46 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-458036-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.b=owJQsaB2; spf=pass (google.com: domain of gcc-patches-return-458036-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458036-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=mornEbQ52v+M64rnRNSb1ndOjbtF+ J51dIqs1l2bbJ+3w4MgRhE/6AW7COEKOsZxb0sGSaQYsXYzjbnlb0svEd6GZcL7f ifaHvolj3IWUIr3L4L+5HIO/Wp5S/RlvH/qBjLTBzTYf914Hwk/4lMC7KZb2THJv gnS4tyAt40Ojtk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=YfaHPTw8ZuWFAjr1J0hIwgRNPwo=; b=owJ QsaB2sEBPVsZqu91jLUjxUMCL6I6j8Wgc3gUxvKcLrG3j4wsETeyzk3/FqrTG6RL dywvWdoXnCpSi0EcDP7fvyIvjmzhrWPwJ211j+YgeD+DwLiBL66RlXR/C0A3HGA9 3Vb8Qz8nWs8/ULDbpl7V9woNpc+8VoKa5cZYtyNY= Received: (qmail 49802 invoked by alias); 13 Jul 2017 08:54:39 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 48856 invoked by uid 89); 13 Jul 2017 08:54:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=4456 X-HELO: mail-wm0-f49.google.com Received: from mail-wm0-f49.google.com (HELO mail-wm0-f49.google.com) (74.125.82.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Jul 2017 08:54:34 +0000 Received: by mail-wm0-f49.google.com with SMTP id w126so16701756wme.0 for ; Thu, 13 Jul 2017 01:54:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=dN9zilmCTBoAuIhOpgZV7Lw5xeg059V2oQvNNJliLqg=; b=KEO4W6r4UjMqExPU730ZtPLOQZEOjbQ1qK+ziuJp/bZPdQnuW8GIuWiZlqSfNgcXrT umMePRO1I/a9KVcngLcgQm4Ll+QVw7NEvs7G0VZqKDoGgISkLEGSUaaPRS6kkIhdSK1d VJyNGQBr7fTfRXJP21mmbV840hSGUHyMXXENvcOAYbMUn6tdR50tV8q/ppGgBvCsePks p/77MWTLtQJuRJs5fiUTRSiPGBOo0wUPQVg81h+fmZbT0CttF+4sFAnWBp3TsQCRTvhZ 579effXj5ql60cf892V5oCz4xdF+C+Xc4lCmnecRlfXBCuAQ5OQKK2BobPJS/Eq88Eqc zmCg== X-Gm-Message-State: AIVw112JwHtrKiABkhSQIIrMNmxegQyutm/HXH3M0VGUQeK1FDSjlpc8 NejZswf58oA12zvKRvit1g== X-Received: by 10.28.146.208 with SMTP id u199mr1157317wmd.6.1499936072618; Thu, 13 Jul 2017 01:54:32 -0700 (PDT) Received: from localhost (92.40.249.184.threembb.co.uk. [92.40.249.184]) by smtp.gmail.com with ESMTPSA id 32sm5649670wry.31.2017.07.13.01.54.31 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Jul 2017 01:54:31 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [45/77] Make extract_left_shift take a scalar_int_mode References: <8760ewohsv.fsf@linaro.org> Date: Thu, 13 Jul 2017 09:54:30 +0100 In-Reply-To: <8760ewohsv.fsf@linaro.org> (Richard Sandiford's message of "Thu, 13 Jul 2017 09:35:44 +0100") Message-ID: <87r2xkg1ix.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch passes the mode of the shifted value to extract_left_shift and updates the only caller so that the mode is a scalar_int_mode. 2017-07-13 Richard Sandiford Alan Hayward David Sherwood gcc/ * combine.c (extract_left_shift): Add a mode argument and update recursive calls. (make_compound_operation_int): Change the type of the mode parameter to scalar_int_mode and update the call to extract_left_shift. Index: gcc/combine.c =================================================================== --- gcc/combine.c 2017-07-13 09:18:43.779386786 +0100 +++ gcc/combine.c 2017-07-13 09:18:44.175354711 +0100 @@ -445,7 +445,6 @@ static rtx expand_compound_operation (rt static const_rtx expand_field_assignment (const_rtx); static rtx make_extraction (machine_mode, rtx, HOST_WIDE_INT, rtx, unsigned HOST_WIDE_INT, int, int, int); -static rtx extract_left_shift (rtx, int); static int get_pos_from_mask (unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT *); static rtx canon_reg_for_combine (rtx, rtx); @@ -7802,14 +7801,14 @@ make_extraction (machine_mode mode, rtx return new_rtx; } -/* See if X contains an ASHIFT of COUNT or more bits that can be commuted - with any other operations in X. Return X without that shift if so. */ +/* See if X (of mode MODE) contains an ASHIFT of COUNT or more bits that + can be commuted with any other operations in X. Return X without + that shift if so. */ static rtx -extract_left_shift (rtx x, int count) +extract_left_shift (scalar_int_mode mode, rtx x, int count) { enum rtx_code code = GET_CODE (x); - machine_mode mode = GET_MODE (x); rtx tem; switch (code) @@ -7825,7 +7824,7 @@ extract_left_shift (rtx x, int count) break; case NEG: case NOT: - if ((tem = extract_left_shift (XEXP (x, 0), count)) != 0) + if ((tem = extract_left_shift (mode, XEXP (x, 0), count)) != 0) return simplify_gen_unary (code, mode, tem, mode); break; @@ -7836,7 +7835,7 @@ extract_left_shift (rtx x, int count) if (CONST_INT_P (XEXP (x, 1)) && (UINTVAL (XEXP (x, 1)) & (((HOST_WIDE_INT_1U << count)) - 1)) == 0 - && (tem = extract_left_shift (XEXP (x, 0), count)) != 0) + && (tem = extract_left_shift (mode, XEXP (x, 0), count)) != 0) { HOST_WIDE_INT val = INTVAL (XEXP (x, 1)) >> count; return simplify_gen_binary (code, mode, tem, @@ -7864,7 +7863,7 @@ extract_left_shift (rtx x, int count) - Return a new rtx, which the caller returns directly. */ static rtx -make_compound_operation_int (machine_mode mode, rtx *x_ptr, +make_compound_operation_int (scalar_int_mode mode, rtx *x_ptr, enum rtx_code in_code, enum rtx_code *next_code_ptr) { @@ -8171,7 +8170,7 @@ make_compound_operation_int (machine_mod && INTVAL (rhs) >= 0 && INTVAL (rhs) < HOST_BITS_PER_WIDE_INT && INTVAL (rhs) < mode_width - && (new_rtx = extract_left_shift (lhs, INTVAL (rhs))) != 0) + && (new_rtx = extract_left_shift (mode, lhs, INTVAL (rhs))) != 0) new_rtx = make_extraction (mode, make_compound_operation (new_rtx, next_code), 0, NULL_RTX, mode_width - INTVAL (rhs), code == LSHIFTRT, 0, in_code == COMPARE);