From patchwork Thu Aug 18 22:03:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 622 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6a10:38f:b0:2d5:3c95:9e21 with SMTP id 15csp554107pxh; Thu, 18 Aug 2022 15:09:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR5WXEZ0pUx9uwsPdPUA22t/IWWTJO9g+uuMdnlLjsfDo/rSXIc+TMQEQMO24g/GiDC3JGTg X-Received: by 2002:a17:907:9810:b0:73c:37bb:c4db with SMTP id ji16-20020a170907981000b0073c37bbc4dbmr1855322ejc.79.1660860543980; Thu, 18 Aug 2022 15:09:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660860543; cv=none; d=google.com; s=arc-20160816; b=pm9JKo+jHux2vdWWc73A19JoqzW32glBoFPqUrw0ALUQdIomDnvHUwyPaUSb7Sfuir aAxvR9e/Dc6gnjwPnGQfeTK6ZdV9pjkJK4cOEUCEDsKT9Ms4rDbblH4wF26BS/YOz57N P/PwCaB4w8i6JONnvYdwjUs5teb1fUqH1VCYAs9fDFbsp9o8UvlBnkZOYGy7E7M2qTDY x6KilUNzv43VO3hLaQ1PAi3Xt0YewKO2nJWdRRRLAWJJVbSau1sVppg1LM7y2U2fHZGD 7ykrYinrGn3Ex6OWAXJkaxOM9pGVwz/X3tP1PRNDcsZIL24HgplZLLFJUnJbBrpL5Akm M8Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mime-version:references:in-reply-to:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=dMXZcIuSX5tUsXJmdzAbwh6nG2+RoH1xqW6QcNDu4vo=; b=Fi2meKyJtH6zqdnO9fIAO7l0HlMqHv7ZwMejdwLAibdV0O0G+v9q1BQvDDrVUsUkQv oiQ1suC/NnvukP0A3BEx3XbRyBTo7nDnZldNeLyqnUbSdc/fLLkl54EFf+ee/Mwv01JN rm12wiV2MJ0k2uPsAuqcW6JnRdIehB3wxrLzI1xUo4WjGHJMNpfIWHDMOvXURBCaxxxZ D7nVzjeudVZ0edishVqQoCiFjjf6OqGQToMiWJA2MzlI5/xHXrL9tV0J5EgUtKTjJlJu RY6lOZ0wlqgUwEGQq6qEcp0qlIemVG6hIc9wedxPfiauUR8U5NiXuaqFtOOWH6JJQVOi eKtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="ncppS/T3"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id f23-20020a170906495700b00731745a7f05si1607415ejt.275.2022.08.18.15.09.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Aug 2022 15:09:03 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="ncppS/T3"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 285E93857BBE for ; Thu, 18 Aug 2022 22:08:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 285E93857BBE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1660860483; bh=dMXZcIuSX5tUsXJmdzAbwh6nG2+RoH1xqW6QcNDu4vo=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ncppS/T3iwyAE1thkiqDNk9SvPwLEf2Doq+U87g5a5DruAMSjTvlEEGFIkbaF8gX6 dvxIdyzViboTX/ZKatzFo79CM5dlQ1uMq9sXRiPhMXq6+6l3ey4rnnQfQcDlPsZRYy ZfaL7Um+PlDictUo/GAAr9r/m5oHAgXEntlkb9pc= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by sourceware.org (Postfix) with ESMTPS id 9E1E438582A2 for ; Thu, 18 Aug 2022 22:04:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9E1E438582A2 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27IHqWrH002457 for ; Thu, 18 Aug 2022 15:04:05 -0700 Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3j1t6r10wr-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 18 Aug 2022 15:04:05 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 18 Aug 2022 15:04:04 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 18 Aug 2022 15:04:04 -0700 Received: from linux.wrightpinski.org.com (unknown [10.69.242.198]) by maili.marvell.com (Postfix) with ESMTP id 41F0B3F7080; Thu, 18 Aug 2022 15:04:04 -0700 (PDT) To: Subject: [PATCH 10/10] [RISCV] Fix PR 106632 and PR 106588 a few constraints in bitmanip.md Date: Thu, 18 Aug 2022 15:03:53 -0700 Message-ID: <1660860233-11175-11-git-send-email-apinski@marvell.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1660860233-11175-1-git-send-email-apinski@marvell.com> References: <1660860233-11175-1-git-send-email-apinski@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: khEe3rJrtfgJ71rnKBaFx3wM7fEl93ng X-Proofpoint-GUID: khEe3rJrtfgJ71rnKBaFx3wM7fEl93ng X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-18_16,2022-08-18_01,2022-06-22_01 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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-Patchwork-Original-From: apinski--- via Gcc-patches From: "Li, Pan2 via Gcc-patches" Reply-To: apinski@marvell.com Cc: Andrew Pinski Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1741538505591768670?= X-GMAIL-MSGID: =?utf-8?q?1741538505591768670?= 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")])