From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpbg153.qq.com (smtpbg153.qq.com [13.245.218.24]) by sourceware.org (Postfix) with ESMTPS id B23E13858C2F for ; Mon, 22 Jan 2024 09:05:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B23E13858C2F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivai.ai Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivai.ai ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B23E13858C2F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=13.245.218.24 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705914330; cv=none; b=eaqIj6TA+/lsiE1nhthR9QH5PGGNYFbCtZQWGK8K0lBg3FSifzinbbDgT0Fu6EQLCzomXWEpsODtP0L+2AhpsS2cgEY8M/TuWDSDfCDpQ5LQR6ZggjdayNZ2BnmaQD4f0zMNMBMXWF8vYjoLo82Mx+4pYRjjTtKD8eqEfvkmxlg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705914330; c=relaxed/simple; bh=jED6HdoQyztKqxMoH5eDsdyr8Rf2/8eYbAw1XJJemfI=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=m6sXXlqeV8I0BvCGTVGm6ZSe024OG+3sE9BMy0uJt0Y/NN6K8HB339wpR8/dfjfCUiHHoADwNZaPreJ5yuY39KW1kYFztQoWxHxTzk4I5Q9JKsl8l89bOf5kla9T1rMerfiGOJoVi+yh2DxTm8KL+OB52GmhW9DUryh1KSppmRY= ARC-Authentication-Results: i=1; server2.sourceware.org X-QQ-mid: bizesmtp79t1705914310tu4bmx21 X-QQ-Originating-IP: QNyuGv3nQA2wlrW9wPnb85aJ1L4B29wYQtloAiuMBZY= Received: from rios-cad121.hadoop.rioslab.org ( [58.60.1.9]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 22 Jan 2024 17:05:09 +0800 (CST) X-QQ-SSF: 01400000000000G0V000000A0000000 X-QQ-FEAT: ldOlv20DOSl2+gqwmYMlCiu5H1MvyYh35wTiVwKhsYOuLgkHnse88N+EsyMwy kIhAsVJWbwv9j8hVtMhc6E1K4E3JoUjfVl4UZJ7eO+nu1dKwH6SNNGDnh8moR/R6Kk4MmcT h3sHHQAebbhisp8fBtPr1sTi28CV7BdBuYGCwZRGKF9mgK3IiyVXAnBctBwO+m4JUiZ2xsC BLOyzRd+him0OzU0ROxZq8PwQIS0acon50jrbdkDW1h7Bd2CyX+FAlsm3rdnOyO37X3gW3Q HiMj7adi/nUuW6tRmc1xmJAs48fVfxL8UkCWd3FfXAFvzRUkWYaJDr2tW2idDQ/HQxHn9wu DvKCsfAicgjIia3zVmmTpaFiJjPVriRGRG66rCK7zrvY1VFBQ9iTz7x01ijvoYYrEx4jPiX zaLYO43kD0NRxE9uZfVvsQ== X-QQ-GoodBg: 2 X-BIZMAIL-ID: 11284330976861158298 From: Juzhe-Zhong To: gcc-patches@gcc.gnu.org Cc: kito.cheng@gmail.com, kito.cheng@sifive.com, jeffreyalaw@gmail.com, rdapp.gcc@gmail.com, Juzhe-Zhong Subject: [PATCH] RISC-V: Fix regressions due to 86de9b66480b710202a2898cf513db105d8c432f Date: Mon, 22 Jan 2024 17:05:07 +0800 Message-Id: <20240122090507.2617720-1-juzhe.zhong@rivai.ai> X-Mailer: git-send-email 2.36.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:rivai.ai:qybglogicsvrgz:qybglogicsvrgz7a-one-0 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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 List-Id: This patch fixes the recent regression: FAIL: gcc.dg/torture/float32-tg-2.c -O1 (internal compiler error: in reg_or_subregno, at jump.cc:1895) FAIL: gcc.dg/torture/float32-tg-2.c -O1 (test for excess errors) FAIL: gcc.dg/torture/float32-tg-2.c -O2 (internal compiler error: in reg_or_subregno, at jump.cc:1895) FAIL: gcc.dg/torture/float32-tg-2.c -O2 (test for excess errors) FAIL: gcc.dg/torture/float32-tg-2.c -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error: in reg_or_subregno, at jump.cc:1895) FAIL: gcc.dg/torture/float32-tg-2.c -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: gcc.dg/torture/float32-tg-2.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error: in reg_or_subregno, at jump.cc:1895) FAIL: gcc.dg/torture/float32-tg-2.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: gcc.dg/torture/float32-tg-2.c -O3 -g (internal compiler error: in reg_or_subregno, at jump.cc:1895) FAIL: gcc.dg/torture/float32-tg-2.c -O3 -g (test for excess errors) FAIL: gcc.dg/torture/float32-tg-2.c -Os (internal compiler error: in reg_or_subregno, at jump.cc:1895) FAIL: gcc.dg/torture/float32-tg-2.c -Os (test for excess errors) FAIL: gcc.dg/torture/float32-tg.c -O1 (internal compiler error: in reg_or_subregno, at jump.cc:1895) FAIL: gcc.dg/torture/float32-tg.c -O1 (test for excess errors) FAIL: gcc.dg/torture/float32-tg.c -O2 (internal compiler error: in reg_or_subregno, at jump.cc:1895) FAIL: gcc.dg/torture/float32-tg.c -O2 (test for excess errors) FAIL: gcc.dg/torture/float32-tg.c -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error: in reg_or_subregno, at jump.cc:1895) FAIL: gcc.dg/torture/float32-tg.c -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: gcc.dg/torture/float32-tg.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error: in reg_or_subregno, at jump.cc:1895) FAIL: gcc.dg/torture/float32-tg.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: gcc.dg/torture/float32-tg.c -O3 -g (internal compiler error: in reg_or_subregno, at jump.cc:1895) FAIL: gcc.dg/torture/float32-tg.c -O3 -g (test for excess errors) FAIL: gcc.dg/torture/float32-tg.c -Os (internal compiler error: in reg_or_subregno, at jump.cc:1895) FAIL: gcc.dg/torture/float32-tg.c -Os (test for excess errors) FAIL: gcc.dg/torture/pr48124-4.c -O1 (internal compiler error: in reg_or_subregno, at jump.cc:1895) FAIL: gcc.dg/torture/pr48124-4.c -O1 (test for excess errors) FAIL: gcc.dg/torture/pr48124-4.c -O2 (internal compiler error: in reg_or_subregno, at jump.cc:1895) FAIL: gcc.dg/torture/pr48124-4.c -O2 (test for excess errors) FAIL: gcc.dg/torture/pr48124-4.c -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error: in reg_or_subregno, at jump.cc:1895) FAIL: gcc.dg/torture/pr48124-4.c -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: gcc.dg/torture/pr48124-4.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error: in reg_or_subregno, at jump.cc:1895) FAIL: gcc.dg/torture/pr48124-4.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: gcc.dg/torture/pr48124-4.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions (internal compiler error: in reg_or_subregno, at jump.cc:1895) FAIL: gcc.dg/torture/pr48124-4.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions (test for excess errors) FAIL: gcc.dg/torture/pr48124-4.c -O3 -g (internal compiler error: in reg_or_subregno, at jump.cc:1895) FAIL: gcc.dg/torture/pr48124-4.c -O3 -g (test for excess errors) FAIL: gcc.dg/torture/pr48124-4.c -Os (internal compiler error: in reg_or_subregno, at jump.cc:1895) FAIL: gcc.dg/torture/pr48124-4.c -Os (test for excess errors) due to commit 86de9b66480b710202a2898cf513db105d8c432f. The root cause is register_operand and reg_or_subregno are consistent so we reach the assertion fail. We shouldn't worry about subreg:...VL_REGNUM since it's impossible that we can have such situation, that is, we only have (set (reg) (reg:VL_REGNUM)) which generate "csrr vl" ASM for first fault load instructions (vleff). So, using REG_P and REGNO must be totally solid and robostic. Since we don't allow VL_RENUM involved into register allocation and we don't have such constraint, we always use this following pattern to generate "csrr vl" ASM: (define_insn "read_vlsi" [(set (match_operand:SI 0 "register_operand" "=r") (reg:SI VL_REGNUM))] "TARGET_VECTOR" "csrr\t%0,vl" [(set_attr "type" "rdvl") (set_attr "mode" "SI")]) So the check in riscv.md is to disallow such situation fall into move pattern in riscv.md Tested on both RV32/RV64 no regression. PR target/109092 gcc/ChangeLog: * config/riscv/riscv.md: Use reg instead of subreg. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/pr109092.c: New test. --- gcc/config/riscv/riscv.md | 6 ++---- gcc/testsuite/gcc.target/riscv/rvv/base/pr109092.c | 4 ++++ 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/base/pr109092.c diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md index f8a0f7bbfac..edcaec4a786 100644 --- a/gcc/config/riscv/riscv.md +++ b/gcc/config/riscv/riscv.md @@ -1776,8 +1776,7 @@ (zero_extend:DI (match_operand:SI 1 "nonimmediate_operand" " r,m")))] "TARGET_64BIT && !TARGET_ZBA && !TARGET_XTHEADBB && !TARGET_XTHEADMEMIDX - && !(register_operand (operands[1], SImode) - && reg_or_subregno (operands[1]) == VL_REGNUM)" + && !(REG_P (operands[1]) && VL_REG_P (REGNO (operands[1])))" "@ # lwu\t%0,%1" @@ -2214,8 +2213,7 @@ (match_operand:SI 1 "move_operand" " r,T,m,rJ,*r*J,*m,*f,*f,vp"))] "(register_operand (operands[0], SImode) || reg_or_0_operand (operands[1], SImode)) - && !(register_operand (operands[1], SImode) - && reg_or_subregno (operands[1]) == VL_REGNUM)" + && !(REG_P (operands[1]) && VL_REG_P (REGNO (operands[1])))" { return riscv_output_move (operands[0], operands[1]); } [(set_attr "move_type" "move,const,load,store,mtc,fpload,mfc,fpstore,rdvlenb") (set_attr "mode" "SI") diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/pr109092.c b/gcc/testsuite/gcc.target/riscv/rvv/base/pr109092.c new file mode 100644 index 00000000000..4a608da61f5 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/pr109092.c @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-options "-mabi=lp64d -march=rv64imafdc" } */ + +void foo(int i) {} -- 2.36.3