From patchwork Fri Sep 15 01:20:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fei Gao X-Patchwork-Id: 139955 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp732663vqi; Thu, 14 Sep 2023 18:20:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG53o0DUqJ2SsMtKCcrxMrT/UgB04hVScXle62WJGVSs4rIqt1mNZTh0cyl8FZpUcODem8Y X-Received: by 2002:a17:906:58c9:b0:9ad:87df:4126 with SMTP id e9-20020a17090658c900b009ad87df4126mr4678810ejs.1.1694740859538; Thu, 14 Sep 2023 18:20:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694740859; cv=none; d=google.com; s=arc-20160816; b=hn/kbb0LsdcbuXN0eilr7TDbj5Ai7rEzLtBr/iui4bBp8AnjxzdrSz8t7h4v7EByEg f0EmLeCQTaZjcru00/lPk3Ckwa9flPKtiT12KAL2y/wpI2i6dExWEi3nv17xF2/kGX8k VTZfdV6ybl6DlHvYrEsxW5LBEf2Di0XW4LsicTxBTTUklF/+pbaOXisZdIAqml75iZ7q 64Q9g5Cngju1C0lEP5MC2zdlwOncII0M7LuxQrLGfFIEhvEX7YFwIboo+C4bVTa7RdXH UtIBWJJ58Uhg2gKhqnzDLN1AQMBIR66uNNubqATZXzSKBQx0xvfd+EbI1PCI2xgrAg2A yJwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:message-id:date:subject:cc:to :from:dmarc-filter:delivered-to; bh=pYlp4OLfFOsIuVl1/pkXd4ak01xMyhQeADXqquYAsu0=; fh=Y/yQogbsS6cCsFKoSBG5F5aMajnsIGS+nZALEDYwqfM=; b=i04O7t4n9lKb3Rb8dLlTMo0g1hxMg1+nRu4qPshDghh2RnXkPzI/RxF+2XHnHUP9R2 JfASYcIInMw3lrpRr9tbh7n2Rk7sm8PVlbRaCY5Ze5SJ0LHmeDqhgRrFDWZEuLnvjCPY fXUynUMf4AO0ci74hV13zEC19ubntLIEX8PEqnv3juYLuXK5x4XyXyoTNVbo04wLbeSW 3q2HrVTd9X2jO4gFc2GEFanUHQv9/xTPJKtkmQYb/30elOZBcRGzPZ15JA9QapKhVqIg ghFnxTK40DmFCs1NkO3kIDcmtZs3qB4z+U07UYyipPfDIvc70JxDAzEL8a0RDtmL0d3H TFOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id e3-20020a1709067e0300b0099cbdc0b7c3si2304515ejr.243.2023.09.14.18.20.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 18:20:59 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B65B4385828D for ; Fri, 15 Sep 2023 01:20:55 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from zg8tmtu5ljg5lje1ms4xmtka.icoremail.net (zg8tmtu5ljg5lje1ms4xmtka.icoremail.net [159.89.151.119]) by sourceware.org (Postfix) with ESMTP id B87C13858C52 for ; Fri, 15 Sep 2023 01:20:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B87C13858C52 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=eswincomputing.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=eswincomputing.com Received: from localhost.localdomain (unknown [10.12.130.31]) by app2 (Coremail) with SMTP id EggMCgAXXpRUsQNlAWtHAA--.33825S4; Fri, 15 Sep 2023 09:20:21 +0800 (CST) From: Fei Gao To: gcc-patches@gcc.gnu.org Cc: kito.cheng@gmail.com, palmer@dabbelt.com, jeffreyalaw@gmail.com, dimitar@dinux.eu, Fei Gao Subject: [PATCH] [RISC-V] fix PR 111259 invalid zcmp mov predicate. Date: Fri, 15 Sep 2023 01:20:08 +0000 Message-Id: <20230915012008.17934-1-gaofei@eswincomputing.com> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: EggMCgAXXpRUsQNlAWtHAA--.33825S4 X-Coremail-Antispam: 1UD129KBjvJXoW7uF47AFy8Zw48tFy8tw4UCFg_yoW8Wry5p3 ykGa45KFW0yr4Y934xKFW8JayUGrn5tF1j9rZ0k3sFk34DCryDJF10kFWftF9rXF4Fyw43 Cw4Ikw1Fyw1UJaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUk214x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lc2xSY4AK6svPMxAI w28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr 4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwIxG rwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8Jw CI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2 z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjfUoOJ5UUUUU X-CM-SenderInfo: xjdrwv3l6h245lqf0zpsxwx03jof0z/ X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777064591518576497 X-GMAIL-MSGID: 1777064591518576497 The code changes are from Palmer. root cause: In a gcc build with --enable-checking=yes, REGNO (op) checks rtx code and expected code 'reg'. so a rtx with 'subreg' causes an internal compiler error. solution: Restrict predicate to allow 'reg' only. gcc/ChangeLog: * config/riscv/predicates.md: Restrict predicate to allow 'reg' only. Reviewed-by: Palmer Dabbelt T Acked-by: Palmer Dabbelt --- gcc/config/riscv/predicates.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/config/riscv/predicates.md b/gcc/config/riscv/predicates.md index 53e7c1d03aa..4bc7ff2c9d8 100644 --- a/gcc/config/riscv/predicates.md +++ b/gcc/config/riscv/predicates.md @@ -74,6 +74,7 @@ (ior (match_operand 0 "const_0_operand") (match_operand 0 "register_operand"))) +;; ZCMP predicates (define_predicate "stack_push_up_to_ra_operand" (and (match_code "const_int") (match_test "riscv_zcmp_valid_stack_adj_bytes_p (INTVAL (op) * -1, 1)"))) @@ -170,13 +171,12 @@ (and (match_code "const_int") (match_test "riscv_zcmp_valid_stack_adj_bytes_p (INTVAL (op), 13)"))) -;; ZCMP predicates (define_predicate "a0a1_reg_operand" - (and (match_operand 0 "register_operand") + (and (match_code "reg") (match_test "IN_RANGE (REGNO (op), A0_REGNUM, A1_REGNUM)"))) (define_predicate "zcmp_mv_sreg_operand" - (and (match_operand 0 "register_operand") + (and (match_code "reg") (match_test "TARGET_RVE ? IN_RANGE (REGNO (op), S0_REGNUM, S1_REGNUM) : IN_RANGE (REGNO (op), S0_REGNUM, S1_REGNUM) || IN_RANGE (REGNO (op), S2_REGNUM, S7_REGNUM)")))