// Code generated by 'tmplgen'; DO NOT EDIT.

//go:build goexperiment.simd && (amd64 || wasm || 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"
)

// 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
	})
}
