]> git.ipfire.org Git - thirdparty/gcc.git/commit
[committed][RISC-V][PR target/120333] Remove bogus bext pattern
authorJeff Law <jlaw@ventanamicro.com>
Mon, 19 May 2025 22:55:15 +0000 (16:55 -0600)
committerJeff Law <jlaw@ventanamicro.com>
Mon, 19 May 2025 22:57:18 +0000 (16:57 -0600)
commit38fa6c0455ec14f2f42310a817b90765ad894aa4
tree67486ae544b4a38f87418e8bd7024f3d4f274ea4
parent23a8659a3e3a1877f70d196ae498a76d0fd2783c
[committed][RISC-V][PR target/120333] Remove bogus bext pattern

I goof'd when doing analysis of missed bext cases.  For the shift into the sign
bit, then shift into the low bit case (thankfully the least common), I got it
in my brain that the field is at the left shift count.   It's actually at
word_size - 1 - left shift count.

One the subtraction is included, it's no longer profitable to turn those cases
into bext.  Best case scenario would be sub+bext, but we can just as easily use
sll+srl which fuses in some designs into a single op.

So this patch removes those two patterns, adjusts the existing testcase and
adds the new execution test.

Given it's a partial reversion and has passed in my tester, I'm going to go
ahead and push it to the trunk rather than waiting for upstream CI.

PR target/120333
gcc/
* config/riscv/bitmanip.md: Remove bext formed from left+right
shift patterns.

gcc/testsuite/

* gcc.target/riscv/pr114512.c: Update expected output.
* gcc.target/riscv/pr120333.c: New test.
gcc/config/riscv/bitmanip.md
gcc/testsuite/gcc.target/riscv/pr114512.c
gcc/testsuite/gcc.target/riscv/pr120333.c [new file with mode: 0644]