diff options
-rw-r--r-- | gcc/config/riscv/riscv-selftests.cc | 14 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/riscv/rvv/base/poly-selftest-1.c | 12 |
2 files changed, 25 insertions, 1 deletions
diff --git a/gcc/config/riscv/riscv-selftests.cc b/gcc/config/riscv/riscv-selftests.cc index 0ac17fb..289916b 100644 --- a/gcc/config/riscv/riscv-selftests.cc +++ b/gcc/config/riscv/riscv-selftests.cc @@ -368,7 +368,19 @@ namespace selftest { void riscv_run_selftests (void) { - run_poly_int_selftests (); + if (!BYTES_PER_RISCV_VECTOR.is_constant ()) + /* We can know POLY value = [4, 4] when BYTES_PER_RISCV_VECTOR + is !is_constant () since we can use csrr vlenb and scalar shift + instruction to compute such POLY value and store it into a scalar + register. Wheras, we can't know [4, 4] on it is specified as + FIXED-VLMAX since BYTES_PER_RISCV_VECTOR = 16 for -march=rv64gcv + and csrr vlenb is 16 which is totally unrelated to any + compile-time unknown POLY value. + + Since we never need to compute a compile-time unknown POLY value + when --param=riscv-autovec-preference=fixed-vlmax, disable poly + selftests in such situation. */ + run_poly_int_selftests (); run_const_vector_selftests (); run_broadcast_selftests (); } diff --git a/gcc/testsuite/gcc.target/riscv/rvv/base/poly-selftest-1.c b/gcc/testsuite/gcc.target/riscv/rvv/base/poly-selftest-1.c new file mode 100644 index 0000000..0f128ac --- /dev/null +++ b/gcc/testsuite/gcc.target/riscv/rvv/base/poly-selftest-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-march=rv64gcv -mabi=lp64d -O0 -fself-test=$srcdir/selftests --param=riscv-autovec-preference=fixed-vlmax -S" } */ + +/* Verify that -fself-test does not fail on a non empty source. */ + +int i; void bar(); void foo() +{ + while (i--) + bar(); +} + +/* { dg-regexp {^-fself-test: [0-9]+ pass\(es\) in [.0-9]+ seconds$|.*: note: self-tests are not enabled in this build$} } */ |