]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: Allow more loading of const vectors.
authorRobin Dapp <rdapp@ventanamicro.com>
Fri, 12 May 2023 08:26:51 +0000 (10:26 +0200)
committerRobin Dapp <rdapp@ventanamicro.com>
Fri, 19 May 2023 11:39:16 +0000 (13:39 +0200)
This patch fixes the recent vmv patch in order to allow loading
of constants via vmv.vi with the "fixed-vlmax" vectorization flavor.

gcc/ChangeLog:

* config/riscv/riscv.cc (riscv_const_insns): Remove else.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv32.c: New test.
* gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv64.c: New test.

gcc/config/riscv/riscv.cc
gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv32.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv64.c [new file with mode: 0644]

index 235be758c03cb44a09a1cf27945058b25c745722..8320069f92f8f42560c7e7a692690e20d4490e75 100644 (file)
@@ -1295,7 +1295,7 @@ riscv_const_insns (rtx x)
           The Wc0, Wc1 constraints are already covered by the
           vi constraint so we do not need to check them here
           separately.  */
-       else if (TARGET_VECTOR && satisfies_constraint_vi (x))
+       if (TARGET_VECTOR && satisfies_constraint_vi (x))
          return 1;
 
        /* TODO: We may support more const vector in the future.  */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv32.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv32.c
new file mode 100644 (file)
index 0000000..631ea3b
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-std=c99 -march=rv32gcv -mabi=ilp32d -fno-vect-cost-model --param=riscv-autovec-preference=fixed-vlmax -fno-builtin" } */
+
+#include "vmv-imm-template.h"
+
+/* { dg-final { scan-assembler-times "vmv.v.i" 32 } } */
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv64.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/vmv-imm-fixed-rv64.c
new file mode 100644 (file)
index 0000000..7ded6cc
--- /dev/null
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-std=c99 -march=rv64gcv -mabi=lp64d -fno-vect-cost-model --param=riscv-autovec-preference=fixed-vlmax -fno-builtin" } */
+
+#include "vmv-imm-template.h"
+
+/* { dg-final { scan-assembler-times "vmv.v.i" 32 } } */