From fc3bc49337be2774a6b38c71fa90dc3a7e716943 Mon Sep 17 00:00:00 2001 From: Junyang Shao Date: Tue, 14 Oct 2025 16:15:38 +0000 Subject: [PATCH] [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 Reviewed-by: David Chase --- src/simd/_gen/simdgen/gen_simdTypes.go | 4 ++++ src/simd/types_amd64.go | 18 ------------------ 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/simd/_gen/simdgen/gen_simdTypes.go b/src/simd/_gen/simdgen/gen_simdTypes.go index d443fff16e..03bb4989d9 100644 --- a/src/simd/_gen/simdgen/gen_simdTypes.go +++ b/src/simd/_gen/simdgen/gen_simdTypes.go @@ -182,13 +182,17 @@ func (x {{.Name}}) Store(y *[{{.Lanes}}]{{.Base}}) const simdMaskFromValTemplate = ` // {{.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. +{{- end}} // // Asm: KMOV{{.IntelSizeSuffix}}, CPU Feature: AVX512 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. +{{- if ne .Lanes .LanesContainer}} // Only the lower {{.Lanes}} bits of y are used. +{{- end}} // // Asm: KMOV{{.IntelSizeSuffix}}, CPU Features: AVX512 func (x {{.Name}}) ToBits() uint{{.LanesContainer}} diff --git a/src/simd/types_amd64.go b/src/simd/types_amd64.go index 0136f49f91..dfa864b802 100644 --- a/src/simd/types_amd64.go +++ b/src/simd/types_amd64.go @@ -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. -// Only the lower 16 bits of y are used. // // Asm: KMOVB, CPU Feature: AVX512 func Mask8x16FromBits(y uint16) Mask8x16 // 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 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. -// Only the lower 8 bits of y are used. // // Asm: KMOVW, CPU Feature: AVX512 func Mask16x8FromBits(y uint8) Mask16x8 // 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 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. -// Only the lower 32 bits of y are used. // // Asm: KMOVB, CPU Feature: AVX512 func Mask8x32FromBits(y uint32) Mask8x32 // 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 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. -// Only the lower 16 bits of y are used. // // Asm: KMOVW, CPU Feature: AVX512 func Mask16x16FromBits(y uint16) Mask16x16 // 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 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. -// Only the lower 8 bits of y are used. // // Asm: KMOVD, CPU Feature: AVX512 func Mask32x8FromBits(y uint8) Mask32x8 // 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 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. -// Only the lower 64 bits of y are used. // // Asm: KMOVB, CPU Feature: AVX512 func Mask8x64FromBits(y uint64) Mask8x64 // 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 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. -// Only the lower 32 bits of y are used. // // Asm: KMOVW, CPU Feature: AVX512 func Mask16x32FromBits(y uint32) Mask16x32 // 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 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. -// Only the lower 16 bits of y are used. // // Asm: KMOVD, CPU Feature: AVX512 func Mask32x16FromBits(y uint16) Mask32x16 // 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 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. -// Only the lower 8 bits of y are used. // // Asm: KMOVQ, CPU Feature: AVX512 func Mask64x8FromBits(y uint8) Mask64x8 // 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 func (x Mask64x8) ToBits() uint8 -- 2.52.0