aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/raw-string-7.c
diff options
context:
space:
mode:
authorJeff Law <jlaw@ventanamicro.com>2025-03-17 17:29:42 -0600
committerJeff Law <jlaw@ventanamicro.com>2025-03-17 17:30:30 -0600
commitd9a8ec7fe0cbc04e28e650f079952bf529ae612e (patch)
treeadc161c4510a886e9723cc53c43e94178e9f1bd1 /gcc/testsuite/c-c++-common/raw-string-7.c
parent456f5ef81f0c6de630a60c26341082fffd48f241 (diff)
downloadgcc-d9a8ec7fe0cbc04e28e650f079952bf529ae612e.zip
gcc-d9a8ec7fe0cbc04e28e650f079952bf529ae612e.tar.gz
gcc-d9a8ec7fe0cbc04e28e650f079952bf529ae612e.tar.bz2
[RISC-V] Fix unreported code quality regression with single bit manipulations
I was reviewing some code recently and spotted an oddity. In a few places we were emitting andi dst,src,-1 and in others [x]ori dst,src,0. Those are obviously nops and we should get rid of them. Most of these are coming from a split part of a couple define_insn_and_split patterns added back in late 2022, so this is an unreported 13, 14 & 15 code quality regression (verified on godbolt, https://godbolt.org/z/EPszox5Kd). Essentially the split part is matching over-aggressively and splitting what should be a trivial bitmanip insn such as bset, bclr or binv into a nop logical with a bit twiddle. Since the split portions trigger post-reload nothing comes along to remove the nop logical operations. The fix is trivial. Just refine the condition. I considered refining the operand predicates too. Both are valid approaches. I noticed the formatting was goofy, so fixed that while I was in there. I'm aware of one other similar case, but I haven't concluded if it's a regression or not. Tested in my tester. Waiting for pre-commit CI to do its thing. Jeff gcc/ * config/riscv/bitmanip.md (*<or_optab>i<mode>_extrabit): Reject cases where we only need to twiddle one bit. Fix formatting. (*andi<mode>extrabit): Likewise. gcc/testsuite/ * gcc.target/riscv/redundant-andi.c: New test. * gcc.target/riscv/redundant-ori.c: Likewise
Diffstat (limited to 'gcc/testsuite/c-c++-common/raw-string-7.c')
0 files changed, 0 insertions, 0 deletions