https://gcc.gnu.org/g:be2755d55421ace63363402901b4e0e2f07f798c
commit r17-5070-gbe2755d55421ace63363402901b4e0e2f07f798c Author: Jeff Law <[email protected]> Date: Sun Oct 11 14:11:28 2026 -0600 [committed][RISC-V] Fix one more test fallout from AOP work on RISC-V One more adjustment related to AOP. I overlooked this testcase this when testing patches individually earlier today. We have a splitter that's supposed to recognize cases where we have (x << C1) + C2 that can be profitably rewritten into (x + C2') << C1. After the AOP changes that splitter is firing in a case where we don't want it. In particular when Zbkb is enabled and the shift count is half the word size. That scenario is tailor made for the pack family in Zbkb. This patch adjusts the condition for the splitter so that it doesn't apply in that case. This was part of the kit that tested overnight. SO it's been through bootstrap and regression test as well as testing on riscv64-elf and riscv32-elf. gcc/ * config/riscv/riscv.md ((x << C1) + C2 splitter): Do not trigger for Zbkb when C1 is half the word size. Diff: --- gcc/config/riscv/riscv.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/config/riscv/riscv.md b/gcc/config/riscv/riscv.md index 51e16c5e9810..cb67e22d20a6 100644 --- a/gcc/config/riscv/riscv.md +++ b/gcc/config/riscv/riscv.md @@ -5136,6 +5136,10 @@ (match_operand 3 "const_int_operand" "n"))) (clobber (match_scratch:DI 4 "=&r"))] "(TARGET_64BIT + /* If this might reasonably be a pack, then reject. */ + && !(TARGET_ZBKB + && INTVAL (operands[2]) == BITS_PER_WORD / 2 + && (INTVAL (operands[3]) & ~HOST_WIDE_INT_C (0xffffffff)) == 0) && riscv_const_insns (operands[3], false) == 1 && riscv_const_insns (GEN_INT (INTVAL (operands[3]) << INTVAL (operands[2])), false) != 1)"
