[dev.simd] simd: clean up mask load comments

Addressing a comment from CL 710915.

Change-Id: Id65f525130b5b626ea7017aebc93a4b3b0c93d84
Reviewed-on: https://go-review.googlesource.com/c/go/+/711780
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
Junyang Shao 2025-10-14 16:15:38 +00:00
parent 416332dba2
commit fc3bc49337
2 changed files with 4 additions and 18 deletions

View file

@ -182,13 +182,17 @@ func (x {{.Name}}) Store(y *[{{.Lanes}}]{{.Base}})
const simdMaskFromValTemplate = ` const simdMaskFromValTemplate = `
// {{.Name}}FromBits constructs a {{.Name}} from a bitmap value, where 1 means set for the indexed element, 0 means unset. // {{.Name}}FromBits constructs a {{.Name}} from a bitmap value, where 1 means set for the indexed element, 0 means unset.
{{- if ne .Lanes .LanesContainer}}
// Only the lower {{.Lanes}} bits of y are used. // Only the lower {{.Lanes}} bits of y are used.
{{- end}}
// //
// Asm: KMOV{{.IntelSizeSuffix}}, CPU Feature: AVX512 // Asm: KMOV{{.IntelSizeSuffix}}, CPU Feature: AVX512
func {{.Name}}FromBits(y uint{{.LanesContainer}}) {{.Name}} func {{.Name}}FromBits(y uint{{.LanesContainer}}) {{.Name}}
// ToBits constructs a bitmap from a {{.Name}}, where 1 means set for the indexed element, 0 means unset. // ToBits constructs a bitmap from a {{.Name}}, where 1 means set for the indexed element, 0 means unset.
{{- if ne .Lanes .LanesContainer}}
// Only the lower {{.Lanes}} bits of y are used. // Only the lower {{.Lanes}} bits of y are used.
{{- end}}
// //
// Asm: KMOV{{.IntelSizeSuffix}}, CPU Features: AVX512 // Asm: KMOV{{.IntelSizeSuffix}}, CPU Features: AVX512
func (x {{.Name}}) ToBits() uint{{.LanesContainer}} func (x {{.Name}}) ToBits() uint{{.LanesContainer}}

View file

