cmd/compile: emit (MAX|MIN)SD instead of UCOMISD when possible #31272
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Performance
Milestone
What version of Go are you using (
go version
)?Consider this:
This gets compiled to
Whereas, it could have been written as
Benchmarks show a 12.6% improvement, when the assembly call overhead is ignored.
I am wondering if it is possible to detect patterns like these and insert a (MAX/MIN)SD instead of a UCOMISD and a Jump ? Might also be possible to use a FCMOV, but that is also not implemented yet.
Is this possible with a simple rewrite rule or does it require deeper compiler knowledge to achieve this ? Happy to work on it if it is the former :)
FYI, the SSA during the lower pass is
@josharian @randall77 @martisch
The text was updated successfully, but these errors were encountered: