RISC-V: Use biggest_mode as mode for constants.
commitcc217a1ecb04c9234b2cce7ba3c27701a050e402
authorRobin Dapp <rdapp@ventanamicro.com>
Tue, 15 Oct 2024 10:10:48 +0000 (15 12:10 +0200)
committerRobin Dapp <rdapp@ventanamicro.com>
Wed, 16 Oct 2024 08:45:33 +0000 (16 10:45 +0200)
tree6f0b3f95b01a61c4fdde319e2df5f8fc81daf2ec
parentf9bac238840155e1539aa68daf1507ea63c9ed80
RISC-V: Use biggest_mode as mode for constants.

In compute_nregs_for_mode we expect that the current variable's mode is
at most as large as the biggest mode to be used for vectorization.

This might not be true for constants as they don't actually have a mode.
In that case, just use the biggest mode so max_number_of_live_regs
returns 1.

This fixes several test cases in the test suite.

gcc/ChangeLog:

PR target/116655

* config/riscv/riscv-vector-costs.cc (max_number_of_live_regs):
Use biggest mode instead of constant's saved mode.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/pr116655.c: New test.
gcc/config/riscv/riscv-vector-costs.cc
gcc/testsuite/gcc.target/riscv/rvv/autovec/pr116655.c [new file with mode: 0644]