]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: Add TAREGT_VECTOR check into VLS modes
authorJuzhe-Zhong <juzhe.zhong@rivai.ai>
Sat, 12 Aug 2023 02:30:02 +0000 (10:30 +0800)
committerPan Li <pan2.li@intel.com>
Sat, 12 Aug 2023 04:42:28 +0000 (12:42 +0800)
This patch fixes bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110994

This is caused VLS modes incorrect codes int register allocation.

The original case trigger the ICE is fortran code but I can reproduce
with a C code.

gcc/ChangeLog:

PR target/110994
* config/riscv/riscv-opts.h (TARGET_VECTOR_VLS): Add TARGET_VETOR.

gcc/testsuite/ChangeLog:

PR target/110994
* gcc.target/riscv/rvv/autovec/vls/pr110994.c: New test.

gcc/config/riscv/riscv-opts.h
gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/pr110994.c [new file with mode: 0644]

index d6d785d0075ea85d7cb1db1ab78381ce38fb933e..aeea805b3425e4a022c625975ccc9835876219ee 100644 (file)
@@ -300,6 +300,7 @@ enum riscv_entity
 
 /* We only enable VLS modes for VLA vectorization since fixed length VLMAX mode
    is the highest priority choice and should not conflict with VLS modes.  */
-#define TARGET_VECTOR_VLS (riscv_autovec_preference == RVV_SCALABLE)
+#define TARGET_VECTOR_VLS                                                      \
+  (TARGET_VECTOR && riscv_autovec_preference == RVV_SCALABLE)
 
 #endif /* ! GCC_RISCV_OPTS_H */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/pr110994.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vls/pr110994.c
new file mode 100644 (file)
index 0000000..fcacc78
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gc -mabi=lp64d --param=riscv-autovec-preference=scalable -O2" } */
+
+#include "def.h"
+
+void foo (int8_t *in, int8_t *out)
+{
+  v4qi v = *(v4qi*)in;
+  *(v4qi*)out = v;
+}