aboutsummaryrefslogtreecommitdiff
path: root/src/simd
diff options
context:
space:
mode:
authorDavid Chase <drchase@google.com>2025-08-15 17:05:05 -0400
committerDavid Chase <drchase@google.com>2025-08-20 10:26:43 -0700
commit4fce49b86c91b0813857dcd5cdef2f7b61aa979c (patch)
tree400f19c808b139cce110e92f8f07f96c990b3b6e /src/simd
parent0f660d675f6c0ec4759e66328209ceaa7ccfa7eb (diff)
downloadgo-4fce49b86c91b0813857dcd5cdef2f7b61aa979c.tar.xz
[dev.simd] simd, cmd/compile: add widening unsigned converts 8->16->32
Change-Id: If0bde7154bd622573375eba5539fd642b8ef9d2f Reviewed-on: https://go-review.googlesource.com/c/go/+/696555 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
Diffstat (limited to 'src/simd')
-rw-r--r--src/simd/_gen/simdgen/ops/Converts/categories.yaml19
-rw-r--r--src/simd/_gen/simdgen/ops/Converts/go.yaml72
-rw-r--r--src/simd/ops_amd64.go42
3 files changed, 128 insertions, 5 deletions
diff --git a/src/simd/_gen/simdgen/ops/Converts/categories.yaml b/src/simd/_gen/simdgen/ops/Converts/categories.yaml
index cc6c419dcc..b4c7d468e9 100644
--- a/src/simd/_gen/simdgen/ops/Converts/categories.yaml
+++ b/src/simd/_gen/simdgen/ops/Converts/categories.yaml
@@ -2,9 +2,24 @@
- go: ConvertToInt32
commutative: false
documentation: !string |-
- // ConvertToInt32 converts element values to int32.
+ // NAME converts element values to int32.
- go: ConvertToUint32
commutative: false
documentation: !string |-
- // ConvertToUint32Masked converts element values to uint32.
+ // NAME converts element values to uint32.
+
+- go: ConvertToUint16
+ commutative: false
+ documentation: !string |-
+ // NAME converts element values to uint16.
+
+- go: ConvertToUint16x8
+ commutative: false
+ documentation: !string |-
+ // NAME converts 8 lowest vector element values to uint16.
+
+- go: ConvertToUint32x4
+ commutative: false
+ documentation: !string |-
+ // NAME converts 4 lowest vector element values to uint32.
diff --git a/src/simd/_gen/simdgen/ops/Converts/go.yaml b/src/simd/_gen/simdgen/ops/Converts/go.yaml
index 4e251728bf..be0f157b40 100644
--- a/src/simd/_gen/simdgen/ops/Converts/go.yaml
+++ b/src/simd/_gen/simdgen/ops/Converts/go.yaml
@@ -19,3 +19,75 @@
go: $u
base: uint
elemBits: 32
+
+- go: ConvertToUint16x8
+ asm: "VPMOVZXBW"
+ in:
+ - &u8x16
+ base: uint
+ elemBits: 8
+ bits: 128
+ out:
+ -
+ base: uint
+ elemBits: 16
+ bits: 128
+
+- go: ConvertToUint16
+ asm: "VPMOVZXBW"
+ in:
+ - *u8x16
+ out:
+ -
+ base: uint
+ elemBits: 16
+ bits: 256
+
+- go: ConvertToUint16
+ asm: "VPMOVZXBW"
+ in:
+ -
+ base: uint
+ elemBits: 8
+ bits: 256
+ out:
+ -
+ base: uint
+ elemBits: 16
+ bits: 512
+
+- go: ConvertToUint32x4
+ asm: "VPMOVZXWD"
+ in:
+ - &u16x8
+ base: uint
+ elemBits: 16
+ bits: 128
+ out:
+ -
+ base: uint
+ elemBits: 32
+ bits: 128
+
+- go: ConvertToUint32
+ asm: "VPMOVZXWD"
+ in:
+ - *u16x8
+ out:
+ -
+ base: uint
+ elemBits: 32
+ bits: 256
+
+- go: ConvertToUint32
+ asm: "VPMOVZXWD"
+ in:
+ -
+ base: uint
+ elemBits: 16
+ bits: 256
+ out:
+ -
+ base: uint
+ elemBits: 32
+ bits: 512
diff --git a/src/simd/ops_amd64.go b/src/simd/ops_amd64.go
index 76bbf738cb..79f5dc8523 100644
--- a/src/simd/ops_amd64.go
+++ b/src/simd/ops_amd64.go
@@ -1212,23 +1212,59 @@ func (x Float32x8) ConvertToInt32() Int32x8
// Asm: VCVTTPS2DQ, CPU Feature: AVX512
func (x Float32x16) ConvertToInt32() Int32x16
+/* ConvertToUint16 */
+
+// ConvertToUint16 converts element values to uint16.
+//
+// Asm: VPMOVZXBW, CPU Feature: AVX2
+func (x Uint8x16) ConvertToUint16() Uint16x16
+
+// ConvertToUint16 converts element values to uint16.
+//
+// Asm: VPMOVZXBW, CPU Feature: AVX512
+func (x Uint8x32) ConvertToUint16() Uint16x32
+
+/* ConvertToUint16x8 */
+
+// ConvertToUint16x8 converts 8 lowest vector element values to uint16.
+//
+// Asm: VPMOVZXBW, CPU Feature: AVX
+func (x Uint8x16) ConvertToUint16x8() Uint16x8
+
/* ConvertToUint32 */
-// ConvertToUint32Masked converts element values to uint32.
+// ConvertToUint32 converts element values to uint32.
//
// Asm: VCVTPS2UDQ, CPU Feature: AVX512
func (x Float32x4) ConvertToUint32() Uint32x4
-// ConvertToUint32Masked converts element values to uint32.
+// ConvertToUint32 converts element values to uint32.
//
// Asm: VCVTPS2UDQ, CPU Feature: AVX512
func (x Float32x8) ConvertToUint32() Uint32x8
-// ConvertToUint32Masked converts element values to uint32.
+// ConvertToUint32 converts element values to uint32.
//
// Asm: VCVTPS2UDQ, CPU Feature: AVX512
func (x Float32x16) ConvertToUint32() Uint32x16
+// ConvertToUint32 converts element values to uint32.
+//
+// Asm: VPMOVZXWD, CPU Feature: AVX2
+func (x Uint16x8) ConvertToUint32() Uint32x8
+
+// ConvertToUint32 converts element values to uint32.
+//
+// Asm: VPMOVZXWD, CPU Feature: AVX512
+func (x Uint16x16) ConvertToUint32() Uint32x16
+
+/* ConvertToUint32x4 */
+
+// ConvertToUint32x4 converts 4 lowest vector element values to uint32.
+//
+// Asm: VPMOVZXWD, CPU Feature: AVX
+func (x Uint16x8) ConvertToUint32x4() Uint32x4
+
/* CopySign */
// CopySign returns the product of the first operand with -1, 0, or 1,