[RISC-V][PR target/118146] Fix ICE for unsupported modesmastertrunk
commit9576353454e6c2a20a9742e2f29f17830766cd8a
authorJeff Law <jlaw@ventanamicro.com>
Sun, 9 Feb 2025 05:07:16 +0000 (8 22:07 -0700)
committerJeff Law <jlaw@ventanamicro.com>
Sun, 9 Feb 2025 05:09:18 +0000 (8 22:09 -0700)
tree1558130baf8e32177ff529a05d2ac9db83f430c6
parent58856a6ec58b17025cf98c1a61b696d25bd02e40
[RISC-V][PR target/118146] Fix ICE for unsupported modes

There's some special case code in the risc-v move expander to try and optimize
cases where the source is a subreg of a vector and the destination is a scalar
mode.

The code works fine except when we have no support for the given mode. ie HF or
BF when those extensions aren't enabled.  We'll end up tripping an assert in
that case when we should have just let standard expansion do its thing.

Tested in my system for rv32 and rv64, but I'll wait for the pre-commit tester
to render a verdict before moving forward.

PR target/118146
gcc/
* config/riscv/riscv.cc (riscv_legitimize_move): Handle subreg
of vector source better to avoid ICE.

gcc/testsuite
* gcc.target/riscv/pr118146-1.c: New test.
* gcc.target/riscv/pr118146-2.c: New test.
gcc/config/riscv/riscv.cc
gcc/testsuite/gcc.target/riscv/pr118146-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/pr118146-2.c [new file with mode: 0644]