From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by sourceware.org (Postfix) with ESMTPS id D80EA3858415 for ; Mon, 22 Aug 2022 20:44:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D80EA3858415 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dabbelt.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dabbelt.com Received: by mail-pj1-x1030.google.com with SMTP id pm13so3219462pjb.5 for ; Mon, 22 Aug 2022 13:44:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc; bh=XSGLXb6ITVpSYtnddR0Lz6JOHzG3J7+oWgwCEEyc3uI=; b=2T6q8mQEs2bQ8jSZE1ayZCQlMGkdp8TNc8VOARyzDIVRfU1yHTanz0CDnDttFPaiwF 8Y+4N4ZVp09AtYIcJGJzObduhS+k70w9Qrqpt5Bh9mwqA8SgIYxLDjl65bOY/mQyztC2 /8MZ28taMRWK1tUzQiFnDyCZhRyq7EQnsmu3TgOc62Oo/J67v6qhroCPGxJotafK9/7G sLz/vSUimS1NqKBfcTQ/nIGz+K46x1Aw9vYZMqW8QcvXR2FTBpQucJa5HX+/BjHeRbuv 42tlyi0wV4QDi6A4WKVhrcURMRwrPVPUvcFii99o5EFrIlejkjIVlXrS+ywzJaIiICZv T1JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc; bh=XSGLXb6ITVpSYtnddR0Lz6JOHzG3J7+oWgwCEEyc3uI=; b=2tn9MiZzVZUwlWT9o33dwizVH0xmhlxUDOpCEwLMcff+VPM3ym2/HElQXiRYU45Ylb VnbBasJrXvzB515nvf9v/dEM/fX/tVPtxBrA3xcPmpSPg7xTnrmHerug7L1XWvJuF9eg w4zZgraF8eFQR9Q9/CwzYP5qEw5ee10EXJlBEeeMuzlMWhSTSuaBIYR11pxRUyewtn1B +Qf3k52i57IBupriuuxw7k0ZCFF7Bbko9PHWmc94iUuCtgIdmChSnJ2o9XLBYghldGfE 5xThF9IZWFhzxWZ/nRFrNR3fKmNrB2MYNMZtf974h/OSeYX/1nhmif6v7dQu5JDyWfi+ FeiA== X-Gm-Message-State: ACgBeo05biq2FMVGhliwadxocyuOZpQRJXF9AC5Lj9ytWl2tgIYEz8/d GWv3VSJB7hqeOB3WEb8z4h59zERzXv+pbQ== X-Google-Smtp-Source: AA6agR7vo0WYHndjR0KGVj5ipbhQoZF7oCWlgX9p8Ri6/JJuVE40+yCjJg5EtsoqJtMJjQwqi/GNqQ== X-Received: by 2002:a17:903:1209:b0:16b:81f6:e952 with SMTP id l9-20020a170903120900b0016b81f6e952mr22260801plh.48.1661201061393; Mon, 22 Aug 2022 13:44:21 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id 138-20020a621690000000b0052acb753b8bsm5977017pfw.158.2022.08.22.13.44.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 13:44:20 -0700 (PDT) Date: Mon, 22 Aug 2022 13:44:20 -0700 (PDT) X-Google-Original-Date: Mon, 22 Aug 2022 13:44:13 PDT (-0700) Subject: Re: [PATCH 10/10] [RISCV] Fix PR 106632 and PR 106588 a few constraints in bitmanip.md In-Reply-To: <1660860233-11175-11-git-send-email-apinski@marvell.com> CC: gcc-patches@gcc.gnu.org, apinski@marvell.com From: Palmer Dabbelt To: gcc-patches@gcc.gnu.org Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, MEDICAL_SUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: , X-List-Received-Date: Mon, 22 Aug 2022 20:44:25 -0000 On Thu, 18 Aug 2022 15:03:53 PDT (-0700), gcc-patches@gcc.gnu.org wrote: > From: Andrew Pinski > > The constraints should be n instead of i. Also there > needs to a check for out of bounds zero_extract for > *bexti. > > gcc/ChangeLog: > > PR target/106632 > PR target/106588 > * config/riscv/bitmanip.md (*shNadduw): Use n constraint > instead of i. > (*slliuw): Likewise. > (*bexti): Likewise. Also add a check for operands[2] to be less > than the mode bitsize. > --- > gcc/config/riscv/bitmanip.md | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/gcc/config/riscv/bitmanip.md b/gcc/config/riscv/bitmanip.md > index 026299d6703..ecf5b51b533 100644 > --- a/gcc/config/riscv/bitmanip.md > +++ b/gcc/config/riscv/bitmanip.md > @@ -44,7 +44,7 @@ (define_insn "*shNadduw" > (plus:DI > (and:DI (ashift:DI (match_operand:DI 1 "register_operand" "r") > (match_operand:QI 2 "imm123_operand" "Ds3")) > - (match_operand 3 "immediate_operand" "")) > + (match_operand 3 "immediate_operand" "n")) > (match_operand:DI 4 "register_operand" "r")))] > "TARGET_64BIT && TARGET_ZBA > && (INTVAL (operands[3]) >> INTVAL (operands[2])) == 0xffffffff" > @@ -110,7 +110,7 @@ (define_insn "*slliuw" > [(set (match_operand:DI 0 "register_operand" "=r") > (and:DI (ashift:DI (match_operand:DI 1 "register_operand" "r") > (match_operand:QI 2 "immediate_operand" "I")) > - (match_operand 3 "immediate_operand" "")))] > + (match_operand 3 "immediate_operand" "n")))] > "TARGET_64BIT && TARGET_ZBA > && (INTVAL (operands[3]) >> INTVAL (operands[2])) == 0xffffffff" > "slli.uw\t%0,%1,%2" > @@ -354,6 +354,7 @@ (define_insn "*bexti" > (zero_extract:X (match_operand:X 1 "register_operand" "r") > (const_int 1) > (match_operand 2 "immediate_operand" "i")))] > - "TARGET_ZBS" > + (match_operand 2 "immediate_operand" "n")))] > + "TARGET_ZBS && UINTVAL (operands[2]) < GET_MODE_BITSIZE (mode)" > "bexti\t%0,%1,%2" > [(set_attr "type" "bitmanip")]) I think something went off the rails on that last chunk and it should look more like @@ -353,7 +353,7 @@ [(set (match_operand:X 0 "register_operand" "=r") (zero_extract:X (match_operand:X 1 "register_operand" "r") (const_int 1) - (match_operand 2 "immediate_operand" "i")))] - "TARGET_ZBS" + (match_operand 2 "immediate_operand" "n")))] + "TARGET_ZBS && UINTVAL (operands[2]) < GET_MODE_BITSIZE (mode)" "bexti\t%0,%1,%2" [(set_attr "type" "bitmanip")]) with that I get no new failures on trunk with all of these (though I'm still only testing the Linux multilibs for now).