[dev.simd] cmd/compile: add peepholes for all masked ops and bug fixes

For 512-bits they are unchanged. This CL adds the optimization rules for
128/256-bits under feature check.

This CL also fixed a bug for masked load variant of instructions and
make them zeroing by default as well.

Change-Id: I6fe395541c0cd509984a81841420e71c3af732f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/717822
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Junyang Shao 2025-11-04 21:46:06 +00:00
parent 972732b245
commit 771a1dc216
7 changed files with 5489 additions and 68 deletions

View file

@ -57,3 +57,13 @@ func simdArrayWrapperNoSpill(a [1]Args2) simd.Uint8x32 {
a[0].x = "test"
return simdArrayNoSpill(a)
}
func simdFeatureGuardedMaskOpt() simd.Int16x16 {
var x, y simd.Int16x16
if simd.HasAVX512() {
mask := simd.Mask16x16FromBits(5)
return x.Add(y).Masked(mask) // amd64:`VPADDW.Z\s.*$`
}
mask := simd.Mask16x16FromBits(5)
return x.Add(y).Masked(mask) // amd64:`VPAND\s.*$`
}