From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10895 invoked by alias); 9 Dec 2016 13:23:08 -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 10791 invoked by uid 89); 9 Dec 2016 13:23:07 -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=Hx-languages-length:3118 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:57 +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 08655C14; Fri, 9 Dec 2016 05:22:56 -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 A89283F477 for ; Fri, 9 Dec 2016 05:22:55 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [45/67] Make extract_left_shift take a scalar_int_mode References: <87h96dp8u6.fsf@e105548-lin.cambridge.arm.com> Date: Fri, 09 Dec 2016 13:23: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: <8737hxi6dt.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/msg00819.txt.bz2 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. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * 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. diff --git a/gcc/combine.c b/gcc/combine.c index 5262bf9..fac82d4 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -442,7 +442,6 @@ static rtx expand_compound_operation (rtx); 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); @@ -7778,14 +7777,14 @@ make_extraction (machine_mode mode, rtx inner, HOST_WIDE_INT pos, 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) @@ -7801,7 +7800,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; @@ -7812,7 +7811,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, @@ -7840,7 +7839,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) { @@ -8147,7 +8146,7 @@ make_compound_operation_int (machine_mode mode, rtx *x_ptr, && 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);