RISC-V: Fix bad insn splits with paradoxical subregs.
authorJakub Jelinek <jakub@redhat.com>
Thu, 5 Sep 2019 20:32:55 +0000 (22:32 +0200)
committerJim Wilson <wilson@gcc.gnu.org>
Thu, 5 Sep 2019 20:32:55 +0000 (13:32 -0700)
commit36ec3f57d305e343ad1bbffa53e3484661a176a6
tree2865b2618fabe876bb58c8f86dd2c67192a09778
parent3c0f026505aca54c200b36870256c886b05eb4ff
RISC-V: Fix bad insn splits with paradoxical subregs.

Shifting by more than the size of a SUBREG_REG doesn't work, so we either
need to disable splits if an input is paradoxical, or else we need to
generate a clean temporary for intermediate results.

Jakub wrote the first version of this patch, so gets primary credit for it.

gcc/
PR target/91635
* config/riscv/riscv.md (zero_extendsidi2, zero_extendhi<GPR:mode>2,
extend<SHORT:mode><SUPERQI:mode>2): Don't split if
paradoxical_subreg_p (operands[0]).
(*lshrsi3_zero_extend_3+1, *lshrsi3_zero_extend_3+2): Add clobber and
use as intermediate value.

gcc/testsuite/
PR target/91635
* gcc.c-torture/execute/pr91635.c: New test.
* gcc.target/riscv/shift-shift-4.c: New test.
* gcc.target/riscv/shift-shift-5.c: New test.

Co-Authored-By: Jim Wilson <jimw@sifive.com>
From-SVN: r275444
gcc/ChangeLog
gcc/config/riscv/riscv.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/pr91635.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/shift-shift-4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/shift-shift-5.c [new file with mode: 0644]