public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] RISC-V: Fix VSETVL PASS AVL/VL fetch bug[111295]
@ 2023-09-11 13:37 Jeff Law
0 siblings, 0 replies; only message in thread
From: Jeff Law @ 2023-09-11 13:37 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:caa739709fb48f140fe6cab1c178ef956dbc7cc3
commit caa739709fb48f140fe6cab1c178ef956dbc7cc3
Author: Juzhe-Zhong <juzhe.zhong@rivai.ai>
Date: Wed Sep 6 20:47:24 2023 +0800
RISC-V: Fix VSETVL PASS AVL/VL fetch bug[111295]
Fix bugzilla: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111295
gcc/ChangeLog:
PR target/111295
* config/riscv/riscv-vsetvl.cc (insert_vsetvl): Bug fix.
gcc/testsuite/ChangeLog:
PR target/111295
* gcc.target/riscv/rvv/autovec/pr111295.c: New test.
(cherry picked from commit 1b4c70d4271a00514ae20970d483c3b78d9d66ef)
Diff:
---
gcc/config/riscv/riscv-vsetvl.cc | 3 +-
.../gcc.target/riscv/rvv/autovec/pr111295.c | 36 ++++++++++++++++++++++
2 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index e7e5c14617ee..dd9aeb32b563 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -721,8 +721,7 @@ insert_vsetvl (enum emit_type emit_type, rtx_insn *rinsn,
gcc_assert (has_vtype_op (rinsn) || vsetvl_insn_p (rinsn));
/* 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 ();
+ rtx vl_op = info.get_avl_or_vl_reg ();
gcc_assert (!vlmax_avl_p (vl_op));
emit_vsetvl_insn (VSETVL_NORMAL, emit_type, info, vl_op, rinsn);
return VSETVL_NORMAL;
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr111295.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr111295.c
new file mode 100644
index 000000000000..fa20a21338a3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr111295.c
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d -Ofast -ftree-vectorize --param=riscv-autovec-preference=scalable -Wno-implicit-function-declaration" } */
+
+#include <stdbool.h>
+int a, b, c, e, f, g, h, i, j, k;
+long l;
+int q ()
+{
+ int r ();
+ char *o, *d;
+ _Bool p = f;
+ while (g)
+ {
+ int m, n;
+ for (; m <= n; m++)
+ *d++ = m;
+ k = 1;
+ if (e)
+ break;
+ switch (*o)
+ {
+ case 'N':
+ o++;
+ if (c)
+ if (h)
+ while (i)
+ {
+ s (-l, ~0);
+ t (j);
+ d = d + (a & 10000000 ? u (r, 2) : b);
+ }
+ }
+ if (*o)
+ p ? s () : 0;
+ }
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-09-11 13:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-11 13:37 [gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] RISC-V: Fix VSETVL PASS AVL/VL fetch bug[111295] Jeff Law
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).