aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuzhe-Zhong <juzhe.zhong@rivai.ai>2023-06-16 16:02:31 +0800
committerPan Li <pan2.li@intel.com>2023-06-17 07:29:37 +0800
commitdd6e1cbac8682106c5167c105f2807014288b852 (patch)
tree4e03cc97548b38c0905fcd948897e0eea769e477
parentbc6bd0d608da1609c1caeb04ab795a83720add55 (diff)
downloadgcc-dd6e1cbac8682106c5167c105f2807014288b852.zip
gcc-dd6e1cbac8682106c5167c105f2807014288b852.tar.gz
gcc-dd6e1cbac8682106c5167c105f2807014288b852.tar.bz2
RISC-V: Fix VL operand bug in VSETVL PASS[PR110264]
This patch fixes this issue happens on both GCC-13 and GCC-14. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110264 The testcase is too big and I failed to reduce it so I didn't append test into this patch. This patch should not only land into GCC-14 but also should backport to GCC-13. PR target/110264 gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (insert_vsetvl): Fix bug.
-rw-r--r--gcc/config/riscv/riscv-vsetvl.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index 7066dea..971c3f9 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -744,7 +744,10 @@ insert_vsetvl (enum emit_type emit_type, rtx_insn *rinsn,
if (vlmax_avl_p (info.get_avl ()))
{
gcc_assert (has_vtype_op (rinsn) || vsetvl_insn_p (rinsn));
- rtx vl_op = info.get_avl_reg_rtx ();
+ /* For user vsetvli a5, zero, we should use get_vl to get the VL
+ operand "a5". */
+ rtx vl_op
+ = vsetvl_insn_p (rinsn) ? get_vl (rinsn) : info.get_avl_reg_rtx ();
gcc_assert (!vlmax_avl_p (vl_op));
emit_vsetvl_insn (VSETVL_NORMAL, emit_type, info, vl_op, rinsn);
return VSETVL_NORMAL;