With a compiler that defaults to cmodel medany, pr113206-2.c ends up
generating an extra vsetvli insn.

Set the code model explicitly to medlow to meet the expectation.

This is unfortunately not enough to get the test to a pass on trunk.
It is on gcc-15 and the change is an improvement, but trunk still gets
an unexpected vsetvli even with the change.

Regstrapped on x86_64-linux-gnu along with other patches in this batch;
also tested with targets riscv64-elf and riscv32-elf on the same host,
both trunk and gcc-15.  Ok to install?


for  gcc/testsuite/ChangeLog

        * gcc.target/riscv/rvv/autovec/pr113206-2.c: Set the expected
        code model explicitly.
---
 .../gcc.target/riscv/rvv/autovec/pr113206-2.c      |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr113206-2.c 
b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr113206-2.c
index a3c61b467dab4..98b51d7a34bbf 100644
--- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr113206-2.c
+++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/pr113206-2.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-march=rv64gcv -mabi=lp64d -O3 -frename-registers 
-mrvv-max-lmul=m8" } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d -mcmodel=medlow -O3 
-frename-registers -mrvv-max-lmul=m8" } */
 
 signed char e;
 short f = 8;

-- 
Alexandre Oliva, happy hacker            https://blog.lx.oliva.nom.br/
Free Software Activist     FSFLA co-founder     GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity.
Excluding neuro-others for not behaving ""normal"" is *not* inclusive!

Reply via email to