Message ID | 20231108113306.1820431-1-juzhe.zhong@rivai.ai |
---|---|
State | New |
Headers | show |
Series | [Committed] RISC-V: Fix VSETVL VL check condition bug | expand |
diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 77dbf159d41..3fa25a6404d 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -1067,7 +1067,7 @@ public: break; } rtx avl = ::get_avl (rinsn); - if (!avl || REGNO (get_vl ()) != REGNO (avl)) + if (!avl || !REG_P (avl) || REGNO (get_vl ()) != REGNO (avl)) { m_vl_used_by_non_rvv_insn = true; break; diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/vl-use-ice.c b/gcc/testsuite/gcc.target/riscv/rvv/base/vl-use-ice.c new file mode 100644 index 00000000000..715c7e0cad2 --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/vl-use-ice.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=rv64gcv -mabi=lp64d" } */ + +#include "riscv_vector.h" + +void foo(void *in1, void *out, size_t avl) { + + size_t vl = __riscv_vsetvl_e32m1(avl); + vint32m1_t v = __riscv_vmv_v_x_i32m1 (vl, 16); + __riscv_vse32_v_i32m1 (out, v, 16); +}