]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: Add test for PR112469
authorJuzhe-Zhong <juzhe.zhong@rivai.ai>
Fri, 10 Nov 2023 23:27:54 +0000 (07:27 +0800)
committerPan Li <pan2.li@intel.com>
Sat, 11 Nov 2023 01:02:31 +0000 (09:02 +0800)
As PR: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112469

which has been fixed by Richard patch:
https://gcc.gnu.org/pipermail/gcc-patches/2023-November/635994.html

Add tests to avoid regression. Committed.

PR target/112469

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/pr112469.c: New test.

gcc/testsuite/gcc.target/riscv/rvv/autovec/pr112469.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr112469.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr112469.c
new file mode 100644 (file)
index 0000000..e647028
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d -O3" } */
+
+int a, b, c;
+static int *d = &a;
+int e(int f) { return f == 0 ?: f; }
+int g() {
+  a = 1;
+  for (; a <= 8; a++) {
+    b = e(*d);
+    c = -b;
+  }
+}