@ -302,13 +302,11 @@ type Mask8x16 struct {
} }
// Mask8x16FromBits constructs a Mask8x16 from a bitmap value, where 1 means set for the indexed element, 0 means unset. // Mask8x16FromBits constructs a Mask8x16 from a bitmap value, where 1 means set for the indexed element, 0 means unset.
// Only the lower 16 bits of y are used.
// //
// Asm: KMOVB, CPU Feature: AVX512 // Asm: KMOVB, CPU Feature: AVX512
func Mask8x16FromBits(y uint16) Mask8x16 func Mask8x16FromBits(y uint16) Mask8x16
// ToBits constructs a bitmap from a Mask8x16, where 1 means set for the indexed element, 0 means unset. // ToBits constructs a bitmap from a Mask8x16, where 1 means set for the indexed element, 0 means unset.
// Only the lower 16 bits of y are used.
// //
// Asm: KMOVB, CPU Features: AVX512 // Asm: KMOVB, CPU Features: AVX512
func (x Mask8x16) ToBits() uint16 func (x Mask8x16) ToBits() uint16
@ -320,13 +318,11 @@ type Mask16x8 struct {
} }
// Mask16x8FromBits constructs a Mask16x8 from a bitmap value, where 1 means set for the indexed element, 0 means unset. // Mask16x8FromBits constructs a Mask16x8 from a bitmap value, where 1 means set for the indexed element, 0 means unset.
// Only the lower 8 bits of y are used.
// //
// Asm: KMOVW, CPU Feature: AVX512 // Asm: KMOVW, CPU Feature: AVX512
func Mask16x8FromBits(y uint8) Mask16x8 func Mask16x8FromBits(y uint8) Mask16x8
// ToBits constructs a bitmap from a Mask16x8, where 1 means set for the indexed element, 0 means unset. // ToBits constructs a bitmap from a Mask16x8, where 1 means set for the indexed element, 0 means unset.
// Only the lower 8 bits of y are used.
// //
// Asm: KMOVW, CPU Features: AVX512 // Asm: KMOVW, CPU Features: AVX512
func (x Mask16x8) ToBits() uint8 func (x Mask16x8) ToBits() uint8
@ -665,13 +661,11 @@ type Mask8x32 struct {
} }
// Mask8x32FromBits constructs a Mask8x32 from a bitmap value, where 1 means set for the indexed element, 0 means unset. // Mask8x32FromBits constructs a Mask8x32 from a bitmap value, where 1 means set for the indexed element, 0 means unset.
// Only the lower 32 bits of y are used.
// //
// Asm: KMOVB, CPU Feature: AVX512 // Asm: KMOVB, CPU Feature: AVX512
func Mask8x32FromBits(y uint32) Mask8x32 func Mask8x32FromBits(y uint32) Mask8x32
// ToBits constructs a bitmap from a Mask8x32, where 1 means set for the indexed element, 0 means unset. // ToBits constructs a bitmap from a Mask8x32, where 1 means set for the indexed element, 0 means unset.
// Only the lower 32 bits of y are used.
// //
// Asm: KMOVB, CPU Features: AVX512 // Asm: KMOVB, CPU Features: AVX512
func (x Mask8x32) ToBits() uint32 func (x Mask8x32) ToBits() uint32
@ -683,13 +677,11 @@ type Mask16x16 struct {
} }
// Mask16x16FromBits constructs a Mask16x16 from a bitmap value, where 1 means set for the indexed element, 0 means unset. // Mask16x16FromBits constructs a Mask16x16 from a bitmap value, where 1 means set for the indexed element, 0 means unset.
// Only the lower 16 bits of y are used.
// //
// Asm: KMOVW, CPU Feature: AVX512 // Asm: KMOVW, CPU Feature: AVX512
func Mask16x16FromBits(y uint16) Mask16x16 func Mask16x16FromBits(y uint16) Mask16x16
// ToBits constructs a bitmap from a Mask16x16, where 1 means set for the indexed element, 0 means unset. // ToBits constructs a bitmap from a Mask16x16, where 1 means set for the indexed element, 0 means unset.
// Only the lower 16 bits of y are used.
// //
// Asm: KMOVW, CPU Features: AVX512 // Asm: KMOVW, CPU Features: AVX512
func (x Mask16x16) ToBits() uint16 func (x Mask16x16) ToBits() uint16
@ -701,13 +693,11 @@ type Mask32x8 struct {
} }
// Mask32x8FromBits constructs a Mask32x8 from a bitmap value, where 1 means set for the indexed element, 0 means unset. // Mask32x8FromBits constructs a Mask32x8 from a bitmap value, where 1 means set for the indexed element, 0 means unset.
// Only the lower 8 bits of y are used.
// //
// Asm: KMOVD, CPU Feature: AVX512 // Asm: KMOVD, CPU Feature: AVX512
func Mask32x8FromBits(y uint8) Mask32x8 func Mask32x8FromBits(y uint8) Mask32x8
// ToBits constructs a bitmap from a Mask32x8, where 1 means set for the indexed element, 0 means unset. // ToBits constructs a bitmap from a Mask32x8, where 1 means set for the indexed element, 0 means unset.
// Only the lower 8 bits of y are used.
// //
// Asm: KMOVD, CPU Features: AVX512 // Asm: KMOVD, CPU Features: AVX512
func (x Mask32x8) ToBits() uint8 func (x Mask32x8) ToBits() uint8
@ -1092,13 +1082,11 @@ type Mask8x64 struct {
} }
// Mask8x64FromBits constructs a Mask8x64 from a bitmap value, where 1 means set for the indexed element, 0 means unset. // Mask8x64FromBits constructs a Mask8x64 from a bitmap value, where 1 means set for the indexed element, 0 means unset.
// Only the lower 64 bits of y are used.
// //
// Asm: KMOVB, CPU Feature: AVX512 // Asm: KMOVB, CPU Feature: AVX512
func Mask8x64FromBits(y uint64) Mask8x64 func Mask8x64FromBits(y uint64) Mask8x64
// ToBits constructs a bitmap from a Mask8x64, where 1 means set for the indexed element, 0 means unset. // ToBits constructs a bitmap from a Mask8x64, where 1 means set for the indexed element, 0 means unset.
// Only the lower 64 bits of y are used.
// //
// Asm: KMOVB, CPU Features: AVX512 // Asm: KMOVB, CPU Features: AVX512
func (x Mask8x64) ToBits() uint64 func (x Mask8x64) ToBits() uint64
@ -1110,13 +1098,11 @@ type Mask16x32 struct {
} }
// Mask16x32FromBits constructs a Mask16x32 from a bitmap value, where 1 means set for the indexed element, 0 means unset. // Mask16x32FromBits constructs a Mask16x32 from a bitmap value, where 1 means set for the indexed element, 0 means unset.
// Only the lower 32 bits of y are used.
// //
// Asm: KMOVW, CPU Feature: AVX512 // Asm: KMOVW, CPU Feature: AVX512
func Mask16x32FromBits(y uint32) Mask16x32 func Mask16x32FromBits(y uint32) Mask16x32
// ToBits constructs a bitmap from a Mask16x32, where 1 means set for the indexed element, 0 means unset. // ToBits constructs a bitmap from a Mask16x32, where 1 means set for the indexed element, 0 means unset.
// Only the lower 32 bits of y are used.
// //
// Asm: KMOVW, CPU Features: AVX512 // Asm: KMOVW, CPU Features: AVX512
func (x Mask16x32) ToBits() uint32 func (x Mask16x32) ToBits() uint32
@ -1128,13 +1114,11 @@ type Mask32x16 struct {
} }
// Mask32x16FromBits constructs a Mask32x16 from a bitmap value, where 1 means set for the indexed element, 0 means unset. // Mask32x16FromBits constructs a Mask32x16 from a bitmap value, where 1 means set for the indexed element, 0 means unset.
// Only the lower 16 bits of y are used.
// //
// Asm: KMOVD, CPU Feature: AVX512 // Asm: KMOVD, CPU Feature: AVX512
func Mask32x16FromBits(y uint16) Mask32x16 func Mask32x16FromBits(y uint16) Mask32x16
// ToBits constructs a bitmap from a Mask32x16, where 1 means set for the indexed element, 0 means unset. // ToBits constructs a bitmap from a Mask32x16, where 1 means set for the indexed element, 0 means unset.
// Only the lower 16 bits of y are used.
// //
// Asm: KMOVD, CPU Features: AVX512 // Asm: KMOVD, CPU Features: AVX512
func (x Mask32x16) ToBits() uint16 func (x Mask32x16) ToBits() uint16
@ -1146,13 +1130,11 @@ type Mask64x8 struct {
} }
// Mask64x8FromBits constructs a Mask64x8 from a bitmap value, where 1 means set for the indexed element, 0 means unset. // Mask64x8FromBits constructs a Mask64x8 from a bitmap value, where 1 means set for the indexed element, 0 means unset.
// Only the lower 8 bits of y are used.
// //
// Asm: KMOVQ, CPU Feature: AVX512 // Asm: KMOVQ, CPU Feature: AVX512
func Mask64x8FromBits(y uint8) Mask64x8 func Mask64x8FromBits(y uint8) Mask64x8
// ToBits constructs a bitmap from a Mask64x8, where 1 means set for the indexed element, 0 means unset. // ToBits constructs a bitmap from a Mask64x8, where 1 means set for the indexed element, 0 means unset.
// Only the lower 8 bits of y are used.
// //
// Asm: KMOVQ, CPU Features: AVX512 // Asm: KMOVQ, CPU Features: AVX512
func (x Mask64x8) ToBits() uint8 func (x Mask64x8) ToBits() uint8