From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6871 invoked by alias); 9 Dec 2016 13:22:30 -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 6792 invoked by uid 89); 9 Dec 2016 13:22:29 -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=sk:distrib, recursive, site 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:22:26 +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 B87B1707; Fri, 9 Dec 2016 05:22:24 -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 646253F477 for ; Fri, 9 Dec 2016 05:22:24 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [44/67] Make simplify_and_const_int take a scalar_int_mode References: <87h96dp8u6.fsf@e105548-lin.cambridge.arm.com> Date: Fri, 09 Dec 2016 13:22: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: <877f79i6ep.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/msg00816.txt.bz2 After previous patches, top-level calls to simplify_and_const_int always pass a scalar_int_mode. The only call site that needs to be updated is the recursive one in simplify_and_const_int_1, at which point we know "varop" has a scalar integer mode. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * combine.c (simplify_and_const_int): Change the type of the mode parameter to scalar_int_mode. (simplify_and_const_int_1): Likewise. Update recursive call. diff --git a/gcc/combine.c b/gcc/combine.c index 58a8d7d..5262bf9 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -456,9 +456,9 @@ static int rtx_equal_for_field_assignment_p (rtx, rtx, bool = false); static rtx make_field_assignment (rtx); static rtx apply_distributive_law (rtx); static rtx distribute_and_simplify_rtx (rtx, int); -static rtx simplify_and_const_int_1 (machine_mode, rtx, +static rtx simplify_and_const_int_1 (scalar_int_mode, rtx, unsigned HOST_WIDE_INT); -static rtx simplify_and_const_int (rtx, machine_mode, rtx, +static rtx simplify_and_const_int (rtx, scalar_int_mode, rtx, unsigned HOST_WIDE_INT); static int merge_outer_ops (enum rtx_code *, HOST_WIDE_INT *, enum rtx_code, HOST_WIDE_INT, machine_mode, int *); @@ -9880,7 +9880,7 @@ distribute_and_simplify_rtx (rtx x, int n) (const_int CONSTOP)). Otherwise, return NULL_RTX. */ static rtx -simplify_and_const_int_1 (machine_mode mode, rtx varop, +simplify_and_const_int_1 (scalar_int_mode mode, rtx varop, unsigned HOST_WIDE_INT constop) { unsigned HOST_WIDE_INT nonzero; @@ -9940,19 +9940,20 @@ simplify_and_const_int_1 (machine_mode mode, rtx varop, won't match a pattern either with or without this. */ if (GET_CODE (varop) == IOR || GET_CODE (varop) == XOR) - return - gen_lowpart - (mode, - apply_distributive_law - (simplify_gen_binary (GET_CODE (varop), GET_MODE (varop), - simplify_and_const_int (NULL_RTX, - GET_MODE (varop), - XEXP (varop, 0), - constop), - simplify_and_const_int (NULL_RTX, - GET_MODE (varop), - XEXP (varop, 1), - constop)))); + { + scalar_int_mode varop_mode = as_a (GET_MODE (varop)); + return + gen_lowpart + (mode, + apply_distributive_law + (simplify_gen_binary (GET_CODE (varop), varop_mode, + simplify_and_const_int (NULL_RTX, varop_mode, + XEXP (varop, 0), + constop), + simplify_and_const_int (NULL_RTX, varop_mode, + XEXP (varop, 1), + constop)))); + } /* If VAROP is PLUS, and the constant is a mask of low bits, distribute the AND and see if one of the operands simplifies to zero. If so, we @@ -9995,7 +9996,7 @@ simplify_and_const_int_1 (machine_mode mode, rtx varop, X is zero, we are to always construct the equivalent form. */ static rtx -simplify_and_const_int (rtx x, machine_mode mode, rtx varop, +simplify_and_const_int (rtx x, scalar_int_mode mode, rtx varop, unsigned HOST_WIDE_INT constop) { rtx tem = simplify_and_const_int_1 (mode, varop, constop);