[dev.simd] simd: modify test generation to make it more flexible

This is to support conversions, which are not T -> T.

Change-Id: I323887b116eee8133770a899ed82363bba38a9c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/689717
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
David Chase 2025-07-22 15:34:55 -04:00
parent ec5c20ba5a
commit a24ffe3379
7 changed files with 919 additions and 860 deletions

View file

@ -28,21 +28,6 @@ func testInt8x16Binary(t *testing.T, f func(_, _ simd.Int8x16) simd.Int8x16, wan
})
}
// testUint8x16Binary tests the simd binary method f against the expected behavior generated by want
func testUint8x16Binary(t *testing.T, f func(_, _ simd.Uint8x16) simd.Uint8x16, want func(_, _ []uint8) []uint8) {
n := 16
t.Helper()
forSlicePair(t, uint8s, n, func(x, y []uint8) bool {
t.Helper()
a := simd.LoadUint8x16Slice(x)
b := simd.LoadUint8x16Slice(y)
g := make([]uint8, n)
f(a, b).StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testInt16x8Binary tests the simd binary method f against the expected behavior generated by want
func testInt16x8Binary(t *testing.T, f func(_, _ simd.Int16x8) simd.Int16x8, want func(_, _ []int16) []int16) {
n := 8
@ -58,21 +43,6 @@ func testInt16x8Binary(t *testing.T, f func(_, _ simd.Int16x8) simd.Int16x8, wan
})
}
// testUint16x8Binary tests the simd binary method f against the expected behavior generated by want
func testUint16x8Binary(t *testing.T, f func(_, _ simd.Uint16x8) simd.Uint16x8, want func(_, _ []uint16) []uint16) {
n := 8
t.Helper()
forSlicePair(t, uint16s, n, func(x, y []uint16) bool {
t.Helper()
a := simd.LoadUint16x8Slice(x)
b := simd.LoadUint16x8Slice(y)
g := make([]uint16, n)
f(a, b).StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testInt32x4Binary tests the simd binary method f against the expected behavior generated by want
func testInt32x4Binary(t *testing.T, f func(_, _ simd.Int32x4) simd.Int32x4, want func(_, _ []int32) []int32) {
n := 4
@ -88,21 +58,6 @@ func testInt32x4Binary(t *testing.T, f func(_, _ simd.Int32x4) simd.Int32x4, wan
})
}
// testUint32x4Binary tests the simd binary method f against the expected behavior generated by want
func testUint32x4Binary(t *testing.T, f func(_, _ simd.Uint32x4) simd.Uint32x4, want func(_, _ []uint32) []uint32) {
n := 4
t.Helper()
forSlicePair(t, uint32s, n, func(x, y []uint32) bool {
t.Helper()
a := simd.LoadUint32x4Slice(x)
b := simd.LoadUint32x4Slice(y)
g := make([]uint32, n)
f(a, b).StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testInt64x2Binary tests the simd binary method f against the expected behavior generated by want
func testInt64x2Binary(t *testing.T, f func(_, _ simd.Int64x2) simd.Int64x2, want func(_, _ []int64) []int64) {
n := 2
@ -118,6 +73,51 @@ func testInt64x2Binary(t *testing.T, f func(_, _ simd.Int64x2) simd.Int64x2, wan
})
}
// testUint8x16Binary tests the simd binary method f against the expected behavior generated by want
func testUint8x16Binary(t *testing.T, f func(_, _ simd.Uint8x16) simd.Uint8x16, want func(_, _ []uint8) []uint8) {
n := 16
t.Helper()
forSlicePair(t, uint8s, n, func(x, y []uint8) bool {
t.Helper()
a := simd.LoadUint8x16Slice(x)
b := simd.LoadUint8x16Slice(y)
g := make([]uint8, n)
f(a, b).StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testUint16x8Binary tests the simd binary method f against the expected behavior generated by want
func testUint16x8Binary(t *testing.T, f func(_, _ simd.Uint16x8) simd.Uint16x8, want func(_, _ []uint16) []uint16) {
n := 8
t.Helper()
forSlicePair(t, uint16s, n, func(x, y []uint16) bool {
t.Helper()
a := simd.LoadUint16x8Slice(x)
b := simd.LoadUint16x8Slice(y)
g := make([]uint16, n)
f(a, b).StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testUint32x4Binary tests the simd binary method f against the expected behavior generated by want
func testUint32x4Binary(t *testing.T, f func(_, _ simd.Uint32x4) simd.Uint32x4, want func(_, _ []uint32) []uint32) {
n := 4
t.Helper()
forSlicePair(t, uint32s, n, func(x, y []uint32) bool {
t.Helper()
a := simd.LoadUint32x4Slice(x)
b := simd.LoadUint32x4Slice(y)
g := make([]uint32, n)
f(a, b).StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testUint64x2Binary tests the simd binary method f against the expected behavior generated by want
func testUint64x2Binary(t *testing.T, f func(_, _ simd.Uint64x2) simd.Uint64x2, want func(_, _ []uint64) []uint64) {
n := 2
@ -178,21 +178,6 @@ func testInt8x32Binary(t *testing.T, f func(_, _ simd.Int8x32) simd.Int8x32, wan
})
}
// testUint8x32Binary tests the simd binary method f against the expected behavior generated by want
func testUint8x32Binary(t *testing.T, f func(_, _ simd.Uint8x32) simd.Uint8x32, want func(_, _ []uint8) []uint8) {
n := 32
t.Helper()
forSlicePair(t, uint8s, n, func(x, y []uint8) bool {
t.Helper()
a := simd.LoadUint8x32Slice(x)
b := simd.LoadUint8x32Slice(y)
g := make([]uint8, n)
f(a, b).StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testInt16x16Binary tests the simd binary method f against the expected behavior generated by want
func testInt16x16Binary(t *testing.T, f func(_, _ simd.Int16x16) simd.Int16x16, want func(_, _ []int16) []int16) {
n := 16
@ -208,21 +193,6 @@ func testInt16x16Binary(t *testing.T, f func(_, _ simd.Int16x16) simd.Int16x16,
})
}
// testUint16x16Binary tests the simd binary method f against the expected behavior generated by want
func testUint16x16Binary(t *testing.T, f func(_, _ simd.Uint16x16) simd.Uint16x16, want func(_, _ []uint16) []uint16) {
n := 16
t.Helper()
forSlicePair(t, uint16s, n, func(x, y []uint16) bool {
t.Helper()
a := simd.LoadUint16x16Slice(x)
b := simd.LoadUint16x16Slice(y)
g := make([]uint16, n)
f(a, b).StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testInt32x8Binary tests the simd binary method f against the expected behavior generated by want
func testInt32x8Binary(t *testing.T, f func(_, _ simd.Int32x8) simd.Int32x8, want func(_, _ []int32) []int32) {
n := 8
@ -238,21 +208,6 @@ func testInt32x8Binary(t *testing.T, f func(_, _ simd.Int32x8) simd.Int32x8, wan
})
}
// testUint32x8Binary tests the simd binary method f against the expected behavior generated by want
func testUint32x8Binary(t *testing.T, f func(_, _ simd.Uint32x8) simd.Uint32x8, want func(_, _ []uint32) []uint32) {
n := 8
t.Helper()
forSlicePair(t, uint32s, n, func(x, y []uint32) bool {
t.Helper()
a := simd.LoadUint32x8Slice(x)
b := simd.LoadUint32x8Slice(y)
g := make([]uint32, n)
f(a, b).StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testInt64x4Binary tests the simd binary method f against the expected behavior generated by want
func testInt64x4Binary(t *testing.T, f func(_, _ simd.Int64x4) simd.Int64x4, want func(_, _ []int64) []int64) {
n := 4
@ -268,6 +223,51 @@ func testInt64x4Binary(t *testing.T, f func(_, _ simd.Int64x4) simd.Int64x4, wan
})
}
// testUint8x32Binary tests the simd binary method f against the expected behavior generated by want
func testUint8x32Binary(t *testing.T, f func(_, _ simd.Uint8x32) simd.Uint8x32, want func(_, _ []uint8) []uint8) {
n := 32
t.Helper()
forSlicePair(t, uint8s, n, func(x, y []uint8) bool {
t.Helper()
a := simd.LoadUint8x32Slice(x)
b := simd.LoadUint8x32Slice(y)
g := make([]uint8, n)
f(a, b).StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testUint16x16Binary tests the simd binary method f against the expected behavior generated by want
func testUint16x16Binary(t *testing.T, f func(_, _ simd.Uint16x16) simd.Uint16x16, want func(_, _ []uint16) []uint16) {
n := 16
t.Helper()
forSlicePair(t, uint16s, n, func(x, y []uint16) bool {
t.Helper()
a := simd.LoadUint16x16Slice(x)
b := simd.LoadUint16x16Slice(y)
g := make([]uint16, n)
f(a, b).StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testUint32x8Binary tests the simd binary method f against the expected behavior generated by want
func testUint32x8Binary(t *testing.T, f func(_, _ simd.Uint32x8) simd.Uint32x8, want func(_, _ []uint32) []uint32) {
n := 8
t.Helper()
forSlicePair(t, uint32s, n, func(x, y []uint32) bool {
t.Helper()
a := simd.LoadUint32x8Slice(x)
b := simd.LoadUint32x8Slice(y)
g := make([]uint32, n)
f(a, b).StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testUint64x4Binary tests the simd binary method f against the expected behavior generated by want
func testUint64x4Binary(t *testing.T, f func(_, _ simd.Uint64x4) simd.Uint64x4, want func(_, _ []uint64) []uint64) {
n := 4
@ -328,21 +328,6 @@ func testInt8x64Binary(t *testing.T, f func(_, _ simd.Int8x64) simd.Int8x64, wan
})
}
// testUint8x64Binary tests the simd binary method f against the expected behavior generated by want
func testUint8x64Binary(t *testing.T, f func(_, _ simd.Uint8x64) simd.Uint8x64, want func(_, _ []uint8) []uint8) {
n := 64
t.Helper()
forSlicePair(t, uint8s, n, func(x, y []uint8) bool {
t.Helper()
a := simd.LoadUint8x64Slice(x)
b := simd.LoadUint8x64Slice(y)
g := make([]uint8, n)
f(a, b).StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testInt16x32Binary tests the simd binary method f against the expected behavior generated by want
func testInt16x32Binary(t *testing.T, f func(_, _ simd.Int16x32) simd.Int16x32, want func(_, _ []int16) []int16) {
n := 32
@ -358,21 +343,6 @@ func testInt16x32Binary(t *testing.T, f func(_, _ simd.Int16x32) simd.Int16x32,
})
}
// testUint16x32Binary tests the simd binary method f against the expected behavior generated by want
func testUint16x32Binary(t *testing.T, f func(_, _ simd.Uint16x32) simd.Uint16x32, want func(_, _ []uint16) []uint16) {
n := 32
t.Helper()
forSlicePair(t, uint16s, n, func(x, y []uint16) bool {
t.Helper()
a := simd.LoadUint16x32Slice(x)
b := simd.LoadUint16x32Slice(y)
g := make([]uint16, n)
f(a, b).StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testInt32x16Binary tests the simd binary method f against the expected behavior generated by want
func testInt32x16Binary(t *testing.T, f func(_, _ simd.Int32x16) simd.Int32x16, want func(_, _ []int32) []int32) {
n := 16
@ -388,21 +358,6 @@ func testInt32x16Binary(t *testing.T, f func(_, _ simd.Int32x16) simd.Int32x16,
})
}
// testUint32x16Binary tests the simd binary method f against the expected behavior generated by want
func testUint32x16Binary(t *testing.T, f func(_, _ simd.Uint32x16) simd.Uint32x16, want func(_, _ []uint32) []uint32) {
n := 16
t.Helper()
forSlicePair(t, uint32s, n, func(x, y []uint32) bool {
t.Helper()
a := simd.LoadUint32x16Slice(x)
b := simd.LoadUint32x16Slice(y)
g := make([]uint32, n)
f(a, b).StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testInt64x8Binary tests the simd binary method f against the expected behavior generated by want
func testInt64x8Binary(t *testing.T, f func(_, _ simd.Int64x8) simd.Int64x8, want func(_, _ []int64) []int64) {
n := 8
@ -418,6 +373,51 @@ func testInt64x8Binary(t *testing.T, f func(_, _ simd.Int64x8) simd.Int64x8, wan
})
}
// testUint8x64Binary tests the simd binary method f against the expected behavior generated by want
func testUint8x64Binary(t *testing.T, f func(_, _ simd.Uint8x64) simd.Uint8x64, want func(_, _ []uint8) []uint8) {
n := 64
t.Helper()
forSlicePair(t, uint8s, n, func(x, y []uint8) bool {
t.Helper()
a := simd.LoadUint8x64Slice(x)
b := simd.LoadUint8x64Slice(y)
g := make([]uint8, n)
f(a, b).StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testUint16x32Binary tests the simd binary method f against the expected behavior generated by want
func testUint16x32Binary(t *testing.T, f func(_, _ simd.Uint16x32) simd.Uint16x32, want func(_, _ []uint16) []uint16) {
n := 32
t.Helper()
forSlicePair(t, uint16s, n, func(x, y []uint16) bool {
t.Helper()
a := simd.LoadUint16x32Slice(x)
b := simd.LoadUint16x32Slice(y)
g := make([]uint16, n)
f(a, b).StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testUint32x16Binary tests the simd binary method f against the expected behavior generated by want
func testUint32x16Binary(t *testing.T, f func(_, _ simd.Uint32x16) simd.Uint32x16, want func(_, _ []uint32) []uint32) {
n := 16
t.Helper()
forSlicePair(t, uint32s, n, func(x, y []uint32) bool {
t.Helper()
a := simd.LoadUint32x16Slice(x)
b := simd.LoadUint32x16Slice(y)
g := make([]uint32, n)
f(a, b).StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testUint64x8Binary tests the simd binary method f against the expected behavior generated by want
func testUint64x8Binary(t *testing.T, f func(_, _ simd.Uint64x8) simd.Uint64x8, want func(_, _ []uint64) []uint64) {
n := 8

View file

@ -28,21 +28,6 @@ func testInt8x16Compare(t *testing.T, f func(_, _ simd.Int8x16) simd.Mask8x16, w
})
}
// testUint8x16Compare tests the simd comparison method f against the expected behavior generated by want
func testUint8x16Compare(t *testing.T, f func(_, _ simd.Uint8x16) simd.Mask8x16, want func(_, _ []uint8) []int64) {
n := 16
t.Helper()
forSlicePair(t, uint8s, n, func(x, y []uint8) bool {
t.Helper()
a := simd.LoadUint8x16Slice(x)
b := simd.LoadUint8x16Slice(y)
g := make([]int8, n)
f(a, b).AsInt8x16().StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testInt16x8Compare tests the simd comparison method f against the expected behavior generated by want
func testInt16x8Compare(t *testing.T, f func(_, _ simd.Int16x8) simd.Mask16x8, want func(_, _ []int16) []int64) {
n := 8
@ -58,21 +43,6 @@ func testInt16x8Compare(t *testing.T, f func(_, _ simd.Int16x8) simd.Mask16x8, w
})
}
// testUint16x8Compare tests the simd comparison method f against the expected behavior generated by want
func testUint16x8Compare(t *testing.T, f func(_, _ simd.Uint16x8) simd.Mask16x8, want func(_, _ []uint16) []int64) {
n := 8
t.Helper()
forSlicePair(t, uint16s, n, func(x, y []uint16) bool {
t.Helper()
a := simd.LoadUint16x8Slice(x)
b := simd.LoadUint16x8Slice(y)
g := make([]int16, n)
f(a, b).AsInt16x8().StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testInt32x4Compare tests the simd comparison method f against the expected behavior generated by want
func testInt32x4Compare(t *testing.T, f func(_, _ simd.Int32x4) simd.Mask32x4, want func(_, _ []int32) []int64) {
n := 4
@ -88,21 +58,6 @@ func testInt32x4Compare(t *testing.T, f func(_, _ simd.Int32x4) simd.Mask32x4, w
})
}
// testUint32x4Compare tests the simd comparison method f against the expected behavior generated by want
func testUint32x4Compare(t *testing.T, f func(_, _ simd.Uint32x4) simd.Mask32x4, want func(_, _ []uint32) []int64) {
n := 4
t.Helper()
forSlicePair(t, uint32s, n, func(x, y []uint32) bool {
t.Helper()
a := simd.LoadUint32x4Slice(x)
b := simd.LoadUint32x4Slice(y)
g := make([]int32, n)
f(a, b).AsInt32x4().StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testInt64x2Compare tests the simd comparison method f against the expected behavior generated by want
func testInt64x2Compare(t *testing.T, f func(_, _ simd.Int64x2) simd.Mask64x2, want func(_, _ []int64) []int64) {
n := 2
@ -118,6 +73,51 @@ func testInt64x2Compare(t *testing.T, f func(_, _ simd.Int64x2) simd.Mask64x2, w
})
}
// testUint8x16Compare tests the simd comparison method f against the expected behavior generated by want
func testUint8x16Compare(t *testing.T, f func(_, _ simd.Uint8x16) simd.Mask8x16, want func(_, _ []uint8) []int64) {
n := 16
t.Helper()
forSlicePair(t, uint8s, n, func(x, y []uint8) bool {
t.Helper()
a := simd.LoadUint8x16Slice(x)
b := simd.LoadUint8x16Slice(y)
g := make([]int8, n)
f(a, b).AsInt8x16().StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testUint16x8Compare tests the simd comparison method f against the expected behavior generated by want
func testUint16x8Compare(t *testing.T, f func(_, _ simd.Uint16x8) simd.Mask16x8, want func(_, _ []uint16) []int64) {
n := 8
t.Helper()
forSlicePair(t, uint16s, n, func(x, y []uint16) bool {
t.Helper()
a := simd.LoadUint16x8Slice(x)
b := simd.LoadUint16x8Slice(y)
g := make([]int16, n)
f(a, b).AsInt16x8().StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testUint32x4Compare tests the simd comparison method f against the expected behavior generated by want
func testUint32x4Compare(t *testing.T, f func(_, _ simd.Uint32x4) simd.Mask32x4, want func(_, _ []uint32) []int64) {
n := 4
t.Helper()
forSlicePair(t, uint32s, n, func(x, y []uint32) bool {
t.Helper()
a := simd.LoadUint32x4Slice(x)
b := simd.LoadUint32x4Slice(y)
g := make([]int32, n)
f(a, b).AsInt32x4().StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testUint64x2Compare tests the simd comparison method f against the expected behavior generated by want
func testUint64x2Compare(t *testing.T, f func(_, _ simd.Uint64x2) simd.Mask64x2, want func(_, _ []uint64) []int64) {
n := 2
@ -178,21 +178,6 @@ func testInt8x32Compare(t *testing.T, f func(_, _ simd.Int8x32) simd.Mask8x32, w
})
}
// testUint8x32Compare tests the simd comparison method f against the expected behavior generated by want
func testUint8x32Compare(t *testing.T, f func(_, _ simd.Uint8x32) simd.Mask8x32, want func(_, _ []uint8) []int64) {
n := 32
t.Helper()
forSlicePair(t, uint8s, n, func(x, y []uint8) bool {
t.Helper()
a := simd.LoadUint8x32Slice(x)
b := simd.LoadUint8x32Slice(y)
g := make([]int8, n)
f(a, b).AsInt8x32().StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testInt16x16Compare tests the simd comparison method f against the expected behavior generated by want
func testInt16x16Compare(t *testing.T, f func(_, _ simd.Int16x16) simd.Mask16x16, want func(_, _ []int16) []int64) {
n := 16
@ -208,21 +193,6 @@ func testInt16x16Compare(t *testing.T, f func(_, _ simd.Int16x16) simd.Mask16x16
})
}
// testUint16x16Compare tests the simd comparison method f against the expected behavior generated by want
func testUint16x16Compare(t *testing.T, f func(_, _ simd.Uint16x16) simd.Mask16x16, want func(_, _ []uint16) []int64) {
n := 16
t.Helper()
forSlicePair(t, uint16s, n, func(x, y []uint16) bool {
t.Helper()
a := simd.LoadUint16x16Slice(x)
b := simd.LoadUint16x16Slice(y)
g := make([]int16, n)
f(a, b).AsInt16x16().StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testInt32x8Compare tests the simd comparison method f against the expected behavior generated by want
func testInt32x8Compare(t *testing.T, f func(_, _ simd.Int32x8) simd.Mask32x8, want func(_, _ []int32) []int64) {
n := 8
@ -238,21 +208,6 @@ func testInt32x8Compare(t *testing.T, f func(_, _ simd.Int32x8) simd.Mask32x8, w
})
}
// testUint32x8Compare tests the simd comparison method f against the expected behavior generated by want
func testUint32x8Compare(t *testing.T, f func(_, _ simd.Uint32x8) simd.Mask32x8, want func(_, _ []uint32) []int64) {
n := 8
t.Helper()
forSlicePair(t, uint32s, n, func(x, y []uint32) bool {
t.Helper()
a := simd.LoadUint32x8Slice(x)
b := simd.LoadUint32x8Slice(y)
g := make([]int32, n)
f(a, b).AsInt32x8().StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testInt64x4Compare tests the simd comparison method f against the expected behavior generated by want
func testInt64x4Compare(t *testing.T, f func(_, _ simd.Int64x4) simd.Mask64x4, want func(_, _ []int64) []int64) {
n := 4
@ -268,6 +223,51 @@ func testInt64x4Compare(t *testing.T, f func(_, _ simd.Int64x4) simd.Mask64x4, w
})
}
// testUint8x32Compare tests the simd comparison method f against the expected behavior generated by want
func testUint8x32Compare(t *testing.T, f func(_, _ simd.Uint8x32) simd.Mask8x32, want func(_, _ []uint8) []int64) {
n := 32
t.Helper()
forSlicePair(t, uint8s, n, func(x, y []uint8) bool {
t.Helper()
a := simd.LoadUint8x32Slice(x)
b := simd.LoadUint8x32Slice(y)
g := make([]int8, n)
f(a, b).AsInt8x32().StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testUint16x16Compare tests the simd comparison method f against the expected behavior generated by want
func testUint16x16Compare(t *testing.T, f func(_, _ simd.Uint16x16) simd.Mask16x16, want func(_, _ []uint16) []int64) {
n := 16
t.Helper()
forSlicePair(t, uint16s, n, func(x, y []uint16) bool {
t.Helper()
a := simd.LoadUint16x16Slice(x)
b := simd.LoadUint16x16Slice(y)
g := make([]int16, n)
f(a, b).AsInt16x16().StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testUint32x8Compare tests the simd comparison method f against the expected behavior generated by want
func testUint32x8Compare(t *testing.T, f func(_, _ simd.Uint32x8) simd.Mask32x8, want func(_, _ []uint32) []int64) {
n := 8
t.Helper()
forSlicePair(t, uint32s, n, func(x, y []uint32) bool {
t.Helper()
a := simd.LoadUint32x8Slice(x)
b := simd.LoadUint32x8Slice(y)
g := make([]int32, n)
f(a, b).AsInt32x8().StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testUint64x4Compare tests the simd comparison method f against the expected behavior generated by want
func testUint64x4Compare(t *testing.T, f func(_, _ simd.Uint64x4) simd.Mask64x4, want func(_, _ []uint64) []int64) {
n := 4
@ -328,21 +328,6 @@ func testInt8x64Compare(t *testing.T, f func(_, _ simd.Int8x64) simd.Mask8x64, w
})
}
// testUint8x64Compare tests the simd comparison method f against the expected behavior generated by want
func testUint8x64Compare(t *testing.T, f func(_, _ simd.Uint8x64) simd.Mask8x64, want func(_, _ []uint8) []int64) {
n := 64
t.Helper()
forSlicePair(t, uint8s, n, func(x, y []uint8) bool {
t.Helper()
a := simd.LoadUint8x64Slice(x)
b := simd.LoadUint8x64Slice(y)
g := make([]int8, n)
f(a, b).AsInt8x64().StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testInt16x32Compare tests the simd comparison method f against the expected behavior generated by want
func testInt16x32Compare(t *testing.T, f func(_, _ simd.Int16x32) simd.Mask16x32, want func(_, _ []int16) []int64) {
n := 32
@ -358,21 +343,6 @@ func testInt16x32Compare(t *testing.T, f func(_, _ simd.Int16x32) simd.Mask16x32
})
}
// testUint16x32Compare tests the simd comparison method f against the expected behavior generated by want
func testUint16x32Compare(t *testing.T, f func(_, _ simd.Uint16x32) simd.Mask16x32, want func(_, _ []uint16) []int64) {
n := 32
t.Helper()
forSlicePair(t, uint16s, n, func(x, y []uint16) bool {
t.Helper()
a := simd.LoadUint16x32Slice(x)
b := simd.LoadUint16x32Slice(y)
g := make([]int16, n)
f(a, b).AsInt16x32().StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testInt32x16Compare tests the simd comparison method f against the expected behavior generated by want
func testInt32x16Compare(t *testing.T, f func(_, _ simd.Int32x16) simd.Mask32x16, want func(_, _ []int32) []int64) {
n := 16
@ -388,21 +358,6 @@ func testInt32x16Compare(t *testing.T, f func(_, _ simd.Int32x16) simd.Mask32x16
})
}
// testUint32x16Compare tests the simd comparison method f against the expected behavior generated by want
func testUint32x16Compare(t *testing.T, f func(_, _ simd.Uint32x16) simd.Mask32x16, want func(_, _ []uint32) []int64) {
n := 16
t.Helper()
forSlicePair(t, uint32s, n, func(x, y []uint32) bool {
t.Helper()
a := simd.LoadUint32x16Slice(x)
b := simd.LoadUint32x16Slice(y)
g := make([]int32, n)
f(a, b).AsInt32x16().StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testInt64x8Compare tests the simd comparison method f against the expected behavior generated by want
func testInt64x8Compare(t *testing.T, f func(_, _ simd.Int64x8) simd.Mask64x8, want func(_, _ []int64) []int64) {
n := 8
@ -418,6 +373,51 @@ func testInt64x8Compare(t *testing.T, f func(_, _ simd.Int64x8) simd.Mask64x8, w
})
}
// testUint8x64Compare tests the simd comparison method f against the expected behavior generated by want
func testUint8x64Compare(t *testing.T, f func(_, _ simd.Uint8x64) simd.Mask8x64, want func(_, _ []uint8) []int64) {
n := 64
t.Helper()
forSlicePair(t, uint8s, n, func(x, y []uint8) bool {
t.Helper()
a := simd.LoadUint8x64Slice(x)
b := simd.LoadUint8x64Slice(y)
g := make([]int8, n)
f(a, b).AsInt8x64().StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testUint16x32Compare tests the simd comparison method f against the expected behavior generated by want
func testUint16x32Compare(t *testing.T, f func(_, _ simd.Uint16x32) simd.Mask16x32, want func(_, _ []uint16) []int64) {
n := 32
t.Helper()
forSlicePair(t, uint16s, n, func(x, y []uint16) bool {
t.Helper()
a := simd.LoadUint16x32Slice(x)
b := simd.LoadUint16x32Slice(y)
g := make([]int16, n)
f(a, b).AsInt16x32().StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testUint32x16Compare tests the simd comparison method f against the expected behavior generated by want
func testUint32x16Compare(t *testing.T, f func(_, _ simd.Uint32x16) simd.Mask32x16, want func(_, _ []uint32) []int64) {
n := 16
t.Helper()
forSlicePair(t, uint32s, n, func(x, y []uint32) bool {
t.Helper()
a := simd.LoadUint32x16Slice(x)
b := simd.LoadUint32x16Slice(y)
g := make([]int32, n)
f(a, b).AsInt32x16().StoreSlice(g)
w := want(x, y)
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testUint64x8Compare tests the simd comparison method f against the expected behavior generated by want
func testUint64x8Compare(t *testing.T, f func(_, _ simd.Uint64x8) simd.Mask64x8, want func(_, _ []uint64) []int64) {
n := 8

View file

@ -37,30 +37,6 @@ func testInt8x16CompareMasked(t *testing.T,
})
}
// testUint8x16CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testUint8x16CompareMasked(t *testing.T,
f func(_, _ simd.Uint8x16, m simd.Mask8x16) simd.Mask8x16,
want func(_, _ []uint8) []int64) {
n := 16
t.Helper()
forSlicePairMasked(t, uint8s, n, func(x, y []uint8, m []bool) bool {
t.Helper()
a := simd.LoadUint8x16Slice(x)
b := simd.LoadUint8x16Slice(y)
k := simd.LoadInt8x16Slice(toVect[int8](m)).AsMask8x16()
g := make([]int8, n)
f(a, b, k).AsInt8x16().StoreSlice(g)
w := want(x, y)
for i := range m {
if !m[i] {
w[i] = 0
}
}
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("m=%v", m) })
})
}
// testInt16x8CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testInt16x8CompareMasked(t *testing.T,
@ -85,30 +61,6 @@ func testInt16x8CompareMasked(t *testing.T,
})
}
// testUint16x8CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testUint16x8CompareMasked(t *testing.T,
f func(_, _ simd.Uint16x8, m simd.Mask16x8) simd.Mask16x8,
want func(_, _ []uint16) []int64) {
n := 8
t.Helper()
forSlicePairMasked(t, uint16s, n, func(x, y []uint16, m []bool) bool {
t.Helper()
a := simd.LoadUint16x8Slice(x)
b := simd.LoadUint16x8Slice(y)
k := simd.LoadInt16x8Slice(toVect[int16](m)).AsMask16x8()
g := make([]int16, n)
f(a, b, k).AsInt16x8().StoreSlice(g)
w := want(x, y)
for i := range m {
if !m[i] {
w[i] = 0
}
}
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("m=%v", m) })
})
}
// testInt32x4CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testInt32x4CompareMasked(t *testing.T,
@ -133,30 +85,6 @@ func testInt32x4CompareMasked(t *testing.T,
})
}
// testUint32x4CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testUint32x4CompareMasked(t *testing.T,
f func(_, _ simd.Uint32x4, m simd.Mask32x4) simd.Mask32x4,
want func(_, _ []uint32) []int64) {
n := 4
t.Helper()
forSlicePairMasked(t, uint32s, n, func(x, y []uint32, m []bool) bool {
t.Helper()
a := simd.LoadUint32x4Slice(x)
b := simd.LoadUint32x4Slice(y)
k := simd.LoadInt32x4Slice(toVect[int32](m)).AsMask32x4()
g := make([]int32, n)
f(a, b, k).AsInt32x4().StoreSlice(g)
w := want(x, y)
for i := range m {
if !m[i] {
w[i] = 0
}
}
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("m=%v", m) })
})
}
// testInt64x2CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testInt64x2CompareMasked(t *testing.T,
@ -181,6 +109,78 @@ func testInt64x2CompareMasked(t *testing.T,
})
}
// testUint8x16CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testUint8x16CompareMasked(t *testing.T,
f func(_, _ simd.Uint8x16, m simd.Mask8x16) simd.Mask8x16,
want func(_, _ []uint8) []int64) {
n := 16
t.Helper()
forSlicePairMasked(t, uint8s, n, func(x, y []uint8, m []bool) bool {
t.Helper()
a := simd.LoadUint8x16Slice(x)
b := simd.LoadUint8x16Slice(y)
k := simd.LoadInt8x16Slice(toVect[int8](m)).AsMask8x16()
g := make([]int8, n)
f(a, b, k).AsInt8x16().StoreSlice(g)
w := want(x, y)
for i := range m {
if !m[i] {
w[i] = 0
}
}
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("m=%v", m) })
})
}
// testUint16x8CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testUint16x8CompareMasked(t *testing.T,
f func(_, _ simd.Uint16x8, m simd.Mask16x8) simd.Mask16x8,
want func(_, _ []uint16) []int64) {
n := 8
t.Helper()
forSlicePairMasked(t, uint16s, n, func(x, y []uint16, m []bool) bool {
t.Helper()
a := simd.LoadUint16x8Slice(x)
b := simd.LoadUint16x8Slice(y)
k := simd.LoadInt16x8Slice(toVect[int16](m)).AsMask16x8()
g := make([]int16, n)
f(a, b, k).AsInt16x8().StoreSlice(g)
w := want(x, y)
for i := range m {
if !m[i] {
w[i] = 0
}
}
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("m=%v", m) })
})
}
// testUint32x4CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testUint32x4CompareMasked(t *testing.T,
f func(_, _ simd.Uint32x4, m simd.Mask32x4) simd.Mask32x4,
want func(_, _ []uint32) []int64) {
n := 4
t.Helper()
forSlicePairMasked(t, uint32s, n, func(x, y []uint32, m []bool) bool {
t.Helper()
a := simd.LoadUint32x4Slice(x)
b := simd.LoadUint32x4Slice(y)
k := simd.LoadInt32x4Slice(toVect[int32](m)).AsMask32x4()
g := make([]int32, n)
f(a, b, k).AsInt32x4().StoreSlice(g)
w := want(x, y)
for i := range m {
if !m[i] {
w[i] = 0
}
}
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("m=%v", m) })
})
}
// testUint64x2CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testUint64x2CompareMasked(t *testing.T,
@ -277,30 +277,6 @@ func testInt8x32CompareMasked(t *testing.T,
})
}
// testUint8x32CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testUint8x32CompareMasked(t *testing.T,
f func(_, _ simd.Uint8x32, m simd.Mask8x32) simd.Mask8x32,
want func(_, _ []uint8) []int64) {
n := 32
t.Helper()
forSlicePairMasked(t, uint8s, n, func(x, y []uint8, m []bool) bool {
t.Helper()
a := simd.LoadUint8x32Slice(x)
b := simd.LoadUint8x32Slice(y)
k := simd.LoadInt8x32Slice(toVect[int8](m)).AsMask8x32()
g := make([]int8, n)
f(a, b, k).AsInt8x32().StoreSlice(g)
w := want(x, y)
for i := range m {
if !m[i] {
w[i] = 0
}
}
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("m=%v", m) })
})
}
// testInt16x16CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testInt16x16CompareMasked(t *testing.T,
@ -325,30 +301,6 @@ func testInt16x16CompareMasked(t *testing.T,
})
}
// testUint16x16CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testUint16x16CompareMasked(t *testing.T,
f func(_, _ simd.Uint16x16, m simd.Mask16x16) simd.Mask16x16,
want func(_, _ []uint16) []int64) {
n := 16
t.Helper()
forSlicePairMasked(t, uint16s, n, func(x, y []uint16, m []bool) bool {
t.Helper()
a := simd.LoadUint16x16Slice(x)
b := simd.LoadUint16x16Slice(y)
k := simd.LoadInt16x16Slice(toVect[int16](m)).AsMask16x16()
g := make([]int16, n)
f(a, b, k).AsInt16x16().StoreSlice(g)
w := want(x, y)
for i := range m {
if !m[i] {
w[i] = 0
}
}
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("m=%v", m) })
})
}
// testInt32x8CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testInt32x8CompareMasked(t *testing.T,
@ -373,30 +325,6 @@ func testInt32x8CompareMasked(t *testing.T,
})
}
// testUint32x8CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testUint32x8CompareMasked(t *testing.T,
f func(_, _ simd.Uint32x8, m simd.Mask32x8) simd.Mask32x8,
want func(_, _ []uint32) []int64) {
n := 8
t.Helper()
forSlicePairMasked(t, uint32s, n, func(x, y []uint32, m []bool) bool {
t.Helper()
a := simd.LoadUint32x8Slice(x)
b := simd.LoadUint32x8Slice(y)
k := simd.LoadInt32x8Slice(toVect[int32](m)).AsMask32x8()
g := make([]int32, n)
f(a, b, k).AsInt32x8().StoreSlice(g)
w := want(x, y)
for i := range m {
if !m[i] {
w[i] = 0
}
}
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("m=%v", m) })
})
}
// testInt64x4CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testInt64x4CompareMasked(t *testing.T,
@ -421,6 +349,78 @@ func testInt64x4CompareMasked(t *testing.T,
})
}
// testUint8x32CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testUint8x32CompareMasked(t *testing.T,
f func(_, _ simd.Uint8x32, m simd.Mask8x32) simd.Mask8x32,
want func(_, _ []uint8) []int64) {
n := 32
t.Helper()
forSlicePairMasked(t, uint8s, n, func(x, y []uint8, m []bool) bool {
t.Helper()
a := simd.LoadUint8x32Slice(x)
b := simd.LoadUint8x32Slice(y)
k := simd.LoadInt8x32Slice(toVect[int8](m)).AsMask8x32()
g := make([]int8, n)
f(a, b, k).AsInt8x32().StoreSlice(g)
w := want(x, y)
for i := range m {
if !m[i] {
w[i] = 0
}
}
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("m=%v", m) })
})
}
// testUint16x16CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testUint16x16CompareMasked(t *testing.T,
f func(_, _ simd.Uint16x16, m simd.Mask16x16) simd.Mask16x16,
want func(_, _ []uint16) []int64) {
n := 16
t.Helper()
forSlicePairMasked(t, uint16s, n, func(x, y []uint16, m []bool) bool {
t.Helper()
a := simd.LoadUint16x16Slice(x)
b := simd.LoadUint16x16Slice(y)
k := simd.LoadInt16x16Slice(toVect[int16](m)).AsMask16x16()
g := make([]int16, n)
f(a, b, k).AsInt16x16().StoreSlice(g)
w := want(x, y)
for i := range m {
if !m[i] {
w[i] = 0
}
}
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("m=%v", m) })
})
}
// testUint32x8CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testUint32x8CompareMasked(t *testing.T,
f func(_, _ simd.Uint32x8, m simd.Mask32x8) simd.Mask32x8,
want func(_, _ []uint32) []int64) {
n := 8
t.Helper()
forSlicePairMasked(t, uint32s, n, func(x, y []uint32, m []bool) bool {
t.Helper()
a := simd.LoadUint32x8Slice(x)
b := simd.LoadUint32x8Slice(y)
k := simd.LoadInt32x8Slice(toVect[int32](m)).AsMask32x8()
g := make([]int32, n)
f(a, b, k).AsInt32x8().StoreSlice(g)
w := want(x, y)
for i := range m {
if !m[i] {
w[i] = 0
}
}
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("m=%v", m) })
})
}
// testUint64x4CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testUint64x4CompareMasked(t *testing.T,
@ -517,30 +517,6 @@ func testInt8x64CompareMasked(t *testing.T,
})
}
// testUint8x64CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testUint8x64CompareMasked(t *testing.T,
f func(_, _ simd.Uint8x64, m simd.Mask8x64) simd.Mask8x64,
want func(_, _ []uint8) []int64) {
n := 64
t.Helper()
forSlicePairMasked(t, uint8s, n, func(x, y []uint8, m []bool) bool {
t.Helper()
a := simd.LoadUint8x64Slice(x)
b := simd.LoadUint8x64Slice(y)
k := simd.LoadInt8x64Slice(toVect[int8](m)).AsMask8x64()
g := make([]int8, n)
f(a, b, k).AsInt8x64().StoreSlice(g)
w := want(x, y)
for i := range m {
if !m[i] {
w[i] = 0
}
}
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("m=%v", m) })
})
}
// testInt16x32CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testInt16x32CompareMasked(t *testing.T,
@ -565,30 +541,6 @@ func testInt16x32CompareMasked(t *testing.T,
})
}
// testUint16x32CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testUint16x32CompareMasked(t *testing.T,
f func(_, _ simd.Uint16x32, m simd.Mask16x32) simd.Mask16x32,
want func(_, _ []uint16) []int64) {
n := 32
t.Helper()
forSlicePairMasked(t, uint16s, n, func(x, y []uint16, m []bool) bool {
t.Helper()
a := simd.LoadUint16x32Slice(x)
b := simd.LoadUint16x32Slice(y)
k := simd.LoadInt16x32Slice(toVect[int16](m)).AsMask16x32()
g := make([]int16, n)
f(a, b, k).AsInt16x32().StoreSlice(g)
w := want(x, y)
for i := range m {
if !m[i] {
w[i] = 0
}
}
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("m=%v", m) })
})
}
// testInt32x16CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testInt32x16CompareMasked(t *testing.T,
@ -613,30 +565,6 @@ func testInt32x16CompareMasked(t *testing.T,
})
}
// testUint32x16CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testUint32x16CompareMasked(t *testing.T,
f func(_, _ simd.Uint32x16, m simd.Mask32x16) simd.Mask32x16,
want func(_, _ []uint32) []int64) {
n := 16
t.Helper()
forSlicePairMasked(t, uint32s, n, func(x, y []uint32, m []bool) bool {
t.Helper()
a := simd.LoadUint32x16Slice(x)
b := simd.LoadUint32x16Slice(y)
k := simd.LoadInt32x16Slice(toVect[int32](m)).AsMask32x16()
g := make([]int32, n)
f(a, b, k).AsInt32x16().StoreSlice(g)
w := want(x, y)
for i := range m {
if !m[i] {
w[i] = 0
}
}
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("m=%v", m) })
})
}
// testInt64x8CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testInt64x8CompareMasked(t *testing.T,
@ -661,6 +589,78 @@ func testInt64x8CompareMasked(t *testing.T,
})
}
// testUint8x64CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testUint8x64CompareMasked(t *testing.T,
f func(_, _ simd.Uint8x64, m simd.Mask8x64) simd.Mask8x64,
want func(_, _ []uint8) []int64) {
n := 64
t.Helper()
forSlicePairMasked(t, uint8s, n, func(x, y []uint8, m []bool) bool {
t.Helper()
a := simd.LoadUint8x64Slice(x)
b := simd.LoadUint8x64Slice(y)
k := simd.LoadInt8x64Slice(toVect[int8](m)).AsMask8x64()
g := make([]int8, n)
f(a, b, k).AsInt8x64().StoreSlice(g)
w := want(x, y)
for i := range m {
if !m[i] {
w[i] = 0
}
}
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("m=%v", m) })
})
}
// testUint16x32CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testUint16x32CompareMasked(t *testing.T,
f func(_, _ simd.Uint16x32, m simd.Mask16x32) simd.Mask16x32,
want func(_, _ []uint16) []int64) {
n := 32
t.Helper()
forSlicePairMasked(t, uint16s, n, func(x, y []uint16, m []bool) bool {
t.Helper()
a := simd.LoadUint16x32Slice(x)
b := simd.LoadUint16x32Slice(y)
k := simd.LoadInt16x32Slice(toVect[int16](m)).AsMask16x32()
g := make([]int16, n)
f(a, b, k).AsInt16x32().StoreSlice(g)
w := want(x, y)
for i := range m {
if !m[i] {
w[i] = 0
}
}
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("m=%v", m) })
})
}
// testUint32x16CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testUint32x16CompareMasked(t *testing.T,
f func(_, _ simd.Uint32x16, m simd.Mask32x16) simd.Mask32x16,
want func(_, _ []uint32) []int64) {
n := 16
t.Helper()
forSlicePairMasked(t, uint32s, n, func(x, y []uint32, m []bool) bool {
t.Helper()
a := simd.LoadUint32x16Slice(x)
b := simd.LoadUint32x16Slice(y)
k := simd.LoadInt32x16Slice(toVect[int32](m)).AsMask32x16()
g := make([]int32, n)
f(a, b, k).AsInt32x16().StoreSlice(g)
w := want(x, y)
for i := range m {
if !m[i] {
w[i] = 0
}
}
return checkSlicesLogInput(t, s64(g), w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("m=%v", m) })
})
}
// testUint64x8CompareMasked tests the simd masked comparison method f against the expected behavior generated by want
// The mask is applied to the output of want; anything not in the mask, is zeroed.
func testUint64x8CompareMasked(t *testing.T,

View file

@ -20,6 +20,34 @@ import (
"text/template"
)
// shapes describes a combination of vector widths and various element types
type shapes struct {
vecs []int // Vector bit width for this shape.
ints []int // Int element bit width(s) for this shape
uints []int // Unsigned int element bit width(s) for this shape
floats []int // Float element bit width(s) for this shape
}
// shapeAndTemplate is a template and the set of shapes on which it will be expanded
type shapeAndTemplate struct {
s *shapes
t *template.Template
}
var allShapes = &shapes{
vecs: []int{128, 256, 512},
ints: []int{8, 16, 32, 64},
uints: []int{8, 16, 32, 64},
floats: []int{32, 64},
}
// these are the shapes that are currently converted to int32
// (not all conversions are available, yet)
var toInt32Shapes = &shapes{
vecs: []int{128, 256, 512},
floats: []int{32},
}
func oneTemplate(t *template.Template, baseType string, width, count int, out io.Writer) {
b := width * count
if b < 128 || b > 512 {
@ -34,12 +62,12 @@ func oneTemplate(t *template.Template, baseType string, width, count int, out io
aOrAn = "an"
}
t.Execute(out, struct {
Vec string
AOrAn string
Width int
Count int
WxC string
Type string
Vec string // the type of the vector, e.g. Float32x4
AOrAn string // for documentation, the article "a" or "an"
Width int // the bit width of the element type, e.g. 32
Count int // the number of elements, e.g. 4
WxC string // the width-by-type string, e.g., "32x4"
Type string // the element type, e.g. "float32"
}{
Vec: vType,
AOrAn: aOrAn,
@ -50,14 +78,21 @@ func oneTemplate(t *template.Template, baseType string, width, count int, out io
})
}
func forTemplates(t *template.Template, out io.Writer) {
vecs := []int{128, 256, 512}
ints := []int{8, 16, 32, 64}
floats := []int{32, 64}
// forTemplates expands the template sat.t for each shape
// in sat.s, writing to out.
func (sat shapeAndTemplate) forTemplates(out io.Writer) {
t, s := sat.t, sat.s
vecs := s.vecs
ints := s.ints
uints := s.uints
floats := s.floats
for _, v := range vecs {
for _, w := range ints {
c := v / w
oneTemplate(t, "int", w, c, out)
}
for _, w := range uints {
c := v / w
oneTemplate(t, "uint", w, c, out)
}
for _, w := range floats {
@ -114,8 +149,14 @@ func curryTestPrologue(t string) func(s string, out io.Writer) {
// x.Store((*[16]uint8)(s[:16]))
// }
func templateOf(name, temp string) *template.Template {
return template.Must(template.New(name).Parse(temp))
func templateOf(name, temp string) shapeAndTemplate {
return shapeAndTemplate{s: allShapes,
t: template.Must(template.New(name).Parse(temp))}
}
func shapedTemplateOf(s *shapes, name, temp string) shapeAndTemplate {
return shapeAndTemplate{s: s,
t: template.Must(template.New(name).Parse(temp))}
}
var sliceTemplate = templateOf("slice", `
@ -146,6 +187,22 @@ func test{{.Vec}}Unary(t *testing.T, f func(_ simd.{{.Vec}}) simd.{{.Vec}}, want
}
`)
var unaryTemplateToInt32 = shapedTemplateOf(toInt32Shapes, "unary_int32_helpers", `
// test{{.Vec}}Unary tests the simd unary method f against the expected behavior generated by want
func test{{.Vec}}UnaryToInt32(t *testing.T, f func(x simd.{{.Vec}}) simd.Int32x{{.Count}}, want func(x []{{.Type}}) []int32) {
n := {{.Count}}
t.Helper()
forSlice(t, {{.Type}}s, n, func(x []{{.Type}}) bool {
t.Helper()
a := simd.Load{{.Vec}}Slice(x)
g := make([]int32, n)
f(a).StoreSlice(g)
w := want(x)
return checkSlicesLogInput(t, g, w, func() {t.Helper(); t.Logf("x=%v", x)})
})
}
`)
var binaryTemplate = templateOf("binary_helpers", `
// test{{.Vec}}Binary tests the simd binary method f against the expected behavior generated by want
func test{{.Vec}}Binary(t *testing.T, f func(_, _ simd.{{.Vec}}) simd.{{.Vec}}, want func(_, _ []{{.Type}}) []{{.Type}}) {
@ -254,7 +311,7 @@ func main() {
}
}
func one(filename string, prologue func(s string, out io.Writer), t *template.Template) {
func one(filename string, prologue func(s string, out io.Writer), sats ...shapeAndTemplate) {
if filename == "" {
return
}
@ -273,7 +330,9 @@ func one(filename string, prologue func(s string, out io.Writer), t *template.Te
out := new(bytes.Buffer)
prologue("go run genfiles.go", out)
forTemplates(t, out)
for _, sat := range sats {
sat.forTemplates(out)
}
b, err := format.Source(out.Bytes())
if err != nil {

View file

@ -14,16 +14,6 @@ func (x Int8x16) StoreSlice(s []int8) {
x.Store((*[16]int8)(s))
}
// LoadUint8x16Slice loads an Uint8x16 from a slice of at least 16 uint8s
func LoadUint8x16Slice(s []uint8) Uint8x16 {
return LoadUint8x16((*[16]uint8)(s))
}
// StoreSlice stores x into a slice of at least 16 uint8s
func (x Uint8x16) StoreSlice(s []uint8) {
x.Store((*[16]uint8)(s))
}
// LoadInt16x8Slice loads an Int16x8 from a slice of at least 8 int16s
func LoadInt16x8Slice(s []int16) Int16x8 {
return LoadInt16x8((*[8]int16)(s))
@ -34,16 +24,6 @@ func (x Int16x8) StoreSlice(s []int16) {
x.Store((*[8]int16)(s))
}
// LoadUint16x8Slice loads an Uint16x8 from a slice of at least 8 uint16s
func LoadUint16x8Slice(s []uint16) Uint16x8 {
return LoadUint16x8((*[8]uint16)(s))
}
// StoreSlice stores x into a slice of at least 8 uint16s
func (x Uint16x8) StoreSlice(s []uint16) {
x.Store((*[8]uint16)(s))
}
// LoadInt32x4Slice loads an Int32x4 from a slice of at least 4 int32s
func LoadInt32x4Slice(s []int32) Int32x4 {
return LoadInt32x4((*[4]int32)(s))
@ -54,16 +34,6 @@ func (x Int32x4) StoreSlice(s []int32) {
x.Store((*[4]int32)(s))
}
// LoadUint32x4Slice loads an Uint32x4 from a slice of at least 4 uint32s
func LoadUint32x4Slice(s []uint32) Uint32x4 {
return LoadUint32x4((*[4]uint32)(s))
}
// StoreSlice stores x into a slice of at least 4 uint32s
func (x Uint32x4) StoreSlice(s []uint32) {
x.Store((*[4]uint32)(s))
}
// LoadInt64x2Slice loads an Int64x2 from a slice of at least 2 int64s
func LoadInt64x2Slice(s []int64) Int64x2 {
return LoadInt64x2((*[2]int64)(s))
@ -74,6 +44,36 @@ func (x Int64x2) StoreSlice(s []int64) {
x.Store((*[2]int64)(s))
}
// LoadUint8x16Slice loads an Uint8x16 from a slice of at least 16 uint8s
func LoadUint8x16Slice(s []uint8) Uint8x16 {
return LoadUint8x16((*[16]uint8)(s))
}
// StoreSlice stores x into a slice of at least 16 uint8s
func (x Uint8x16) StoreSlice(s []uint8) {
x.Store((*[16]uint8)(s))
}
// LoadUint16x8Slice loads an Uint16x8 from a slice of at least 8 uint16s
func LoadUint16x8Slice(s []uint16) Uint16x8 {
return LoadUint16x8((*[8]uint16)(s))
}
// StoreSlice stores x into a slice of at least 8 uint16s
func (x Uint16x8) StoreSlice(s []uint16) {
x.Store((*[8]uint16)(s))
}
// LoadUint32x4Slice loads an Uint32x4 from a slice of at least 4 uint32s
func LoadUint32x4Slice(s []uint32) Uint32x4 {
return LoadUint32x4((*[4]uint32)(s))
}
// StoreSlice stores x into a slice of at least 4 uint32s
func (x Uint32x4) StoreSlice(s []uint32) {
x.Store((*[4]uint32)(s))
}
// LoadUint64x2Slice loads an Uint64x2 from a slice of at least 2 uint64s
func LoadUint64x2Slice(s []uint64) Uint64x2 {
return LoadUint64x2((*[2]uint64)(s))
@ -114,16 +114,6 @@ func (x Int8x32) StoreSlice(s []int8) {
x.Store((*[32]int8)(s))
}
// LoadUint8x32Slice loads an Uint8x32 from a slice of at least 32 uint8s
func LoadUint8x32Slice(s []uint8) Uint8x32 {
return LoadUint8x32((*[32]uint8)(s))
}
// StoreSlice stores x into a slice of at least 32 uint8s
func (x Uint8x32) StoreSlice(s []uint8) {
x.Store((*[32]uint8)(s))
}
// LoadInt16x16Slice loads an Int16x16 from a slice of at least 16 int16s
func LoadInt16x16Slice(s []int16) Int16x16 {
return LoadInt16x16((*[16]int16)(s))
@ -134,16 +124,6 @@ func (x Int16x16) StoreSlice(s []int16) {
x.Store((*[16]int16)(s))
}
// LoadUint16x16Slice loads an Uint16x16 from a slice of at least 16 uint16s
func LoadUint16x16Slice(s []uint16) Uint16x16 {
return LoadUint16x16((*[16]uint16)(s))
}
// StoreSlice stores x into a slice of at least 16 uint16s
func (x Uint16x16) StoreSlice(s []uint16) {
x.Store((*[16]uint16)(s))
}
// LoadInt32x8Slice loads an Int32x8 from a slice of at least 8 int32s
func LoadInt32x8Slice(s []int32) Int32x8 {
return LoadInt32x8((*[8]int32)(s))
@ -154,16 +134,6 @@ func (x Int32x8) StoreSlice(s []int32) {
x.Store((*[8]int32)(s))
}
// LoadUint32x8Slice loads an Uint32x8 from a slice of at least 8 uint32s
func LoadUint32x8Slice(s []uint32) Uint32x8 {
return LoadUint32x8((*[8]uint32)(s))
}
// StoreSlice stores x into a slice of at least 8 uint32s
func (x Uint32x8) StoreSlice(s []uint32) {
x.Store((*[8]uint32)(s))
}
// LoadInt64x4Slice loads an Int64x4 from a slice of at least 4 int64s
func LoadInt64x4Slice(s []int64) Int64x4 {
return LoadInt64x4((*[4]int64)(s))
@ -174,6 +144,36 @@ func (x Int64x4) StoreSlice(s []int64) {
x.Store((*[4]int64)(s))
}
// LoadUint8x32Slice loads an Uint8x32 from a slice of at least 32 uint8s
func LoadUint8x32Slice(s []uint8) Uint8x32 {
return LoadUint8x32((*[32]uint8)(s))
}
// StoreSlice stores x into a slice of at least 32 uint8s
func (x Uint8x32) StoreSlice(s []uint8) {
x.Store((*[32]uint8)(s))
}
// LoadUint16x16Slice loads an Uint16x16 from a slice of at least 16 uint16s
func LoadUint16x16Slice(s []uint16) Uint16x16 {
return LoadUint16x16((*[16]uint16)(s))
}
// StoreSlice stores x into a slice of at least 16 uint16s
func (x Uint16x16) StoreSlice(s []uint16) {
x.Store((*[16]uint16)(s))
}
// LoadUint32x8Slice loads an Uint32x8 from a slice of at least 8 uint32s
func LoadUint32x8Slice(s []uint32) Uint32x8 {
return LoadUint32x8((*[8]uint32)(s))
}
// StoreSlice stores x into a slice of at least 8 uint32s
func (x Uint32x8) StoreSlice(s []uint32) {
x.Store((*[8]uint32)(s))
}
// LoadUint64x4Slice loads an Uint64x4 from a slice of at least 4 uint64s
func LoadUint64x4Slice(s []uint64) Uint64x4 {
return LoadUint64x4((*[4]uint64)(s))
@ -214,16 +214,6 @@ func (x Int8x64) StoreSlice(s []int8) {
x.Store((*[64]int8)(s))
}
// LoadUint8x64Slice loads an Uint8x64 from a slice of at least 64 uint8s
func LoadUint8x64Slice(s []uint8) Uint8x64 {
return LoadUint8x64((*[64]uint8)(s))
}
// StoreSlice stores x into a slice of at least 64 uint8s
func (x Uint8x64) StoreSlice(s []uint8) {
x.Store((*[64]uint8)(s))
}
// LoadInt16x32Slice loads an Int16x32 from a slice of at least 32 int16s
func LoadInt16x32Slice(s []int16) Int16x32 {
return LoadInt16x32((*[32]int16)(s))
@ -234,16 +224,6 @@ func (x Int16x32) StoreSlice(s []int16) {
x.Store((*[32]int16)(s))
}
// LoadUint16x32Slice loads an Uint16x32 from a slice of at least 32 uint16s
func LoadUint16x32Slice(s []uint16) Uint16x32 {
return LoadUint16x32((*[32]uint16)(s))
}
// StoreSlice stores x into a slice of at least 32 uint16s
func (x Uint16x32) StoreSlice(s []uint16) {
x.Store((*[32]uint16)(s))
}
// LoadInt32x16Slice loads an Int32x16 from a slice of at least 16 int32s
func LoadInt32x16Slice(s []int32) Int32x16 {
return LoadInt32x16((*[16]int32)(s))
@ -254,16 +234,6 @@ func (x Int32x16) StoreSlice(s []int32) {
x.Store((*[16]int32)(s))
}
// LoadUint32x16Slice loads an Uint32x16 from a slice of at least 16 uint32s
func LoadUint32x16Slice(s []uint32) Uint32x16 {
return LoadUint32x16((*[16]uint32)(s))
}
// StoreSlice stores x into a slice of at least 16 uint32s
func (x Uint32x16) StoreSlice(s []uint32) {
x.Store((*[16]uint32)(s))
}
// LoadInt64x8Slice loads an Int64x8 from a slice of at least 8 int64s
func LoadInt64x8Slice(s []int64) Int64x8 {
return LoadInt64x8((*[8]int64)(s))
@ -274,6 +244,36 @@ func (x Int64x8) StoreSlice(s []int64) {
x.Store((*[8]int64)(s))
}
// LoadUint8x64Slice loads an Uint8x64 from a slice of at least 64 uint8s
func LoadUint8x64Slice(s []uint8) Uint8x64 {
return LoadUint8x64((*[64]uint8)(s))
}
// StoreSlice stores x into a slice of at least 64 uint8s
func (x Uint8x64) StoreSlice(s []uint8) {
x.Store((*[64]uint8)(s))
}
// LoadUint16x32Slice loads an Uint16x32 from a slice of at least 32 uint16s
func LoadUint16x32Slice(s []uint16) Uint16x32 {
return LoadUint16x32((*[32]uint16)(s))
}
// StoreSlice stores x into a slice of at least 32 uint16s
func (x Uint16x32) StoreSlice(s []uint16) {
x.Store((*[32]uint16)(s))
}
// LoadUint32x16Slice loads an Uint32x16 from a slice of at least 16 uint32s
func LoadUint32x16Slice(s []uint32) Uint32x16 {
return LoadUint32x16((*[16]uint32)(s))
}
// StoreSlice stores x into a slice of at least 16 uint32s
func (x Uint32x16) StoreSlice(s []uint32) {
x.Store((*[16]uint32)(s))
}
// LoadUint64x8Slice loads an Uint64x8 from a slice of at least 8 uint64s
func LoadUint64x8Slice(s []uint64) Uint64x8 {
return LoadUint64x8((*[8]uint64)(s))

View file

@ -29,22 +29,6 @@ func testInt8x16Ternary(t *testing.T, f func(_, _, _ simd.Int8x16) simd.Int8x16,
})
}
// testUint8x16Ternary tests the simd ternary method f against the expected behavior generated by want
func testUint8x16Ternary(t *testing.T, f func(_, _, _ simd.Uint8x16) simd.Uint8x16, want func(_, _, _ []uint8) []uint8) {
n := 16
t.Helper()
forSliceTriple(t, uint8s, n, func(x, y, z []uint8) bool {
t.Helper()
a := simd.LoadUint8x16Slice(x)
b := simd.LoadUint8x16Slice(y)
c := simd.LoadUint8x16Slice(z)
g := make([]uint8, n)
f(a, b, c).StoreSlice(g)
w := want(x, y, z)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
})
}
// testInt16x8Ternary tests the simd ternary method f against the expected behavior generated by want
func testInt16x8Ternary(t *testing.T, f func(_, _, _ simd.Int16x8) simd.Int16x8, want func(_, _, _ []int16) []int16) {
n := 8
@ -61,22 +45,6 @@ func testInt16x8Ternary(t *testing.T, f func(_, _, _ simd.Int16x8) simd.Int16x8,
})
}
// testUint16x8Ternary tests the simd ternary method f against the expected behavior generated by want
func testUint16x8Ternary(t *testing.T, f func(_, _, _ simd.Uint16x8) simd.Uint16x8, want func(_, _, _ []uint16) []uint16) {
n := 8
t.Helper()
forSliceTriple(t, uint16s, n, func(x, y, z []uint16) bool {
t.Helper()
a := simd.LoadUint16x8Slice(x)
b := simd.LoadUint16x8Slice(y)
c := simd.LoadUint16x8Slice(z)
g := make([]uint16, n)
f(a, b, c).StoreSlice(g)
w := want(x, y, z)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
})
}
// testInt32x4Ternary tests the simd ternary method f against the expected behavior generated by want
func testInt32x4Ternary(t *testing.T, f func(_, _, _ simd.Int32x4) simd.Int32x4, want func(_, _, _ []int32) []int32) {
n := 4
@ -93,22 +61,6 @@ func testInt32x4Ternary(t *testing.T, f func(_, _, _ simd.Int32x4) simd.Int32x4,
})
}
// testUint32x4Ternary tests the simd ternary method f against the expected behavior generated by want
func testUint32x4Ternary(t *testing.T, f func(_, _, _ simd.Uint32x4) simd.Uint32x4, want func(_, _, _ []uint32) []uint32) {
n := 4
t.Helper()
forSliceTriple(t, uint32s, n, func(x, y, z []uint32) bool {
t.Helper()
a := simd.LoadUint32x4Slice(x)
b := simd.LoadUint32x4Slice(y)
c := simd.LoadUint32x4Slice(z)
g := make([]uint32, n)
f(a, b, c).StoreSlice(g)
w := want(x, y, z)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
})
}
// testInt64x2Ternary tests the simd ternary method f against the expected behavior generated by want
func testInt64x2Ternary(t *testing.T, f func(_, _, _ simd.Int64x2) simd.Int64x2, want func(_, _, _ []int64) []int64) {
n := 2
@ -125,6 +77,54 @@ func testInt64x2Ternary(t *testing.T, f func(_, _, _ simd.Int64x2) simd.Int64x2,
})
}
// testUint8x16Ternary tests the simd ternary method f against the expected behavior generated by want
func testUint8x16Ternary(t *testing.T, f func(_, _, _ simd.Uint8x16) simd.Uint8x16, want func(_, _, _ []uint8) []uint8) {
n := 16
t.Helper()
forSliceTriple(t, uint8s, n, func(x, y, z []uint8) bool {
t.Helper()
a := simd.LoadUint8x16Slice(x)
b := simd.LoadUint8x16Slice(y)
c := simd.LoadUint8x16Slice(z)
g := make([]uint8, n)
f(a, b, c).StoreSlice(g)
w := want(x, y, z)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
})
}
// testUint16x8Ternary tests the simd ternary method f against the expected behavior generated by want
func testUint16x8Ternary(t *testing.T, f func(_, _, _ simd.Uint16x8) simd.Uint16x8, want func(_, _, _ []uint16) []uint16) {
n := 8
t.Helper()
forSliceTriple(t, uint16s, n, func(x, y, z []uint16) bool {
t.Helper()
a := simd.LoadUint16x8Slice(x)
b := simd.LoadUint16x8Slice(y)
c := simd.LoadUint16x8Slice(z)
g := make([]uint16, n)
f(a, b, c).StoreSlice(g)
w := want(x, y, z)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
})
}
// testUint32x4Ternary tests the simd ternary method f against the expected behavior generated by want
func testUint32x4Ternary(t *testing.T, f func(_, _, _ simd.Uint32x4) simd.Uint32x4, want func(_, _, _ []uint32) []uint32) {
n := 4
t.Helper()
forSliceTriple(t, uint32s, n, func(x, y, z []uint32) bool {
t.Helper()
a := simd.LoadUint32x4Slice(x)
b := simd.LoadUint32x4Slice(y)
c := simd.LoadUint32x4Slice(z)
g := make([]uint32, n)
f(a, b, c).StoreSlice(g)
w := want(x, y, z)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
})
}
// testUint64x2Ternary tests the simd ternary method f against the expected behavior generated by want
func testUint64x2Ternary(t *testing.T, f func(_, _, _ simd.Uint64x2) simd.Uint64x2, want func(_, _, _ []uint64) []uint64) {
n := 2
@ -189,22 +189,6 @@ func testInt8x32Ternary(t *testing.T, f func(_, _, _ simd.Int8x32) simd.Int8x32,
})
}
// testUint8x32Ternary tests the simd ternary method f against the expected behavior generated by want
func testUint8x32Ternary(t *testing.T, f func(_, _, _ simd.Uint8x32) simd.Uint8x32, want func(_, _, _ []uint8) []uint8) {
n := 32
t.Helper()
forSliceTriple(t, uint8s, n, func(x, y, z []uint8) bool {
t.Helper()
a := simd.LoadUint8x32Slice(x)
b := simd.LoadUint8x32Slice(y)
c := simd.LoadUint8x32Slice(z)
g := make([]uint8, n)
f(a, b, c).StoreSlice(g)
w := want(x, y, z)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
})
}
// testInt16x16Ternary tests the simd ternary method f against the expected behavior generated by want
func testInt16x16Ternary(t *testing.T, f func(_, _, _ simd.Int16x16) simd.Int16x16, want func(_, _, _ []int16) []int16) {
n := 16
@ -221,22 +205,6 @@ func testInt16x16Ternary(t *testing.T, f func(_, _, _ simd.Int16x16) simd.Int16x
})
}
// testUint16x16Ternary tests the simd ternary method f against the expected behavior generated by want
func testUint16x16Ternary(t *testing.T, f func(_, _, _ simd.Uint16x16) simd.Uint16x16, want func(_, _, _ []uint16) []uint16) {
n := 16
t.Helper()
forSliceTriple(t, uint16s, n, func(x, y, z []uint16) bool {
t.Helper()
a := simd.LoadUint16x16Slice(x)
b := simd.LoadUint16x16Slice(y)
c := simd.LoadUint16x16Slice(z)
g := make([]uint16, n)
f(a, b, c).StoreSlice(g)
w := want(x, y, z)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
})
}
// testInt32x8Ternary tests the simd ternary method f against the expected behavior generated by want
func testInt32x8Ternary(t *testing.T, f func(_, _, _ simd.Int32x8) simd.Int32x8, want func(_, _, _ []int32) []int32) {
n := 8
@ -253,22 +221,6 @@ func testInt32x8Ternary(t *testing.T, f func(_, _, _ simd.Int32x8) simd.Int32x8,
})
}
// testUint32x8Ternary tests the simd ternary method f against the expected behavior generated by want
func testUint32x8Ternary(t *testing.T, f func(_, _, _ simd.Uint32x8) simd.Uint32x8, want func(_, _, _ []uint32) []uint32) {
n := 8
t.Helper()
forSliceTriple(t, uint32s, n, func(x, y, z []uint32) bool {
t.Helper()
a := simd.LoadUint32x8Slice(x)
b := simd.LoadUint32x8Slice(y)
c := simd.LoadUint32x8Slice(z)
g := make([]uint32, n)
f(a, b, c).StoreSlice(g)
w := want(x, y, z)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
})
}
// testInt64x4Ternary tests the simd ternary method f against the expected behavior generated by want
func testInt64x4Ternary(t *testing.T, f func(_, _, _ simd.Int64x4) simd.Int64x4, want func(_, _, _ []int64) []int64) {
n := 4
@ -285,6 +237,54 @@ func testInt64x4Ternary(t *testing.T, f func(_, _, _ simd.Int64x4) simd.Int64x4,
})
}
// testUint8x32Ternary tests the simd ternary method f against the expected behavior generated by want
func testUint8x32Ternary(t *testing.T, f func(_, _, _ simd.Uint8x32) simd.Uint8x32, want func(_, _, _ []uint8) []uint8) {
n := 32
t.Helper()
forSliceTriple(t, uint8s, n, func(x, y, z []uint8) bool {
t.Helper()
a := simd.LoadUint8x32Slice(x)
b := simd.LoadUint8x32Slice(y)
c := simd.LoadUint8x32Slice(z)
g := make([]uint8, n)
f(a, b, c).StoreSlice(g)
w := want(x, y, z)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
})
}
// testUint16x16Ternary tests the simd ternary method f against the expected behavior generated by want
func testUint16x16Ternary(t *testing.T, f func(_, _, _ simd.Uint16x16) simd.Uint16x16, want func(_, _, _ []uint16) []uint16) {
n := 16
t.Helper()
forSliceTriple(t, uint16s, n, func(x, y, z []uint16) bool {
t.Helper()
a := simd.LoadUint16x16Slice(x)
b := simd.LoadUint16x16Slice(y)
c := simd.LoadUint16x16Slice(z)
g := make([]uint16, n)
f(a, b, c).StoreSlice(g)
w := want(x, y, z)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
})
}
// testUint32x8Ternary tests the simd ternary method f against the expected behavior generated by want
func testUint32x8Ternary(t *testing.T, f func(_, _, _ simd.Uint32x8) simd.Uint32x8, want func(_, _, _ []uint32) []uint32) {
n := 8
t.Helper()
forSliceTriple(t, uint32s, n, func(x, y, z []uint32) bool {
t.Helper()
a := simd.LoadUint32x8Slice(x)
b := simd.LoadUint32x8Slice(y)
c := simd.LoadUint32x8Slice(z)
g := make([]uint32, n)
f(a, b, c).StoreSlice(g)
w := want(x, y, z)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
})
}
// testUint64x4Ternary tests the simd ternary method f against the expected behavior generated by want
func testUint64x4Ternary(t *testing.T, f func(_, _, _ simd.Uint64x4) simd.Uint64x4, want func(_, _, _ []uint64) []uint64) {
n := 4
@ -349,22 +349,6 @@ func testInt8x64Ternary(t *testing.T, f func(_, _, _ simd.Int8x64) simd.Int8x64,
})
}
// testUint8x64Ternary tests the simd ternary method f against the expected behavior generated by want
func testUint8x64Ternary(t *testing.T, f func(_, _, _ simd.Uint8x64) simd.Uint8x64, want func(_, _, _ []uint8) []uint8) {
n := 64
t.Helper()
forSliceTriple(t, uint8s, n, func(x, y, z []uint8) bool {
t.Helper()
a := simd.LoadUint8x64Slice(x)
b := simd.LoadUint8x64Slice(y)
c := simd.LoadUint8x64Slice(z)
g := make([]uint8, n)
f(a, b, c).StoreSlice(g)
w := want(x, y, z)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
})
}
// testInt16x32Ternary tests the simd ternary method f against the expected behavior generated by want
func testInt16x32Ternary(t *testing.T, f func(_, _, _ simd.Int16x32) simd.Int16x32, want func(_, _, _ []int16) []int16) {
n := 32
@ -381,22 +365,6 @@ func testInt16x32Ternary(t *testing.T, f func(_, _, _ simd.Int16x32) simd.Int16x
})
}
// testUint16x32Ternary tests the simd ternary method f against the expected behavior generated by want
func testUint16x32Ternary(t *testing.T, f func(_, _, _ simd.Uint16x32) simd.Uint16x32, want func(_, _, _ []uint16) []uint16) {
n := 32
t.Helper()
forSliceTriple(t, uint16s, n, func(x, y, z []uint16) bool {
t.Helper()
a := simd.LoadUint16x32Slice(x)
b := simd.LoadUint16x32Slice(y)
c := simd.LoadUint16x32Slice(z)
g := make([]uint16, n)
f(a, b, c).StoreSlice(g)
w := want(x, y, z)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
})
}
// testInt32x16Ternary tests the simd ternary method f against the expected behavior generated by want
func testInt32x16Ternary(t *testing.T, f func(_, _, _ simd.Int32x16) simd.Int32x16, want func(_, _, _ []int32) []int32) {
n := 16
@ -413,22 +381,6 @@ func testInt32x16Ternary(t *testing.T, f func(_, _, _ simd.Int32x16) simd.Int32x
})
}
// testUint32x16Ternary tests the simd ternary method f against the expected behavior generated by want
func testUint32x16Ternary(t *testing.T, f func(_, _, _ simd.Uint32x16) simd.Uint32x16, want func(_, _, _ []uint32) []uint32) {
n := 16
t.Helper()
forSliceTriple(t, uint32s, n, func(x, y, z []uint32) bool {
t.Helper()
a := simd.LoadUint32x16Slice(x)
b := simd.LoadUint32x16Slice(y)
c := simd.LoadUint32x16Slice(z)
g := make([]uint32, n)
f(a, b, c).StoreSlice(g)
w := want(x, y, z)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
})
}
// testInt64x8Ternary tests the simd ternary method f against the expected behavior generated by want
func testInt64x8Ternary(t *testing.T, f func(_, _, _ simd.Int64x8) simd.Int64x8, want func(_, _, _ []int64) []int64) {
n := 8
@ -445,6 +397,54 @@ func testInt64x8Ternary(t *testing.T, f func(_, _, _ simd.Int64x8) simd.Int64x8,
})
}
// testUint8x64Ternary tests the simd ternary method f against the expected behavior generated by want
func testUint8x64Ternary(t *testing.T, f func(_, _, _ simd.Uint8x64) simd.Uint8x64, want func(_, _, _ []uint8) []uint8) {
n := 64
t.Helper()
forSliceTriple(t, uint8s, n, func(x, y, z []uint8) bool {
t.Helper()
a := simd.LoadUint8x64Slice(x)
b := simd.LoadUint8x64Slice(y)
c := simd.LoadUint8x64Slice(z)
g := make([]uint8, n)
f(a, b, c).StoreSlice(g)
w := want(x, y, z)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
})
}
// testUint16x32Ternary tests the simd ternary method f against the expected behavior generated by want
func testUint16x32Ternary(t *testing.T, f func(_, _, _ simd.Uint16x32) simd.Uint16x32, want func(_, _, _ []uint16) []uint16) {
n := 32
t.Helper()
forSliceTriple(t, uint16s, n, func(x, y, z []uint16) bool {
t.Helper()
a := simd.LoadUint16x32Slice(x)
b := simd.LoadUint16x32Slice(y)
c := simd.LoadUint16x32Slice(z)
g := make([]uint16, n)
f(a, b, c).StoreSlice(g)
w := want(x, y, z)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
})
}
// testUint32x16Ternary tests the simd ternary method f against the expected behavior generated by want
func testUint32x16Ternary(t *testing.T, f func(_, _, _ simd.Uint32x16) simd.Uint32x16, want func(_, _, _ []uint32) []uint32) {
n := 16
t.Helper()
forSliceTriple(t, uint32s, n, func(x, y, z []uint32) bool {
t.Helper()
a := simd.LoadUint32x16Slice(x)
b := simd.LoadUint32x16Slice(y)
c := simd.LoadUint32x16Slice(z)
g := make([]uint32, n)
f(a, b, c).StoreSlice(g)
w := want(x, y, z)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
})
}
// testUint64x8Ternary tests the simd ternary method f against the expected behavior generated by want
func testUint64x8Ternary(t *testing.T, f func(_, _, _ simd.Uint64x8) simd.Uint64x8, want func(_, _, _ []uint64) []uint64) {
n := 8

View file

@ -27,20 +27,6 @@ func testInt8x16Unary(t *testing.T, f func(_ simd.Int8x16) simd.Int8x16, want fu
})
}
// testUint8x16Unary tests the simd unary method f against the expected behavior generated by want
func testUint8x16Unary(t *testing.T, f func(_ simd.Uint8x16) simd.Uint8x16, want func(_ []uint8) []uint8) {
n := 16
t.Helper()
forSlice(t, uint8s, n, func(x []uint8) bool {
t.Helper()
a := simd.LoadUint8x16Slice(x)
g := make([]uint8, n)
f(a).StoreSlice(g)
w := want(x)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x) })
})
}
// testInt16x8Unary tests the simd unary method f against the expected behavior generated by want
func testInt16x8Unary(t *testing.T, f func(_ simd.Int16x8) simd.Int16x8, want func(_ []int16) []int16) {
n := 8
@ -55,20 +41,6 @@ func testInt16x8Unary(t *testing.T, f func(_ simd.Int16x8) simd.Int16x8, want fu
})
}
// testUint16x8Unary tests the simd unary method f against the expected behavior generated by want
func testUint16x8Unary(t *testing.T, f func(_ simd.Uint16x8) simd.Uint16x8, want func(_ []uint16) []uint16) {
n := 8
t.Helper()
forSlice(t, uint16s, n, func(x []uint16) bool {
t.Helper()
a := simd.LoadUint16x8Slice(x)
g := make([]uint16, n)
f(a).StoreSlice(g)
w := want(x)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x) })
})
}
// testInt32x4Unary tests the simd unary method f against the expected behavior generated by want
func testInt32x4Unary(t *testing.T, f func(_ simd.Int32x4) simd.Int32x4, want func(_ []int32) []int32) {
n := 4
@ -83,20 +55,6 @@ func testInt32x4Unary(t *testing.T, f func(_ simd.Int32x4) simd.Int32x4, want fu
})
}
// testUint32x4Unary tests the simd unary method f against the expected behavior generated by want
func testUint32x4Unary(t *testing.T, f func(_ simd.Uint32x4) simd.Uint32x4, want func(_ []uint32) []uint32) {
n := 4
t.Helper()
forSlice(t, uint32s, n, func(x []uint32) bool {
t.Helper()
a := simd.LoadUint32x4Slice(x)
g := make([]uint32, n)
f(a).StoreSlice(g)
w := want(x)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x) })
})
}
// testInt64x2Unary tests the simd unary method f against the expected behavior generated by want
func testInt64x2Unary(t *testing.T, f func(_ simd.Int64x2) simd.Int64x2, want func(_ []int64) []int64) {
n := 2
@ -111,6 +69,48 @@ func testInt64x2Unary(t *testing.T, f func(_ simd.Int64x2) simd.Int64x2, want fu
})
}
// testUint8x16Unary tests the simd unary method f against the expected behavior generated by want
func testUint8x16Unary(t *testing.T, f func(_ simd.Uint8x16) simd.Uint8x16, want func(_ []uint8) []uint8) {
n := 16
t.Helper()
forSlice(t, uint8s, n, func(x []uint8) bool {
t.Helper()
a := simd.LoadUint8x16Slice(x)
g := make([]uint8, n)
f(a).StoreSlice(g)
w := want(x)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x) })
})
}
// testUint16x8Unary tests the simd unary method f against the expected behavior generated by want
func testUint16x8Unary(t *testing.T, f func(_ simd.Uint16x8) simd.Uint16x8, want func(_ []uint16) []uint16) {
n := 8
t.Helper()
forSlice(t, uint16s, n, func(x []uint16) bool {
t.Helper()
a := simd.LoadUint16x8Slice(x)
g := make([]uint16, n)
f(a).StoreSlice(g)
w := want(x)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x) })
})
}
// testUint32x4Unary tests the simd unary method f against the expected behavior generated by want
func testUint32x4Unary(t *testing.T, f func(_ simd.Uint32x4) simd.Uint32x4, want func(_ []uint32) []uint32) {
n := 4
t.Helper()
forSlice(t, uint32s, n, func(x []uint32) bool {
t.Helper()
a := simd.LoadUint32x4Slice(x)
g := make([]uint32, n)
f(a).StoreSlice(g)
w := want(x)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x) })
})
}
// testUint64x2Unary tests the simd unary method f against the expected behavior generated by want
func testUint64x2Unary(t *testing.T, f func(_ simd.Uint64x2) simd.Uint64x2, want func(_ []uint64) []uint64) {
n := 2
@ -167,20 +167,6 @@ func testInt8x32Unary(t *testing.T, f func(_ simd.Int8x32) simd.Int8x32, want fu
})
}
// testUint8x32Unary tests the simd unary method f against the expected behavior generated by want
func testUint8x32Unary(t *testing.T, f func(_ simd.Uint8x32) simd.Uint8x32, want func(_ []uint8) []uint8) {
n := 32
t.Helper()
forSlice(t, uint8s, n, func(x []uint8) bool {
t.Helper()
a := simd.LoadUint8x32Slice(x)
g := make([]uint8, n)
f(a).StoreSlice(g)
w := want(x)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x) })
})
}
// testInt16x16Unary tests the simd unary method f against the expected behavior generated by want
func testInt16x16Unary(t *testing.T, f func(_ simd.Int16x16) simd.Int16x16, want func(_ []int16) []int16) {
n := 16
@ -195,20 +181,6 @@ func testInt16x16Unary(t *testing.T, f func(_ simd.Int16x16) simd.Int16x16, want
})
}
// testUint16x16Unary tests the simd unary method f against the expected behavior generated by want
func testUint16x16Unary(t *testing.T, f func(_ simd.Uint16x16) simd.Uint16x16, want func(_ []uint16) []uint16) {
n := 16
t.Helper()
forSlice(t, uint16s, n, func(x []uint16) bool {
t.Helper()
a := simd.LoadUint16x16Slice(x)
g := make([]uint16, n)
f(a).StoreSlice(g)
w := want(x)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x) })
})
}
// testInt32x8Unary tests the simd unary method f against the expected behavior generated by want
func testInt32x8Unary(t *testing.T, f func(_ simd.Int32x8) simd.Int32x8, want func(_ []int32) []int32) {
n := 8
@ -223,20 +195,6 @@ func testInt32x8Unary(t *testing.T, f func(_ simd.Int32x8) simd.Int32x8, want fu
})
}
// testUint32x8Unary tests the simd unary method f against the expected behavior generated by want
func testUint32x8Unary(t *testing.T, f func(_ simd.Uint32x8) simd.Uint32x8, want func(_ []uint32) []uint32) {
n := 8
t.Helper()
forSlice(t, uint32s, n, func(x []uint32) bool {
t.Helper()
a := simd.LoadUint32x8Slice(x)
g := make([]uint32, n)
f(a).StoreSlice(g)
w := want(x)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x) })
})
}
// testInt64x4Unary tests the simd unary method f against the expected behavior generated by want
func testInt64x4Unary(t *testing.T, f func(_ simd.Int64x4) simd.Int64x4, want func(_ []int64) []int64) {
n := 4
@ -251,6 +209,48 @@ func testInt64x4Unary(t *testing.T, f func(_ simd.Int64x4) simd.Int64x4, want fu
})
}
// testUint8x32Unary tests the simd unary method f against the expected behavior generated by want
func testUint8x32Unary(t *testing.T, f func(_ simd.Uint8x32) simd.Uint8x32, want func(_ []uint8) []uint8) {
n := 32
t.Helper()
forSlice(t, uint8s, n, func(x []uint8) bool {
t.Helper()
a := simd.LoadUint8x32Slice(x)
g := make([]uint8, n)
f(a).StoreSlice(g)
w := want(x)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x) })
})
}
// testUint16x16Unary tests the simd unary method f against the expected behavior generated by want
func testUint16x16Unary(t *testing.T, f func(_ simd.Uint16x16) simd.Uint16x16, want func(_ []uint16) []uint16) {
n := 16
t.Helper()
forSlice(t, uint16s, n, func(x []uint16) bool {
t.Helper()
a := simd.LoadUint16x16Slice(x)
g := make([]uint16, n)
f(a).StoreSlice(g)
w := want(x)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x) })
})
}
// testUint32x8Unary tests the simd unary method f against the expected behavior generated by want
func testUint32x8Unary(t *testing.T, f func(_ simd.Uint32x8) simd.Uint32x8, want func(_ []uint32) []uint32) {
n := 8
t.Helper()
forSlice(t, uint32s, n, func(x []uint32) bool {
t.Helper()
a := simd.LoadUint32x8Slice(x)
g := make([]uint32, n)
f(a).StoreSlice(g)
w := want(x)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x) })
})
}
// testUint64x4Unary tests the simd unary method f against the expected behavior generated by want
func testUint64x4Unary(t *testing.T, f func(_ simd.Uint64x4) simd.Uint64x4, want func(_ []uint64) []uint64) {
n := 4
@ -307,20 +307,6 @@ func testInt8x64Unary(t *testing.T, f func(_ simd.Int8x64) simd.Int8x64, want fu
})
}
// testUint8x64Unary tests the simd unary method f against the expected behavior generated by want
func testUint8x64Unary(t *testing.T, f func(_ simd.Uint8x64) simd.Uint8x64, want func(_ []uint8) []uint8) {
n := 64
t.Helper()
forSlice(t, uint8s, n, func(x []uint8) bool {
t.Helper()
a := simd.LoadUint8x64Slice(x)
g := make([]uint8, n)
f(a).StoreSlice(g)
w := want(x)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x) })
})
}
// testInt16x32Unary tests the simd unary method f against the expected behavior generated by want
func testInt16x32Unary(t *testing.T, f func(_ simd.Int16x32) simd.Int16x32, want func(_ []int16) []int16) {
n := 32
@ -335,20 +321,6 @@ func testInt16x32Unary(t *testing.T, f func(_ simd.Int16x32) simd.Int16x32, want
})
}
// testUint16x32Unary tests the simd unary method f against the expected behavior generated by want
func testUint16x32Unary(t *testing.T, f func(_ simd.Uint16x32) simd.Uint16x32, want func(_ []uint16) []uint16) {
n := 32
t.Helper()
forSlice(t, uint16s, n, func(x []uint16) bool {
t.Helper()
a := simd.LoadUint16x32Slice(x)
g := make([]uint16, n)
f(a).StoreSlice(g)
w := want(x)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x) })
})
}
// testInt32x16Unary tests the simd unary method f against the expected behavior generated by want
func testInt32x16Unary(t *testing.T, f func(_ simd.Int32x16) simd.Int32x16, want func(_ []int32) []int32) {
n := 16
@ -363,20 +335,6 @@ func testInt32x16Unary(t *testing.T, f func(_ simd.Int32x16) simd.Int32x16, want
})
}
// testUint32x16Unary tests the simd unary method f against the expected behavior generated by want
func testUint32x16Unary(t *testing.T, f func(_ simd.Uint32x16) simd.Uint32x16, want func(_ []uint32) []uint32) {
n := 16
t.Helper()
forSlice(t, uint32s, n, func(x []uint32) bool {
t.Helper()
a := simd.LoadUint32x16Slice(x)
g := make([]uint32, n)
f(a).StoreSlice(g)
w := want(x)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x) })
})
}
// testInt64x8Unary tests the simd unary method f against the expected behavior generated by want
func testInt64x8Unary(t *testing.T, f func(_ simd.Int64x8) simd.Int64x8, want func(_ []int64) []int64) {
n := 8
@ -391,6 +349,48 @@ func testInt64x8Unary(t *testing.T, f func(_ simd.Int64x8) simd.Int64x8, want fu
})
}
// testUint8x64Unary tests the simd unary method f against the expected behavior generated by want
func testUint8x64Unary(t *testing.T, f func(_ simd.Uint8x64) simd.Uint8x64, want func(_ []uint8) []uint8) {
n := 64
t.Helper()
forSlice(t, uint8s, n, func(x []uint8) bool {
t.Helper()
a := simd.LoadUint8x64Slice(x)
g := make([]uint8, n)
f(a).StoreSlice(g)
w := want(x)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x) })
})
}
// testUint16x32Unary tests the simd unary method f against the expected behavior generated by want
func testUint16x32Unary(t *testing.T, f func(_ simd.Uint16x32) simd.Uint16x32, want func(_ []uint16) []uint16) {
n := 32
t.Helper()
forSlice(t, uint16s, n, func(x []uint16) bool {
t.Helper()
a := simd.LoadUint16x32Slice(x)
g := make([]uint16, n)
f(a).StoreSlice(g)
w := want(x)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x) })
})
}
// testUint32x16Unary tests the simd unary method f against the expected behavior generated by want
func testUint32x16Unary(t *testing.T, f func(_ simd.Uint32x16) simd.Uint32x16, want func(_ []uint32) []uint32) {
n := 16
t.Helper()
forSlice(t, uint32s, n, func(x []uint32) bool {
t.Helper()
a := simd.LoadUint32x16Slice(x)
g := make([]uint32, n)
f(a).StoreSlice(g)
w := want(x)
return checkSlicesLogInput(t, g, w, func() { t.Helper(); t.Logf("x=%v", x) })
})
}
// testUint64x8Unary tests the simd unary method f against the expected behavior generated by want
func testUint64x8Unary(t *testing.T, f func(_ simd.Uint64x8) simd.Uint64x8, want func(_ []uint64) []uint64) {
n := 8