mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[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:
parent
ec5c20ba5a
commit
a24ffe3379
7 changed files with 919 additions and 860 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue