]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: Fix bug of tuple move splitter
authorJuzhe-Zhong <juzhe.zhong@rivai.ai>
Sun, 19 Nov 2023 01:45:33 +0000 (09:45 +0800)
committerPan Li <pan2.li@intel.com>
Sun, 19 Nov 2023 02:44:20 +0000 (10:44 +0800)
PR target/112561

gcc/ChangeLog:

* config/riscv/riscv-v.cc (expand_tuple_move): Fix bug.

gcc/testsuite/ChangeLog:

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

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

index c718b5046181b7fd55057a0be74f321e4c508458..291f3c75282e6804221aba4e74349d851778a8cc 100644 (file)
@@ -2033,6 +2033,10 @@ expand_tuple_move (rtx *ops)
          offset = ops[2];
        }
 
+      /* Non-fractional LMUL has whole register moves that don't require a
+        vsetvl for VLMAX.  */
+      if (fractional_p)
+       emit_vlmax_vsetvl (subpart_mode, ops[4]);
       if (MEM_P (ops[1]))
        {
          /* Load operations.  */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr112561.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr112561.c
new file mode 100644 (file)
index 0000000..25e61fa
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do run { target { riscv_v } } } */
+/* { dg-options "-O3 -ftree-vectorize --param=riscv-autovec-preference=fixed-vlmax -mcmodel=medlow" } */
+
+int printf(char *, ...);
+int a, b, c, e;
+short d[7][7] = {};
+int main() {
+  short f;
+  c = 0;
+  for (; c <= 6; c++) {
+    e |= d[c][c] & 1;
+    b &= f & 3;
+  }
+  printf("%d\n", a);
+  return 0;
+}