]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: Do not use vsetivli for THeadVector.
authorRobin Dapp <rdapp@ventanamicro.com>
Tue, 8 Jul 2025 09:35:12 +0000 (11:35 +0200)
committerRobin Dapp <rdapp@ventanamicro.com>
Tue, 8 Jul 2025 13:42:27 +0000 (15:42 +0200)
In emit_vlmax_insn_lra we use a vsetivli for an immediate AVL.
XTHeadVector does not support this, so guard appropriately.

PR target/120461

gcc/ChangeLog:

* config/riscv/riscv-v.cc (emit_vlmax_insn_lra): Do not emit
vsetivli for XTHeadVector.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/xtheadvector/pr120461.c: New test.

gcc/config/riscv/riscv-v.cc
gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr120461.c [new file with mode: 0644]

index a5ab8dd4e2fe2d2a90ccededb89f5b511275f8b2..22d194909cfafa9a89f35ff7071f24981e9f8bae 100644 (file)
@@ -408,7 +408,7 @@ emit_vlmax_insn_lra (unsigned icode, unsigned insn_flags, rtx *ops, rtx vl)
   gcc_assert (!can_create_pseudo_p ());
   machine_mode mode = GET_MODE (ops[0]);
 
-  if (imm_avl_p (mode))
+  if (imm_avl_p (mode) && !TARGET_XTHEADVECTOR)
     {
       /* Even though VL is a real hardreg already allocated since
         it is post-RA now, we still gain benefits that we emit
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr120461.c b/gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr120461.c
new file mode 100644 (file)
index 0000000..6939157
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-mcpu=xt-c920 -mrvv-vector-bits=zvl -fzero-call-used-regs=all" */
+
+void
+foo ()
+{}