Source file src/simd/archsimd/internal/simd_test/shift_helpers_arm64_test.go

     1  // Code generated by 'tmplgen'; DO NOT EDIT.
     2  
     3  //go:build goexperiment.simd && arm64
     4  
     5  // This file contains functions testing shift simd methods.
     6  // Each function in this file is specialized for a
     7  // particular simd type <BaseType><Width>x<Count>.
     8  
     9  package simd_test
    10  
    11  import (
    12  	"simd/archsimd"
    13  	"testing"
    14  )
    15  
    16  // testUint8x16Shift tests a shift-like method where the first operand is Uint8x16
    17  // and the second operand is Int8x16 (mixed-type shift).
    18  func testUint8x16Shift(t *testing.T, f func(_ archsimd.Uint8x16, _ archsimd.Int8x16) archsimd.Uint8x16, want func(_ []uint8, _ []int8) []uint8) {
    19  	n := 16
    20  	t.Helper()
    21  	forSliceMixed(t, uint8s, int8s, n, func(x []uint8, y []int8) bool {
    22  		t.Helper()
    23  		a := archsimd.LoadUint8x16(x)
    24  		b := archsimd.LoadInt8x16(y)
    25  		g := make([]uint8, n)
    26  		f(a, b).Store(g)
    27  		w := want(x, y)
    28  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
    29  	})
    30  }
    31  
    32  // testUint16x8Shift tests a shift-like method where the first operand is Uint16x8
    33  // and the second operand is Int16x8 (mixed-type shift).
    34  func testUint16x8Shift(t *testing.T, f func(_ archsimd.Uint16x8, _ archsimd.Int16x8) archsimd.Uint16x8, want func(_ []uint16, _ []int16) []uint16) {
    35  	n := 8
    36  	t.Helper()
    37  	forSliceMixed(t, uint16s, int16s, n, func(x []uint16, y []int16) bool {
    38  		t.Helper()
    39  		a := archsimd.LoadUint16x8(x)
    40  		b := archsimd.LoadInt16x8(y)
    41  		g := make([]uint16, n)
    42  		f(a, b).Store(g)
    43  		w := want(x, y)
    44  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
    45  	})
    46  }
    47  
    48  // testUint32x4Shift tests a shift-like method where the first operand is Uint32x4
    49  // and the second operand is Int32x4 (mixed-type shift).
    50  func testUint32x4Shift(t *testing.T, f func(_ archsimd.Uint32x4, _ archsimd.Int32x4) archsimd.Uint32x4, want func(_ []uint32, _ []int32) []uint32) {
    51  	n := 4
    52  	t.Helper()
    53  	forSliceMixed(t, uint32s, int32s, n, func(x []uint32, y []int32) bool {
    54  		t.Helper()
    55  		a := archsimd.LoadUint32x4(x)
    56  		b := archsimd.LoadInt32x4(y)
    57  		g := make([]uint32, n)
    58  		f(a, b).Store(g)
    59  		w := want(x, y)
    60  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
    61  	})
    62  }
    63  
    64  // testUint64x2Shift tests a shift-like method where the first operand is Uint64x2
    65  // and the second operand is Int64x2 (mixed-type shift).
    66  func testUint64x2Shift(t *testing.T, f func(_ archsimd.Uint64x2, _ archsimd.Int64x2) archsimd.Uint64x2, want func(_ []uint64, _ []int64) []uint64) {
    67  	n := 2
    68  	t.Helper()
    69  	forSliceMixed(t, uint64s, int64s, n, func(x []uint64, y []int64) bool {
    70  		t.Helper()
    71  		a := archsimd.LoadUint64x2(x)
    72  		b := archsimd.LoadInt64x2(y)
    73  		g := make([]uint64, n)
    74  		f(a, b).Store(g)
    75  		w := want(x, y)
    76  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) })
    77  	})
    78  }
    79  

View as plain text