https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91635
--- Comment #26 from Kito Cheng <kito at gcc dot gnu.org> --- Author: kito Date: Thu Sep 19 06:38:23 2019 New Revision: 275929 URL: https://gcc.gnu.org/viewcvs?rev=275929&root=gcc&view=rev Log: 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. Added: branches/gcc-9-branch/gcc/testsuite/gcc.c-torture/execute/pr91635.c branches/gcc-9-branch/gcc/testsuite/gcc.target/riscv/shift-shift-4.c branches/gcc-9-branch/gcc/testsuite/gcc.target/riscv/shift-shift-5.c Modified: branches/gcc-9-branch/gcc/ChangeLog branches/gcc-9-branch/gcc/config/riscv/riscv.md branches/gcc-9-branch/gcc/testsuite/ChangeLog