From patchwork Mon Nov 1 12:40:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 1549153 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256 header.s=google header.b=bTcAlskz; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HjXhh69z7z9sX3 for ; Mon, 1 Nov 2021 23:41:23 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B4059385843A for ; Mon, 1 Nov 2021 12:41:20 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id 6CBF83858427 for ; Mon, 1 Nov 2021 12:40:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6CBF83858427 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wm1-x331.google.com with SMTP id g191-20020a1c9dc8000000b0032fbf912885so7591471wme.4 for ; Mon, 01 Nov 2021 05:40:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:user-agent:mime-version; bh=lQDYC6YjZ3wqU7rCcmKTFVkOVhtF7q85BtPH7HDZQVQ=; b=bTcAlskz2vjDZ1Qw/QxKCmT9RdAqRP9YcRvo9uVNbc+NXsCAmLmSL0RYEAfKjL1xOv YIxPp0vE5lFzw0waV2GQG1r0p1MBO53idUvMGQc+PahcbKpB4eYqQTfc8y08seWRtHJj 6cLcGVEgdQJj7yMjlaeQzPVUbMNK77ZANi7WFfoipW0yXhFZfBHlYRSpXsUZn1mUi5tV GJaK2Vez7pJzQ5d0BgXCU5WUb3W+2eky7tGctWas4ktuYucbKwbeY6oiph4jopyioK9B LOAxDBzQhJNUa/ziC8ABlWychtpcWHMltbwznI2AK1ByfTJSRRDgIF/b7Lha6VzfEKDm H0wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:user-agent :mime-version; bh=lQDYC6YjZ3wqU7rCcmKTFVkOVhtF7q85BtPH7HDZQVQ=; b=xBl60m0uYcM/JFW8xpY9U8AAbDwpYtRjnZkAIGyyHmKVGtIZX/bZTqr3f90Ycru6gc 8UM3owkbWDeKt8ANYVz1tdKp+MyPpI14NIRrP5Jkx4U1Cqke2umDyNNbqQERPbXvdvEZ vsj5UCJmULDdWuAGGkkM/sDDiB50Jx9BhP9X97abUbagNB1oTpuHUPsYNJXnkWru99JA d/SYokdJI8WEs7MJi3XAo74XDtte/FUkdZYledQeDcxaeksYRfamstgU4Nj4IjBe4wFg XrDOSHWzT3sDyVQGH7kTHkouEWEVABiWXQBiot5R0KILEkzJVZds29wD1pECsdnNvf3Q LbRg== X-Gm-Message-State: AOAM533qdKItM54Lq6aUDsjVyJkCa0bhaqBe47ELdsfqMi6Hhtqbmq3a RMpPtnfGidDHfCLddRiNh90kiKC8+clyRaDy X-Google-Smtp-Source: ABdhPJw1PDXctEUGyV2Q6v70K6c2AtaXUpqxxxOSVsc4G7cWbOE8Hyx7Ae9YibV3T7RiZlz+YQtG8A== X-Received: by 2002:a7b:cb97:: with SMTP id m23mr2880771wmi.182.1635770456266; Mon, 01 Nov 2021 05:40:56 -0700 (PDT) Received: from [192.168.0.201] ([212.69.42.53]) by smtp.gmail.com with ESMTPSA id s24sm3162895wmj.26.2021.11.01.05.40.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Nov 2021 05:40:55 -0700 (PDT) Date: Mon, 1 Nov 2021 12:40:13 +0000 (GMT) From: "Maciej W. Rozycki" To: gcc-patches@gcc.gnu.org Subject: [PATCH] RISC-V: Fix build errors with shNadd/shNadd.uw patterns in zba cost model Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kito Cheng , Andrew Waterman Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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 removing an incorrect REG_P check applied to a constant expression and getting rid of the unused variable. gcc/ * config/riscv/riscv.c (riscv_rtx_costs): Remove a REG_P check and an unused local variable with shNadd/shNadd.uw pattern handling. --- Hi, As described above and I guess almost obvious -- I gather the code was only verified with a `-Wno-error' build and the handling of the shNadd pattern has not been actually covered owing to this bug making the condition impossible to match. OK to apply then? Maciej --- gcc/config/riscv/riscv.c | 2 -- 1 file changed, 2 deletions(-) gcc-riscv-rtx-costs-zba-shnadd.diff Index: gcc/gcc/config/riscv/riscv.c =================================================================== --- gcc.orig/gcc/config/riscv/riscv.c +++ gcc/gcc/config/riscv/riscv.c @@ -2013,7 +2013,6 @@ riscv_rtx_costs (rtx x, machine_mode mod && ((!TARGET_64BIT && (mode == SImode)) || (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)) { @@ -2044,7 +2043,6 @@ riscv_rtx_costs (rtx x, machine_mode mod 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)