aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuzhe-Zhong <juzhe.zhong@rivai.ai>2023-09-08 15:52:03 +0800
committerPan Li <pan2.li@intel.com>2023-09-08 16:17:52 +0800
commitf9cb357ae962ba2922b8507f4d96227780a063b9 (patch)
treec7dfe577c9452d5a3db892c6de80dda322da05d9
parentdaaed758517c81fc8f8bc6502be648aca51ab278 (diff)
downloadgcc-f9cb357ae962ba2922b8507f4d96227780a063b9.zip
gcc-f9cb357ae962ba2922b8507f4d96227780a063b9.tar.gz
gcc-f9cb357ae962ba2922b8507f4d96227780a063b9.tar.bz2
RISC-V: Fix incorrect nregs calculation for VLS modes
This patch fixes obvious bug: TARGET_MIN_VLEN is bitsize. All these following bugs are fixed with this patch: FAIL: gcc.target/riscv/zero-scratch-regs-3.c -O0 (internal compiler error: in gen_reg_rtx, at emit-rtl.cc:1176) FAIL: gcc.target/riscv/zero-scratch-regs-3.c -O0 (test for excess errors) FAIL: gcc.target/riscv/zero-scratch-regs-3.c -O1 (internal compiler error: in gen_reg_rtx, at emit-rtl.cc:1176) FAIL: gcc.target/riscv/zero-scratch-regs-3.c -O1 (test for excess errors) FAIL: gcc.target/riscv/zero-scratch-regs-3.c -O2 (internal compiler error: in gen_reg_rtx, at emit-rtl.cc:1176) FAIL: gcc.target/riscv/zero-scratch-regs-3.c -O2 (test for excess errors) FAIL: gcc.target/riscv/zero-scratch-regs-3.c -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error: in gen_reg_rtx, at emit-rtl.cc:1176) FAIL: gcc.target/riscv/zero-scratch-regs-3.c -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: gcc.target/riscv/zero-scratch-regs-3.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error: in gen_reg_rtx, at emit-rtl.cc:1176) FAIL: gcc.target/riscv/zero-scratch-regs-3.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: gcc.target/riscv/zero-scratch-regs-3.c -O3 -g (internal compiler error: in gen_reg_rtx, at emit-rtl.cc:1176) FAIL: gcc.target/riscv/zero-scratch-regs-3.c -O3 -g (test for excess errors) FAIL: gcc.target/riscv/zero-scratch-regs-3.c -Os (internal compiler error: in gen_reg_rtx, at emit-rtl.cc:1176) FAIL: gcc.target/riscv/zero-scratch-regs-3.c -Os (test for excess errors) FAIL: gcc.target/riscv/rvv/base/mov-13.c (internal compiler error: in partial_subreg_p, at rtl.h:3186) FAIL: gcc.target/riscv/rvv/base/mov-13.c (test for excess errors) FAIL: gcc.target/riscv/rvv/base/spill-1.c (internal compiler error: in partial_subreg_p, at rtl.h:3186) FAIL: gcc.target/riscv/rvv/base/spill-1.c (test for excess errors) FAIL: gcc.target/riscv/rvv/base/spill-2.c (internal compiler error: in partial_subreg_p, at rtl.h:3186) FAIL: gcc.target/riscv/rvv/base/spill-2.c (test for excess errors) FAIL: gcc.target/riscv/rvv/base/spill-3.c (internal compiler error: in partial_subreg_p, at rtl.h:3186) FAIL: gcc.target/riscv/rvv/base/spill-3.c (test for excess errors) FAIL: gcc.target/riscv/rvv/base/spill-4.c (internal compiler error: in partial_subreg_p, at rtl.h:3186) FAIL: gcc.target/riscv/rvv/base/spill-4.c (test for excess errors) FAIL: gcc.target/riscv/rvv/base/spill-5.c (internal compiler error: in partial_subreg_p, at rtl.h:3186) FAIL: gcc.target/riscv/rvv/base/spill-5.c (test for excess errors) FAIL: gcc.target/riscv/rvv/base/spill-6.c (internal compiler error: in partial_subreg_p, at rtl.h:3186) FAIL: gcc.target/riscv/rvv/base/spill-6.c (test for excess errors) FAIL: gcc.target/riscv/rvv/base/spill-sp-adjust.c (internal compiler error: in partial_subreg_p, at rtl.h:3186) FAIL: gcc.target/riscv/rvv/base/spill-sp-adjust.c (test for excess errors) gcc/ChangeLog: * config/riscv/riscv.cc (riscv_hard_regno_nregs): Fix bug.
-rw-r--r--gcc/config/riscv/riscv.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index fb96493..7a0f9f6 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -7548,7 +7548,7 @@ riscv_hard_regno_nregs (unsigned int regno, machine_mode mode)
/* For VLS modes, we allocate registers according to TARGET_MIN_VLEN. */
if (riscv_v_ext_vls_mode_p (mode))
{
- int size = GET_MODE_SIZE (mode).to_constant ();
+ int size = GET_MODE_BITSIZE (mode).to_constant ();
if (size < TARGET_MIN_VLEN)
return 1;
else