[Bug target/105034] [10/11/12 regression]Suboptimal codegen for min/max with -Os
wwwhhhyyy333 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Mar 28 02:49:26 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105034
--- Comment #2 from Hongyu Wang <wwwhhhyyy333 at gmail dot com> ---
For -O2 stv doesn't do such transform
Computing gain for chain #1...
Instruction gain 8 for 7: {r84:SI=smax(r85:SI,0);clobber flags:CC;}
REG_DEAD r85:SI
REG_UNUSED flags:CC
Instruction conversion gain: 8
Registers conversion cost: 12
Total gain: -4
Since sse->integer reg move cost is 6 for generic cost.
Buf for -Os the cost is 3 so it is consider to be profitable.
Computing gain for chain #1...
Instruction gain 8 for 7: {r84:SI=smax(r85:SI,0);clobber flags:CC;}
REG_DEAD r85:SI
REG_UNUSED flags:CC
Instruction conversion gain: 8
Registers conversion cost: 6
Total gain: 2
FWIW, the solution would be either adjust the ix86_size cost, or blocks out
optimize_size in the stv gate.
More information about the Gcc-bugs
mailing list