cmd/compile: optimize comparisons to min/max (u)ints by checking for overflow #41664
Labels
FrozenDueToAge
help wanted
NeedsFix
The path to resolution is known, but the work has not been done.
Performance
Milestone
On amd64, the core of this compiles to:
It would be cheaper and smaller instead to decrement CX and check the flags for underflow. A similar trick can be used for checking min and max ints and uints of all sizes. It might also be useful in the division fix-up code, where we must check for min int divisor.
cc @randall77 @dr2chase @martisch @mundaym
The text was updated successfully, but these errors were encountered: