blob: d9fbaca88da746f2776e297b0e3146041f492a76 [file]
// Code generated by 'tmplgen'; DO NOT EDIT.
//go:build goexperiment.simd && arm64
// This file contains functions testing shift simd methods.
// Each function in this file is specialized for a
// particular simd type <BaseType><Width>x<Count>.
package simd_test
import (
"simd/archsimd"
"testing"
)
// testInt8x16ShiftConst tests a const-shift method (unary + immediate).
func testInt8x16ShiftConst(t *testing.T, f func(_ archsimd.Int8x16, _ uint64) archsimd.Int8x16, want func(_ []int8, _ uint64) []int8) {
n := 16
t.Helper()
forSlice(t, int8s, n, func(x []int8) bool {
t.Helper()
for _, amt := range []uint64{0, 1, 3, 8 - 1} {
a := archsimd.LoadInt8x16(x)
g := make([]int8, n)
f(a, amt).Store(g)
w := want(x, amt)
if !checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v, amt=%d", x, amt) }) {
return false
}
}
return true
})
}
// testInt16x8ShiftConst tests a const-shift method (unary + immediate).
func testInt16x8ShiftConst(t *testing.T, f func(_ archsimd.Int16x8, _ uint64) archsimd.Int16x8, want func(_ []int16, _ uint64) []int16) {
n := 8
t.Helper()
forSlice(t, int16s, n, func(x []int16) bool {
t.Helper()
for _, amt := range []uint64{0, 1, 3, 16 - 1} {
a := archsimd.LoadInt16x8(x)
g := make([]int16, n)
f(a, amt).Store(g)
w := want(x, amt)
if !checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v, amt=%d", x, amt) }) {
return false
}
}
return true
})
}
// testInt32x4ShiftConst tests a const-shift method (unary + immediate).
func testInt32x4ShiftConst(t *testing.T, f func(_ archsimd.Int32x4, _ uint64) archsimd.Int32x4, want func(_ []int32, _ uint64) []int32) {
n := 4
t.Helper()
forSlice(t, int32s, n, func(x []int32) bool {
t.Helper()
for _, amt := range []uint64{0, 1, 3, 32 - 1} {
a := archsimd.LoadInt32x4(x)
g := make([]int32, n)
f(a, amt).Store(g)
w := want(x, amt)
if !checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v, amt=%d", x, amt) }) {
return false
}
}
return true
})
}
// testInt64x2ShiftConst tests a const-shift method (unary + immediate).
func testInt64x2ShiftConst(t *testing.T, f func(_ archsimd.Int64x2, _ uint64) archsimd.Int64x2, want func(_ []int64, _ uint64) []int64) {
n := 2
t.Helper()
forSlice(t, int64s, n, func(x []int64) bool {
t.Helper()
for _, amt := range []uint64{0, 1, 3, 64 - 1} {
a := archsimd.LoadInt64x2(x)
g := make([]int64, n)
f(a, amt).Store(g)
w := want(x, amt)
if !checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v, amt=%d", x, amt) }) {
return false
}
}
return true
})
}
// testUint8x16ShiftConst tests a const-shift method (unary + immediate).
func testUint8x16ShiftConst(t *testing.T, f func(_ archsimd.Uint8x16, _ uint64) archsimd.Uint8x16, want func(_ []uint8, _ uint64) []uint8) {
n := 16
t.Helper()
forSlice(t, uint8s, n, func(x []uint8) bool {
t.Helper()
for _, amt := range []uint64{0, 1, 3, 8 - 1} {
a := archsimd.LoadUint8x16(x)
g := make([]uint8, n)
f(a, amt).Store(g)
w := want(x, amt)
if !checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v, amt=%d", x, amt) }) {
return false
}
}
return true
})
}
// testUint16x8ShiftConst tests a const-shift method (unary + immediate).
func testUint16x8ShiftConst(t *testing.T, f func(_ archsimd.Uint16x8, _ uint64) archsimd.Uint16x8, want func(_ []uint16, _ uint64) []uint16) {
n := 8
t.Helper()
forSlice(t, uint16s, n, func(x []uint16) bool {
t.Helper()
for _, amt := range []uint64{0, 1, 3, 16 - 1} {
a := archsimd.LoadUint16x8(x)
g := make([]uint16, n)
f(a, amt).Store(g)
w := want(x, amt)
if !checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v, amt=%d", x, amt) }) {
return false
}
}
return true
})
}
// testUint32x4ShiftConst tests a const-shift method (unary + immediate).
func testUint32x4ShiftConst(t *testing.T, f func(_ archsimd.Uint32x4, _ uint64) archsimd.Uint32x4, want func(_ []uint32, _ uint64) []uint32) {
n := 4
t.Helper()
forSlice(t, uint32s, n, func(x []uint32) bool {
t.Helper()
for _, amt := range []uint64{0, 1, 3, 32 - 1} {
a := archsimd.LoadUint32x4(x)
g := make([]uint32, n)
f(a, amt).Store(g)
w := want(x, amt)
if !checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v, amt=%d", x, amt) }) {
return false
}
}
return true
})
}
// testUint64x2ShiftConst tests a const-shift method (unary + immediate).
func testUint64x2ShiftConst(t *testing.T, f func(_ archsimd.Uint64x2, _ uint64) archsimd.Uint64x2, want func(_ []uint64, _ uint64) []uint64) {
n := 2
t.Helper()
forSlice(t, uint64s, n, func(x []uint64) bool {
t.Helper()
for _, amt := range []uint64{0, 1, 3, 64 - 1} {
a := archsimd.LoadUint64x2(x)
g := make([]uint64, n)
f(a, amt).Store(g)
w := want(x, amt)
if !checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v, amt=%d", x, amt) }) {
return false
}
}
return true
})
}
// testInt8x16ShiftAll tests a shift-all method (unary + scalar uint64).
func testInt8x16ShiftAll(t *testing.T, f func(_ archsimd.Int8x16, _ uint64) archsimd.Int8x16, want func(_ []int8, _ uint64) []int8) {
n := 16
t.Helper()
forSlice(t, int8s, n, func(x []int8) bool {
t.Helper()
for _, amt := range testShiftAllAmts {
a := archsimd.LoadInt8x16(x)
g := make([]int8, n)
f(a, amt).Store(g)
w := want(x, amt)
if !checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v, amt=%d", x, amt) }) {
return false
}
}
return true
})
}
// testInt16x8ShiftAll tests a shift-all method (unary + scalar uint64).
func testInt16x8ShiftAll(t *testing.T, f func(_ archsimd.Int16x8, _ uint64) archsimd.Int16x8, want func(_ []int16, _ uint64) []int16) {
n := 8
t.Helper()
forSlice(t, int16s, n, func(x []int16) bool {
t.Helper()
for _, amt := range testShiftAllAmts {
a := archsimd.LoadInt16x8(x)
g := make([]int16, n)
f(a, amt).Store(g)
w := want(x, amt)
if !checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v, amt=%d", x, amt) }) {
return false
}
}
return true
})
}
// testInt32x4ShiftAll tests a shift-all method (unary + scalar uint64).
func testInt32x4ShiftAll(t *testing.T, f func(_ archsimd.Int32x4, _ uint64) archsimd.Int32x4, want func(_ []int32, _ uint64) []int32) {
n := 4
t.Helper()
forSlice(t, int32s, n, func(x []int32) bool {
t.Helper()
for _, amt := range testShiftAllAmts {
a := archsimd.LoadInt32x4(x)
g := make([]int32, n)
f(a, amt).Store(g)
w := want(x, amt)
if !checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v, amt=%d", x, amt) }) {
return false
}
}
return true
})
}
// testInt64x2ShiftAll tests a shift-all method (unary + scalar uint64).
func testInt64x2ShiftAll(t *testing.T, f func(_ archsimd.Int64x2, _ uint64) archsimd.Int64x2, want func(_ []int64, _ uint64) []int64) {
n := 2
t.Helper()
forSlice(t, int64s, n, func(x []int64) bool {
t.Helper()
for _, amt := range testShiftAllAmts {
a := archsimd.LoadInt64x2(x)
g := make([]int64, n)
f(a, amt).Store(g)
w := want(x, amt)
if !checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v, amt=%d", x, amt) }) {
return false
}
}
return true
})
}
// testUint8x16ShiftAll tests a shift-all method (unary + scalar uint64).
func testUint8x16ShiftAll(t *testing.T, f func(_ archsimd.Uint8x16, _ uint64) archsimd.Uint8x16, want func(_ []uint8, _ uint64) []uint8) {
n := 16
t.Helper()
forSlice(t, uint8s, n, func(x []uint8) bool {
t.Helper()
for _, amt := range testShiftAllAmts {
a := archsimd.LoadUint8x16(x)
g := make([]uint8, n)
f(a, amt).Store(g)
w := want(x, amt)
if !checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v, amt=%d", x, amt) }) {
return false
}
}
return true
})
}
// testUint16x8ShiftAll tests a shift-all method (unary + scalar uint64).
func testUint16x8ShiftAll(t *testing.T, f func(_ archsimd.Uint16x8, _ uint64) archsimd.Uint16x8, want func(_ []uint16, _ uint64) []uint16) {
n := 8
t.Helper()
forSlice(t, uint16s, n, func(x []uint16) bool {
t.Helper()
for _, amt := range testShiftAllAmts {
a := archsimd.LoadUint16x8(x)
g := make([]uint16, n)
f(a, amt).Store(g)
w := want(x, amt)
if !checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v, amt=%d", x, amt) }) {
return false
}
}
return true
})
}
// testUint32x4ShiftAll tests a shift-all method (unary + scalar uint64).
func testUint32x4ShiftAll(t *testing.T, f func(_ archsimd.Uint32x4, _ uint64) archsimd.Uint32x4, want func(_ []uint32, _ uint64) []uint32) {
n := 4
t.Helper()
forSlice(t, uint32s, n, func(x []uint32) bool {
t.Helper()
for _, amt := range testShiftAllAmts {
a := archsimd.LoadUint32x4(x)
g := make([]uint32, n)
f(a, amt).Store(g)
w := want(x, amt)
if !checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v, amt=%d", x, amt) }) {
return false
}
}
return true
})
}
// testUint64x2ShiftAll tests a shift-all method (unary + scalar uint64).
func testUint64x2ShiftAll(t *testing.T, f func(_ archsimd.Uint64x2, _ uint64) archsimd.Uint64x2, want func(_ []uint64, _ uint64) []uint64) {
n := 2
t.Helper()
forSlice(t, uint64s, n, func(x []uint64) bool {
t.Helper()
for _, amt := range testShiftAllAmts {
a := archsimd.LoadUint64x2(x)
g := make([]uint64, n)
f(a, amt).Store(g)
w := want(x, amt)
if !checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v, amt=%d", x, amt) }) {
return false
}
}
return true
})
}
// testUint8x16Shift tests a shift-like method where the first operand is Uint8x16
// and the second operand is Int8x16 (mixed-type shift).
func testUint8x16Shift(t *testing.T, f func(_ archsimd.Uint8x16, _ archsimd.Int8x16) archsimd.Uint8x16, want func(_ []uint8, _ []int8) []uint8) {
n := 16
t.Helper()
forSliceMixed(t, uint8s, int8s, n, func(x []uint8, y []int8) bool {
t.Helper()
a := archsimd.LoadUint8x16(x)
b := archsimd.LoadInt8x16(y)
g := make([]uint8, n)
f(a, b).Store(g)
w := want(x, y)
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testUint16x8Shift tests a shift-like method where the first operand is Uint16x8
// and the second operand is Int16x8 (mixed-type shift).
func testUint16x8Shift(t *testing.T, f func(_ archsimd.Uint16x8, _ archsimd.Int16x8) archsimd.Uint16x8, want func(_ []uint16, _ []int16) []uint16) {
n := 8
t.Helper()
forSliceMixed(t, uint16s, int16s, n, func(x []uint16, y []int16) bool {
t.Helper()
a := archsimd.LoadUint16x8(x)
b := archsimd.LoadInt16x8(y)
g := make([]uint16, n)
f(a, b).Store(g)
w := want(x, y)
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testUint32x4Shift tests a shift-like method where the first operand is Uint32x4
// and the second operand is Int32x4 (mixed-type shift).
func testUint32x4Shift(t *testing.T, f func(_ archsimd.Uint32x4, _ archsimd.Int32x4) archsimd.Uint32x4, want func(_ []uint32, _ []int32) []uint32) {
n := 4
t.Helper()
forSliceMixed(t, uint32s, int32s, n, func(x []uint32, y []int32) bool {
t.Helper()
a := archsimd.LoadUint32x4(x)
b := archsimd.LoadInt32x4(y)
g := make([]uint32, n)
f(a, b).Store(g)
w := want(x, y)
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}
// testUint64x2Shift tests a shift-like method where the first operand is Uint64x2
// and the second operand is Int64x2 (mixed-type shift).
func testUint64x2Shift(t *testing.T, f func(_ archsimd.Uint64x2, _ archsimd.Int64x2) archsimd.Uint64x2, want func(_ []uint64, _ []int64) []uint64) {
n := 2
t.Helper()
forSliceMixed(t, uint64s, int64s, n, func(x []uint64, y []int64) bool {
t.Helper()
a := archsimd.LoadUint64x2(x)
b := archsimd.LoadInt64x2(y)
g := make([]uint64, n)
f(a, b).Store(g)
w := want(x, y)
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
})
}