[Patch] x86: The simplest fix! (for MovAndTest2Test)
Original Reporter info from Mantis: CuriousKit @CuriousKit
-
Reporter name: J. Gareth Moreton
Original Reporter info from Mantis: CuriousKit @CuriousKit
- Reporter name: J. Gareth Moreton
Description:
This patch changes one of the criteria for the MovAndTest2Test optimisation, namely that there's no restriction on the size of the conditional instruction that follows. Initially it was [S_NO], but now it's [], thus allowing SETcc instructions to follow as well as Jcc. This was a bug because SETcc is perfectly allowed, but its size is S_B, not S_NO.
Steps to reproduce:
Apply patch and confirm correct compilation and code improvement.
Additional information:
Example from system.s (under -O4):
Before:
...
.Lj1905:
movb %dl,%al
xorb $5,%al
orb %cl,%al
seteb %al
movq %rsi,%rcx
andq $1,%rcx ; <-- A "test %rcx,%rcx" instruction appeared after this that is silently removed by the post-peephole stage.
seteb %cl
...
After:
...
.Lj1905:
movb %dl,%al
xorb $5,%al
orb %cl,%al
seteb %al
# Peephole Optimization: MovAndTest2Test done
testq $1,%rsi
seteb %cl
...
Mantis conversion info:
- Mantis ID: 39156
- OS: Microsoft Windows
- OS Build: 10 Home
- Build: r49578
- Platform: i386 and x86_64
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 49580 (#ea47cb31)