]> Cypherpunks repositories - gostls13.git/commit
simd/archsimd: 128- and 256-bit FMA operations do not require AVX-512
authorAustin Clements <austin@google.com>
Tue, 13 Jan 2026 19:18:14 +0000 (14:18 -0500)
committerCherry Mui <cherryyz@google.com>
Tue, 13 Jan 2026 20:33:31 +0000 (12:33 -0800)
commite2429619605951b137e25f6a51fbc39d9f0f1e9b
tree184119a0fc7c53b16284693f190645b0ef77ae98
parent9ef1692c93bf96328bcaf7a5c8a46094748da7f3
simd/archsimd: 128- and 256-bit FMA operations do not require AVX-512

Currently, all FMA operations are marked as requiring AVX512, even on
smaller vector widths. This is happening because the narrower FMA
operations are marked as extension "FMA" in the XED. Since this
extension doesn't start with "AVX", we filter them out very early in
the XED process. However, this is just a quirk of naming: the FMA
feature depends on the AVX feature, so it is part of AVX, even if it
doesn't say so on the tin.

Fix this by accepting the FMA extension and adding FMA to the table of
CPU features. We also tweak internal/cpu slightly do it correctly
enforces that the logical FMA feature depends on both the FMA and AVX
CPUID flags.

This actually *deletes* a lot of generated code because we no longer
need the AVX-512 encoding of these 128- and 256-bit operations.

Change-Id: I744a18d0be888f536ac034fe88b110347622be7e
Reviewed-on: https://go-review.googlesource.com/c/go/+/736160
Auto-Submit: Austin Clements <austin@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/736201
Reviewed-by: Austin Clements <austin@google.com>
src/cmd/compile/internal/amd64/simdssa.go
src/cmd/compile/internal/ssa/_gen/simdAMD64.rules
src/cmd/compile/internal/ssa/_gen/simdAMD64ops.go
src/cmd/compile/internal/ssa/opGen.go
src/cmd/compile/internal/ssa/rewriteAMD64.go
src/internal/cpu/cpu_x86.go
src/simd/archsimd/_gen/simdgen/xed.go
src/simd/archsimd/cpu.go
src/simd/archsimd/ops_amd64.go