From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1256) id 477013858404; Tue, 2 Nov 2021 16:05:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 477013858404 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Maciej W. Rozycki To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-4848] RISC-V: Fix build errors with shNadd/shNadd.uw patterns in zba cost model X-Act-Checkin: gcc X-Git-Author: Maciej W. Rozycki X-Git-Refname: refs/heads/master X-Git-Oldrev: 64bf0c835f8918adf7e4140a04ac79c2963204aa X-Git-Newrev: c33a5cc9e7f1475108892abb147f9382ecbaec12 Message-Id: <20211102160552.477013858404@sourceware.org> Date: Tue, 2 Nov 2021 16:05:52 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Nov 2021 16:05:52 -0000 https://gcc.gnu.org/g:c33a5cc9e7f1475108892abb147f9382ecbaec12 commit r12-4848-gc33a5cc9e7f1475108892abb147f9382ecbaec12 Author: Maciej W. Rozycki Date: Tue Nov 2 16:05:00 2021 +0000 RISC-V: Fix build errors with shNadd/shNadd.uw patterns in zba cost model Fix a build regression from commit 04a9b554ba1a ("RISC-V: Cost model for zba extension."): .../gcc/config/riscv/riscv.c: In function 'bool riscv_rtx_costs(rtx, machine_mode, int, int, int*, bool)': .../gcc/config/riscv/riscv.c:2018:11: error: 'and' of mutually exclusive equal-tests is always 0 [-Werror] 2018 | && IN_RANGE (INTVAL (XEXP (XEXP (x, 0), 0)), 1, 3)) | ^~ .../gcc/config/riscv/riscv.c:2047:17: error: unused variable 'ashift_lhs' [-Werror=unused-variable] 2047 | rtx ashift_lhs = XEXP (and_lhs, 0); | ^~~~~~~~~~ by correcting a CONST_INT_P check referring the wrong operand and getting rid of the unused variable. gcc/ * config/riscv/riscv.c (riscv_rtx_costs): Correct a CONST_INT_P check and remove an unused local variable with shNadd/shNadd.uw pattern handling. Diff: --- gcc/config/riscv/riscv.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c index 6aef3d3a6cf..5387bfc18aa 100644 --- a/gcc/config/riscv/riscv.c +++ b/gcc/config/riscv/riscv.c @@ -2014,8 +2014,8 @@ riscv_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno ATTRIBUTE_UN (TARGET_64BIT && (mode == DImode))) && (GET_CODE (XEXP (x, 0)) == ASHIFT) && REG_P (XEXP (XEXP (x, 0), 0)) - && CONST_INT_P (XEXP (XEXP (x, 0), 0)) - && IN_RANGE (INTVAL (XEXP (XEXP (x, 0), 0)), 1, 3)) + && CONST_INT_P (XEXP (XEXP (x, 0), 1)) + && IN_RANGE (INTVAL (XEXP (XEXP (x, 0), 1)), 1, 3)) { *total = COSTS_N_INSNS (1); return true; @@ -2044,7 +2044,6 @@ riscv_rtx_costs (rtx x, machine_mode mode, int outer_code, int opno ATTRIBUTE_UN if (!CONST_INT_P (and_rhs)) break; - rtx ashift_lhs = XEXP (and_lhs, 0); rtx ashift_rhs = XEXP (and_lhs, 1); if (!CONST_INT_P (ashift_rhs)