Skip to content

cmd/compile: compiler doesn't optmize fused multiply-subtract when using GOAMD64=v3 #80278

Description

@harrison3000

Go version

go1.26.0

Output of go env in your module/workspace:

-

What did you do?

Minimal reproduction available here: https://godbolt.org/z/r9PfEeW5d

What did you see happen?

a * b + c gets optimized to a single VFMADD231SS instruction, nice
However a a * b - c compiles to a MULSS followed by a SUBSS even though there is a complementary instruction VFMSUB231SS

What did you expect to see?

The expression a * b - c compiling to a single VFMSUB231SS (or a VFMSUB213SD when using float64)

Metadata

Metadata

Assignees

Labels

NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Performancecompiler/runtimeIssues related to the Go compiler and/or runtime.help wanted

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions