aboutsummaryrefslogtreecommitdiff
path: root/gcc/c/c-parser.c
diff options
context:
space:
mode:
authorRoger Sayle <roger@nextmovesoftware.com>2021-12-13 18:48:22 +0000
committerRoger Sayle <roger@nextmovesoftware.com>2021-12-13 18:51:00 +0000
commit149739c39475f3691e67aa0aee4f205f4e83392f (patch)
treeafea33c9c0f340e9220ed3c834c2c44393c81144 /gcc/c/c-parser.c
parentfc4a93eb41243babe3f2ef3a3c6171b48e503138 (diff)
downloadgcc-149739c39475f3691e67aa0aee4f205f4e83392f.zip
gcc-149739c39475f3691e67aa0aee4f205f4e83392f.tar.gz
gcc-149739c39475f3691e67aa0aee4f205f4e83392f.tar.bz2
x86: Avoid generating orb $0, %ah
I'll post my proposed fix for PR target/103611 shortly, but this patch fixes another missed optimization opportunity revealed by that PR. Occasionally, reload materializes integer constants during register allocation sometimes resulting in unnecessary instructions such as: (insn 23 31 24 2 (parallel [ (set (reg:SI 0 ax [99]) (ior:SI (reg:SI 0 ax [99]) (const_int 0 [0]))) (clobber (reg:CC 17 flags)) ]) "pr103611.c":18:73 550 {*iorsi_1} (nil)) These then get "optimized" during the split2 pass, which realizes that no bits outside of 0xff00 are set, so this operation can be implemented by operating on just the highpart of a QIreg_operand, i.e. %ah, %bh, %ch etc., which leads to the useless "orb $0, %ah" seen in the reported PR. This fix catches the case of const0_rtx in relevant splitter, either eliminating the instruction or turning it into a simple move. 2021-12-13 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog * config/i386/i386.md (define_split any_or:SWI248 -> orb %?h): Optimize the case where the integer constant operand is zero. gcc/testsuite/ChangeLog * gcc.target/i386/pr103611-1.c: New test case.
Diffstat (limited to 'gcc/c/c-parser.c')
0 files changed, 0 insertions, 0 deletions