From patchwork Thu Jul 13 08:46:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 107608 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1930835qge; Thu, 13 Jul 2017 01:48:07 -0700 (PDT) X-Received: by 10.98.166.91 with SMTP id t88mr60600121pfe.153.1499935687705; Thu, 13 Jul 2017 01:48:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499935687; cv=none; d=google.com; s=arc-20160816; b=LC6mO9uPWKOGImb4/4oUzcRt/Xvm9SGbdKUyw3Gc/zKHMKm6Prd4gLBAdIlWfjEGo9 pxuAThtSjRrSML12OMBR+0pRzgQj79NcPzC+B2QStsyeYly1B/72kOVrdlC7iHzAn9ur RinWE9yLVbhbazdCGmULA5oYMCrdmzXAxh7k5DL/eCS/SiAo9qMSoZjWJDx3JP6cth02 QFqxuBx0GSekSf4f1VS/nefTBZy0QMttxulCwIcYwcAWlUXuLoOIssy/wp3MWXeC1aGg /RxYmGvq/S+7Nw5T/muqyvAmRkEkyA6SXCdjq9JR9QbvKz4uR4SiLnfYX/1AtvJ1liCy tUJw== 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=KRDZJO7CAxil5zuegm4qHY23s6ecnIUCf9t2q4i4yG4=; b=M5/hbJn7V7Vd+V9TC788FnMQ1PtqaR4BE3w0qWH8E/lMWa/RE6NIV9RAuB27bWQEok YtpYJXlp1HrB08wByYN+8mRlpNrTp7JjtSVihvBy710EbpOPtAEvjbSQ9SI4TGR+AZoW xqSEkLs+7TmQ6wZL/Mzn3utLiLpEavj6wKRc1D2sl/vdX6YLUYsBsU4XxMnjt64pggkJ dGjtdh/tQ+ju3ggOHkyHZsXpX+MuiufLWiKqvtqe+0f59tBcXazO5VyLmR/xRYKlzu1P rYstr2UuxxZKAY8DWJM1S//fD6jOXRsIehuSt5FOt84S+m++XUDSrT6fIYPXkZd8Nhs9 TLvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.b=e+WLnE5X; spf=pass (google.com: domain of gcc-patches-return-458013-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458013-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 t19si4005349plj.412.2017.07.13.01.48.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 01:48:07 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-458013-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=e+WLnE5X; spf=pass (google.com: domain of gcc-patches-return-458013-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-458013-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=MzTxVZmOA6ZfcAnAa7OkDXJpSAn8N iX5z4e4IjIyDLRKGJ902fHKstQukcGnUeKkDKi1JApzmJPgLSkBXy5rVlTH+c8Zw RT5NNP+lsxFi44ePh4RwPMS51UX75zlQXtNYRL+tmsuYGQaer92HDPp6Z5CmSXop RrKATO4Uieqcl0= 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=MT5c7BRDMA+LUcEsZwUmfFEH/hE=; b=e+W LnE5XMVV3PffzEioxTu8z3bW/0FeBdg7B2DAbyCfYSbRFZQTtqcyfzACGkTorE3m FRTrNdZAAvUiwV7OK8biyVmyFbWYVsgEYSCCrGtGGwyfhiGlHRus4Zq/qcJkQ+gO KOOJmenCu8ARFjYrsp1tb1/8NZxXLekJU6/SOTyI= Received: (qmail 57457 invoked by alias); 13 Jul 2017 08:46:54 -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 57145 invoked by uid 89); 13 Jul 2017 08:46:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2314 X-HELO: mail-wr0-f174.google.com Received: from mail-wr0-f174.google.com (HELO mail-wr0-f174.google.com) (209.85.128.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Jul 2017 08:46:50 +0000 Received: by mail-wr0-f174.google.com with SMTP id 77so49600654wrb.1 for ; Thu, 13 Jul 2017 01:46:49 -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=KRDZJO7CAxil5zuegm4qHY23s6ecnIUCf9t2q4i4yG4=; b=navZjCAawYtw2QOrkorJqxjSbT9ZqwYqkxaSyuya2oc/8xTdFIiFo5dpeTNgQlMXnF rSlbtJvAHKd0eOg+RftmyMJviBy4dhX/ugSoP/QjULhp7Ks9iQKP+NehkKUQFvXRXF/6 Ml8wm1lIYztd0sq4LPfyOxZqbrISoAlMD05ezDMI0luZFWVCE3hNzJuOXKkrvFLtRDV/ e4i90RdwMloJYmNiBqnC0/RrFabnjuQn2veNJP44dkA0qYYOtuyTW7hp1RCd13VxdrSr NVFZREFIthD1YJoyTbZkC79l/nmZpXcgvp8EPcsw9hf4EXiNE3vC+ZoYhOIfL7BuW8Me oE1w== X-Gm-Message-State: AIVw113g0iypebxInkeGfulT4JVRdJA16VRIFcyaMKXGZqgo3OokKpcX ouFZL22LqwPqDo70a+p8ZQ== X-Received: by 10.223.155.197 with SMTP id e5mr760512wrc.55.1499935607772; Thu, 13 Jul 2017 01:46:47 -0700 (PDT) Received: from localhost (92.40.249.184.threembb.co.uk. [92.40.249.184]) by smtp.gmail.com with ESMTPSA id h130sm5115952wmd.34.2017.07.13.01.46.46 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Jul 2017 01:46:47 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [22/77] Replace !VECTOR_MODE_P with is_a References: <8760ewohsv.fsf@linaro.org> Date: Thu, 13 Jul 2017 09:46:45 +0100 In-Reply-To: <8760ewohsv.fsf@linaro.org> (Richard Sandiford's message of "Thu, 13 Jul 2017 09:35:44 +0100") Message-ID: <87iniwk9l6.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch replaces some checks of !VECTOR_MODE_P with checks of is_a , in cases where the scalar integer modes were the only useful alternatives left. 2017-07-13 Richard Sandiford Alan Hayward David Sherwood gcc/ * simplify-rtx.c (simplify_binary_operation_1): Use is_a instead of !VECTOR_MODE_P. Index: gcc/simplify-rtx.c =================================================================== --- gcc/simplify-rtx.c 2017-07-13 09:18:32.529352614 +0100 +++ gcc/simplify-rtx.c 2017-07-13 09:18:33.217290298 +0100 @@ -2129,7 +2129,7 @@ simplify_binary_operation_1 (enum rtx_co rtx tem, reversed, opleft, opright; HOST_WIDE_INT val; unsigned int width = GET_MODE_PRECISION (mode); - scalar_int_mode int_mode; + scalar_int_mode int_mode, inner_mode; /* Even if we can't compute a constant result, there are some cases worth simplifying. */ @@ -3365,27 +3365,24 @@ simplify_binary_operation_1 (enum rtx_co (subreg:M1 ([a|l]shiftrt:M2 (reg:M2) (const_int )) ). */ if ((code == ASHIFTRT || code == LSHIFTRT) - && !VECTOR_MODE_P (mode) + && is_a (mode, &int_mode) && SUBREG_P (op0) && CONST_INT_P (op1) && GET_CODE (SUBREG_REG (op0)) == LSHIFTRT - && !VECTOR_MODE_P (GET_MODE (SUBREG_REG (op0))) + && is_a (GET_MODE (SUBREG_REG (op0)), + &inner_mode) && CONST_INT_P (XEXP (SUBREG_REG (op0), 1)) - && (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (op0))) - > GET_MODE_BITSIZE (mode)) + && GET_MODE_BITSIZE (inner_mode) > GET_MODE_BITSIZE (int_mode) && (INTVAL (XEXP (SUBREG_REG (op0), 1)) - == (GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (op0))) - - GET_MODE_BITSIZE (mode))) + == GET_MODE_BITSIZE (inner_mode) - GET_MODE_BITSIZE (int_mode)) && subreg_lowpart_p (op0)) { rtx tmp = GEN_INT (INTVAL (XEXP (SUBREG_REG (op0), 1)) + INTVAL (op1)); - machine_mode inner_mode = GET_MODE (SUBREG_REG (op0)); - tmp = simplify_gen_binary (code, - GET_MODE (SUBREG_REG (op0)), + tmp = simplify_gen_binary (code, inner_mode, XEXP (SUBREG_REG (op0), 0), tmp); - return lowpart_subreg (mode, tmp, inner_mode); + return lowpart_subreg (int_mode, tmp, inner_mode); } if (SHIFT_COUNT_TRUNCATED && CONST_INT_P (op1))