From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 64367 invoked by alias); 9 Dec 2016 13:07:37 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 64264 invoked by uid 89); 9 Dec 2016 13:07:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 09 Dec 2016 13:07:33 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DD52E707; Fri, 9 Dec 2016 05:07:31 -0800 (PST) Received: from localhost (e105548-lin.manchester.arm.com [10.45.32.67]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8AC673F477 for ; Fri, 9 Dec 2016 05:07:31 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [22/67] Replace !VECTOR_MODE_P with is_a References: <87h96dp8u6.fsf@e105548-lin.cambridge.arm.com> Date: Fri, 09 Dec 2016 13:07:00 -0000 In-Reply-To: <87h96dp8u6.fsf@e105548-lin.cambridge.arm.com> (Richard Sandiford's message of "Fri, 09 Dec 2016 12:48:01 +0000") Message-ID: <87twadl08e.fsf@e105548-lin.cambridge.arm.com> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2016-12/txt/msg00793.txt.bz2 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. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * simplify-rtx.c (simplify_binary_operation_1): Use is_a instead of !VECTOR_MODE_P. diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index cb0e43d..e5e7a71 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -2124,7 +2124,7 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode, 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. */ @@ -3357,27 +3357,24 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode, (subreg:M1 (ashiftrt:M2 (reg:M2) (const_int )) ). */ if (code == ASHIFTRT - && !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 (ASHIFTRT, - GET_MODE (SUBREG_REG (op0)), + tmp = simplify_gen_binary (ASHIFTRT, inner_mode, XEXP (SUBREG_REG (op0), 0), tmp); - return lowpart_subreg (mode, tmp, inner_mode); + return lowpart_subreg (int_mode, tmp, inner_mode); } canonicalize_shift: if (SHIFT_COUNT_TRUNCATED && CONST_INT_P (op1))