| // Code generated by 'tmplgen'; DO NOT EDIT. |
| |
| //go:build goexperiment.simd && amd64 |
| |
| // 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" |
| ) |
| |
| // testInt8x32ShiftAll tests a shift-all method (unary + scalar uint64). |
| func testInt8x32ShiftAll(t *testing.T, f func(_ archsimd.Int8x32, _ uint64) archsimd.Int8x32, want func(_ []int8, _ uint64) []int8) { |
| n := 32 |
| t.Helper() |
| forSlice(t, int8s, n, func(x []int8) bool { |
| t.Helper() |
| for _, amt := range testShiftAllAmts { |
| a := archsimd.LoadInt8x32(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 |
| }) |
| } |
| |
| // testInt16x16ShiftAll tests a shift-all method (unary + scalar uint64). |
| func testInt16x16ShiftAll(t *testing.T, f func(_ archsimd.Int16x16, _ uint64) archsimd.Int16x16, want func(_ []int16, _ uint64) []int16) { |
| n := 16 |
| t.Helper() |
| forSlice(t, int16s, n, func(x []int16) bool { |
| t.Helper() |
| for _, amt := range testShiftAllAmts { |
| a := archsimd.LoadInt16x16(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 |
| }) |
| } |
| |
| // testInt32x8ShiftAll tests a shift-all method (unary + scalar uint64). |
| func testInt32x8ShiftAll(t *testing.T, f func(_ archsimd.Int32x8, _ uint64) archsimd.Int32x8, want func(_ []int32, _ uint64) []int32) { |
| n := 8 |
| t.Helper() |
| forSlice(t, int32s, n, func(x []int32) bool { |
| t.Helper() |
| for _, amt := range testShiftAllAmts { |
| a := archsimd.LoadInt32x8(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 |
| }) |
| } |
| |
| // testInt64x4ShiftAll tests a shift-all method (unary + scalar uint64). |
| func testInt64x4ShiftAll(t *testing.T, f func(_ archsimd.Int64x4, _ uint64) archsimd.Int64x4, want func(_ []int64, _ uint64) []int64) { |
| n := 4 |
| t.Helper() |
| forSlice(t, int64s, n, func(x []int64) bool { |
| t.Helper() |
| for _, amt := range testShiftAllAmts { |
| a := archsimd.LoadInt64x4(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 |
| }) |
| } |
| |
| // testUint8x32ShiftAll tests a shift-all method (unary + scalar uint64). |
| func testUint8x32ShiftAll(t *testing.T, f func(_ archsimd.Uint8x32, _ uint64) archsimd.Uint8x32, want func(_ []uint8, _ uint64) []uint8) { |
| n := 32 |
| t.Helper() |
| forSlice(t, uint8s, n, func(x []uint8) bool { |
| t.Helper() |
| for _, amt := range testShiftAllAmts { |
| a := archsimd.LoadUint8x32(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 |
| }) |
| } |
| |
| // testUint16x16ShiftAll tests a shift-all method (unary + scalar uint64). |
| func testUint16x16ShiftAll(t *testing.T, f func(_ archsimd.Uint16x16, _ uint64) archsimd.Uint16x16, want func(_ []uint16, _ uint64) []uint16) { |
| n := 16 |
| t.Helper() |
| forSlice(t, uint16s, n, func(x []uint16) bool { |
| t.Helper() |
| for _, amt := range testShiftAllAmts { |
| a := archsimd.LoadUint16x16(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 |
| }) |
| } |
| |
| // testUint32x8ShiftAll tests a shift-all method (unary + scalar uint64). |
| func testUint32x8ShiftAll(t *testing.T, f func(_ archsimd.Uint32x8, _ uint64) archsimd.Uint32x8, want func(_ []uint32, _ uint64) []uint32) { |
| n := 8 |
| t.Helper() |
| forSlice(t, uint32s, n, func(x []uint32) bool { |
| t.Helper() |
| for _, amt := range testShiftAllAmts { |
| a := archsimd.LoadUint32x8(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 |
| }) |
| } |
| |
| // testUint64x4ShiftAll tests a shift-all method (unary + scalar uint64). |
| func testUint64x4ShiftAll(t *testing.T, f func(_ archsimd.Uint64x4, _ uint64) archsimd.Uint64x4, want func(_ []uint64, _ uint64) []uint64) { |
| n := 4 |
| t.Helper() |
| forSlice(t, uint64s, n, func(x []uint64) bool { |
| t.Helper() |
| for _, amt := range testShiftAllAmts { |
| a := archsimd.LoadUint64x4(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 |
| }) |
| } |
| |
| // testInt8x64ShiftAll tests a shift-all method (unary + scalar uint64). |
| func testInt8x64ShiftAll(t *testing.T, f func(_ archsimd.Int8x64, _ uint64) archsimd.Int8x64, want func(_ []int8, _ uint64) []int8) { |
| n := 64 |
| t.Helper() |
| forSlice(t, int8s, n, func(x []int8) bool { |
| t.Helper() |
| for _, amt := range testShiftAllAmts { |
| a := archsimd.LoadInt8x64(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 |
| }) |
| } |
| |
| // testInt16x32ShiftAll tests a shift-all method (unary + scalar uint64). |
| func testInt16x32ShiftAll(t *testing.T, f func(_ archsimd.Int16x32, _ uint64) archsimd.Int16x32, want func(_ []int16, _ uint64) []int16) { |
| n := 32 |
| t.Helper() |
| forSlice(t, int16s, n, func(x []int16) bool { |
| t.Helper() |
| for _, amt := range testShiftAllAmts { |
| a := archsimd.LoadInt16x32(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 |
| }) |
| } |
| |
| // testInt32x16ShiftAll tests a shift-all method (unary + scalar uint64). |
| func testInt32x16ShiftAll(t *testing.T, f func(_ archsimd.Int32x16, _ uint64) archsimd.Int32x16, want func(_ []int32, _ uint64) []int32) { |
| n := 16 |
| t.Helper() |
| forSlice(t, int32s, n, func(x []int32) bool { |
| t.Helper() |
| for _, amt := range testShiftAllAmts { |
| a := archsimd.LoadInt32x16(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 |
| }) |
| } |
| |
| // testInt64x8ShiftAll tests a shift-all method (unary + scalar uint64). |
| func testInt64x8ShiftAll(t *testing.T, f func(_ archsimd.Int64x8, _ uint64) archsimd.Int64x8, want func(_ []int64, _ uint64) []int64) { |
| n := 8 |
| t.Helper() |
| forSlice(t, int64s, n, func(x []int64) bool { |
| t.Helper() |
| for _, amt := range testShiftAllAmts { |
| a := archsimd.LoadInt64x8(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 |
| }) |
| } |
| |
| // testUint8x64ShiftAll tests a shift-all method (unary + scalar uint64). |
| func testUint8x64ShiftAll(t *testing.T, f func(_ archsimd.Uint8x64, _ uint64) archsimd.Uint8x64, want func(_ []uint8, _ uint64) []uint8) { |
| n := 64 |
| t.Helper() |
| forSlice(t, uint8s, n, func(x []uint8) bool { |
| t.Helper() |
| for _, amt := range testShiftAllAmts { |
| a := archsimd.LoadUint8x64(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 |
| }) |
| } |
| |
| // testUint16x32ShiftAll tests a shift-all method (unary + scalar uint64). |
| func testUint16x32ShiftAll(t *testing.T, f func(_ archsimd.Uint16x32, _ uint64) archsimd.Uint16x32, want func(_ []uint16, _ uint64) []uint16) { |
| n := 32 |
| t.Helper() |
| forSlice(t, uint16s, n, func(x []uint16) bool { |
| t.Helper() |
| for _, amt := range testShiftAllAmts { |
| a := archsimd.LoadUint16x32(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 |
| }) |
| } |
| |
| // testUint32x16ShiftAll tests a shift-all method (unary + scalar uint64). |
| func testUint32x16ShiftAll(t *testing.T, f func(_ archsimd.Uint32x16, _ uint64) archsimd.Uint32x16, want func(_ []uint32, _ uint64) []uint32) { |
| n := 16 |
| t.Helper() |
| forSlice(t, uint32s, n, func(x []uint32) bool { |
| t.Helper() |
| for _, amt := range testShiftAllAmts { |
| a := archsimd.LoadUint32x16(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 |
| }) |
| } |
| |
| // testUint64x8ShiftAll tests a shift-all method (unary + scalar uint64). |
| func testUint64x8ShiftAll(t *testing.T, f func(_ archsimd.Uint64x8, _ uint64) archsimd.Uint64x8, want func(_ []uint64, _ uint64) []uint64) { |
| n := 8 |
| t.Helper() |
| forSlice(t, uint64s, n, func(x []uint64) bool { |
| t.Helper() |
| for _, amt := range testShiftAllAmts { |
| a := archsimd.LoadUint64x8(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 |
| }) |
| } |