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

     1  // Code generated by 'tmplgen'; DO NOT EDIT.
     2  
     3  //go:build goexperiment.simd && (amd64 || wasm || arm64)
     4  
     5  // This file contains functions testing conversion 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  // testInt16x8ConvertToInt8 tests the simd conversion method f against the expected behavior generated by want.
    17  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
    18  // (extended to at least 128 bits, or truncated to at most 512 bits).
    19  func testInt16x8ConvertToInt8(t *testing.T, f func(x archsimd.Int16x8) archsimd.Int8x16, want func(x []int16) []int8) {
    20  	n := 8
    21  	t.Helper()
    22  	forSlice(t, int16s, n, func(x []int16) bool {
    23  		t.Helper()
    24  		a := archsimd.LoadInt16x8(x)
    25  		g := make([]int8, 16)
    26  		f(a).Store(g)
    27  		w := want(x)
    28  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
    29  	})
    30  }
    31  
    32  // testInt32x4ConvertToInt8 tests the simd conversion method f against the expected behavior generated by want.
    33  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
    34  // (extended to at least 128 bits, or truncated to at most 512 bits).
    35  func testInt32x4ConvertToInt8(t *testing.T, f func(x archsimd.Int32x4) archsimd.Int8x16, want func(x []int32) []int8) {
    36  	n := 4
    37  	t.Helper()
    38  	forSlice(t, int32s, n, func(x []int32) bool {
    39  		t.Helper()
    40  		a := archsimd.LoadInt32x4(x)
    41  		g := make([]int8, 16)
    42  		f(a).Store(g)
    43  		w := want(x)
    44  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
    45  	})
    46  }
    47  
    48  // testInt64x2ConvertToInt8 tests the simd conversion method f against the expected behavior generated by want.
    49  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
    50  // (extended to at least 128 bits, or truncated to at most 512 bits).
    51  func testInt64x2ConvertToInt8(t *testing.T, f func(x archsimd.Int64x2) archsimd.Int8x16, want func(x []int64) []int8) {
    52  	n := 2
    53  	t.Helper()
    54  	forSlice(t, int64s, n, func(x []int64) bool {
    55  		t.Helper()
    56  		a := archsimd.LoadInt64x2(x)
    57  		g := make([]int8, 16)
    58  		f(a).Store(g)
    59  		w := want(x)
    60  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
    61  	})
    62  }
    63  
    64  // testUint8x16ConvertToInt8 tests the simd conversion method f against the expected behavior generated by want.
    65  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
    66  // (extended to at least 128 bits, or truncated to at most 512 bits).
    67  func testUint8x16ConvertToInt8(t *testing.T, f func(x archsimd.Uint8x16) archsimd.Int8x16, want func(x []uint8) []int8) {
    68  	n := 16
    69  	t.Helper()
    70  	forSlice(t, uint8s, n, func(x []uint8) bool {
    71  		t.Helper()
    72  		a := archsimd.LoadUint8x16(x)
    73  		g := make([]int8, 16)
    74  		f(a).Store(g)
    75  		w := want(x)
    76  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
    77  	})
    78  }
    79  
    80  // testUint16x8ConvertToInt8 tests the simd conversion method f against the expected behavior generated by want.
    81  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
    82  // (extended to at least 128 bits, or truncated to at most 512 bits).
    83  func testUint16x8ConvertToInt8(t *testing.T, f func(x archsimd.Uint16x8) archsimd.Int8x16, want func(x []uint16) []int8) {
    84  	n := 8
    85  	t.Helper()
    86  	forSlice(t, uint16s, n, func(x []uint16) bool {
    87  		t.Helper()
    88  		a := archsimd.LoadUint16x8(x)
    89  		g := make([]int8, 16)
    90  		f(a).Store(g)
    91  		w := want(x)
    92  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
    93  	})
    94  }
    95  
    96  // testUint32x4ConvertToInt8 tests the simd conversion method f against the expected behavior generated by want.
    97  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
    98  // (extended to at least 128 bits, or truncated to at most 512 bits).
    99  func testUint32x4ConvertToInt8(t *testing.T, f func(x archsimd.Uint32x4) archsimd.Int8x16, want func(x []uint32) []int8) {
   100  	n := 4
   101  	t.Helper()
   102  	forSlice(t, uint32s, n, func(x []uint32) bool {
   103  		t.Helper()
   104  		a := archsimd.LoadUint32x4(x)
   105  		g := make([]int8, 16)
   106  		f(a).Store(g)
   107  		w := want(x)
   108  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   109  	})
   110  }
   111  
   112  // testUint64x2ConvertToInt8 tests the simd conversion method f against the expected behavior generated by want.
   113  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   114  // (extended to at least 128 bits, or truncated to at most 512 bits).
   115  func testUint64x2ConvertToInt8(t *testing.T, f func(x archsimd.Uint64x2) archsimd.Int8x16, want func(x []uint64) []int8) {
   116  	n := 2
   117  	t.Helper()
   118  	forSlice(t, uint64s, n, func(x []uint64) bool {
   119  		t.Helper()
   120  		a := archsimd.LoadUint64x2(x)
   121  		g := make([]int8, 16)
   122  		f(a).Store(g)
   123  		w := want(x)
   124  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   125  	})
   126  }
   127  
   128  // testFloat32x4ConvertToInt8 tests the simd conversion method f against the expected behavior generated by want.
   129  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   130  // (extended to at least 128 bits, or truncated to at most 512 bits).
   131  func testFloat32x4ConvertToInt8(t *testing.T, f func(x archsimd.Float32x4) archsimd.Int8x16, want func(x []float32) []int8) {
   132  	n := 4
   133  	t.Helper()
   134  	forSlice(t, float32s, n, func(x []float32) bool {
   135  		t.Helper()
   136  		a := archsimd.LoadFloat32x4(x)
   137  		g := make([]int8, 16)
   138  		f(a).Store(g)
   139  		w := want(x)
   140  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   141  	})
   142  }
   143  
   144  // testFloat64x2ConvertToInt8 tests the simd conversion method f against the expected behavior generated by want.
   145  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   146  // (extended to at least 128 bits, or truncated to at most 512 bits).
   147  func testFloat64x2ConvertToInt8(t *testing.T, f func(x archsimd.Float64x2) archsimd.Int8x16, want func(x []float64) []int8) {
   148  	n := 2
   149  	t.Helper()
   150  	forSlice(t, float64s, n, func(x []float64) bool {
   151  		t.Helper()
   152  		a := archsimd.LoadFloat64x2(x)
   153  		g := make([]int8, 16)
   154  		f(a).Store(g)
   155  		w := want(x)
   156  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   157  	})
   158  }
   159  
   160  // testInt8x16ConvertToUint8 tests the simd conversion method f against the expected behavior generated by want.
   161  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   162  // (extended to at least 128 bits, or truncated to at most 512 bits).
   163  func testInt8x16ConvertToUint8(t *testing.T, f func(x archsimd.Int8x16) archsimd.Uint8x16, want func(x []int8) []uint8) {
   164  	n := 16
   165  	t.Helper()
   166  	forSlice(t, int8s, n, func(x []int8) bool {
   167  		t.Helper()
   168  		a := archsimd.LoadInt8x16(x)
   169  		g := make([]uint8, 16)
   170  		f(a).Store(g)
   171  		w := want(x)
   172  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   173  	})
   174  }
   175  
   176  // testInt16x8ConvertToUint8 tests the simd conversion method f against the expected behavior generated by want.
   177  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   178  // (extended to at least 128 bits, or truncated to at most 512 bits).
   179  func testInt16x8ConvertToUint8(t *testing.T, f func(x archsimd.Int16x8) archsimd.Uint8x16, want func(x []int16) []uint8) {
   180  	n := 8
   181  	t.Helper()
   182  	forSlice(t, int16s, n, func(x []int16) bool {
   183  		t.Helper()
   184  		a := archsimd.LoadInt16x8(x)
   185  		g := make([]uint8, 16)
   186  		f(a).Store(g)
   187  		w := want(x)
   188  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   189  	})
   190  }
   191  
   192  // testInt32x4ConvertToUint8 tests the simd conversion method f against the expected behavior generated by want.
   193  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   194  // (extended to at least 128 bits, or truncated to at most 512 bits).
   195  func testInt32x4ConvertToUint8(t *testing.T, f func(x archsimd.Int32x4) archsimd.Uint8x16, want func(x []int32) []uint8) {
   196  	n := 4
   197  	t.Helper()
   198  	forSlice(t, int32s, n, func(x []int32) bool {
   199  		t.Helper()
   200  		a := archsimd.LoadInt32x4(x)
   201  		g := make([]uint8, 16)
   202  		f(a).Store(g)
   203  		w := want(x)
   204  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   205  	})
   206  }
   207  
   208  // testInt64x2ConvertToUint8 tests the simd conversion method f against the expected behavior generated by want.
   209  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   210  // (extended to at least 128 bits, or truncated to at most 512 bits).
   211  func testInt64x2ConvertToUint8(t *testing.T, f func(x archsimd.Int64x2) archsimd.Uint8x16, want func(x []int64) []uint8) {
   212  	n := 2
   213  	t.Helper()
   214  	forSlice(t, int64s, n, func(x []int64) bool {
   215  		t.Helper()
   216  		a := archsimd.LoadInt64x2(x)
   217  		g := make([]uint8, 16)
   218  		f(a).Store(g)
   219  		w := want(x)
   220  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   221  	})
   222  }
   223  
   224  // testUint16x8ConvertToUint8 tests the simd conversion method f against the expected behavior generated by want.
   225  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   226  // (extended to at least 128 bits, or truncated to at most 512 bits).
   227  func testUint16x8ConvertToUint8(t *testing.T, f func(x archsimd.Uint16x8) archsimd.Uint8x16, want func(x []uint16) []uint8) {
   228  	n := 8
   229  	t.Helper()
   230  	forSlice(t, uint16s, n, func(x []uint16) bool {
   231  		t.Helper()
   232  		a := archsimd.LoadUint16x8(x)
   233  		g := make([]uint8, 16)
   234  		f(a).Store(g)
   235  		w := want(x)
   236  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   237  	})
   238  }
   239  
   240  // testUint32x4ConvertToUint8 tests the simd conversion method f against the expected behavior generated by want.
   241  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   242  // (extended to at least 128 bits, or truncated to at most 512 bits).
   243  func testUint32x4ConvertToUint8(t *testing.T, f func(x archsimd.Uint32x4) archsimd.Uint8x16, want func(x []uint32) []uint8) {
   244  	n := 4
   245  	t.Helper()
   246  	forSlice(t, uint32s, n, func(x []uint32) bool {
   247  		t.Helper()
   248  		a := archsimd.LoadUint32x4(x)
   249  		g := make([]uint8, 16)
   250  		f(a).Store(g)
   251  		w := want(x)
   252  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   253  	})
   254  }
   255  
   256  // testUint64x2ConvertToUint8 tests the simd conversion method f against the expected behavior generated by want.
   257  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   258  // (extended to at least 128 bits, or truncated to at most 512 bits).
   259  func testUint64x2ConvertToUint8(t *testing.T, f func(x archsimd.Uint64x2) archsimd.Uint8x16, want func(x []uint64) []uint8) {
   260  	n := 2
   261  	t.Helper()
   262  	forSlice(t, uint64s, n, func(x []uint64) bool {
   263  		t.Helper()
   264  		a := archsimd.LoadUint64x2(x)
   265  		g := make([]uint8, 16)
   266  		f(a).Store(g)
   267  		w := want(x)
   268  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   269  	})
   270  }
   271  
   272  // testFloat32x4ConvertToUint8 tests the simd conversion method f against the expected behavior generated by want.
   273  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   274  // (extended to at least 128 bits, or truncated to at most 512 bits).
   275  func testFloat32x4ConvertToUint8(t *testing.T, f func(x archsimd.Float32x4) archsimd.Uint8x16, want func(x []float32) []uint8) {
   276  	n := 4
   277  	t.Helper()
   278  	forSlice(t, float32s, n, func(x []float32) bool {
   279  		t.Helper()
   280  		a := archsimd.LoadFloat32x4(x)
   281  		g := make([]uint8, 16)
   282  		f(a).Store(g)
   283  		w := want(x)
   284  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   285  	})
   286  }
   287  
   288  // testFloat64x2ConvertToUint8 tests the simd conversion method f against the expected behavior generated by want.
   289  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   290  // (extended to at least 128 bits, or truncated to at most 512 bits).
   291  func testFloat64x2ConvertToUint8(t *testing.T, f func(x archsimd.Float64x2) archsimd.Uint8x16, want func(x []float64) []uint8) {
   292  	n := 2
   293  	t.Helper()
   294  	forSlice(t, float64s, n, func(x []float64) bool {
   295  		t.Helper()
   296  		a := archsimd.LoadFloat64x2(x)
   297  		g := make([]uint8, 16)
   298  		f(a).Store(g)
   299  		w := want(x)
   300  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   301  	})
   302  }
   303  
   304  // testInt32x4ConvertToInt16 tests the simd conversion method f against the expected behavior generated by want.
   305  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   306  // (extended to at least 128 bits, or truncated to at most 512 bits).
   307  func testInt32x4ConvertToInt16(t *testing.T, f func(x archsimd.Int32x4) archsimd.Int16x8, want func(x []int32) []int16) {
   308  	n := 4
   309  	t.Helper()
   310  	forSlice(t, int32s, n, func(x []int32) bool {
   311  		t.Helper()
   312  		a := archsimd.LoadInt32x4(x)
   313  		g := make([]int16, 8)
   314  		f(a).Store(g)
   315  		w := want(x)
   316  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   317  	})
   318  }
   319  
   320  // testInt64x2ConvertToInt16 tests the simd conversion method f against the expected behavior generated by want.
   321  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   322  // (extended to at least 128 bits, or truncated to at most 512 bits).
   323  func testInt64x2ConvertToInt16(t *testing.T, f func(x archsimd.Int64x2) archsimd.Int16x8, want func(x []int64) []int16) {
   324  	n := 2
   325  	t.Helper()
   326  	forSlice(t, int64s, n, func(x []int64) bool {
   327  		t.Helper()
   328  		a := archsimd.LoadInt64x2(x)
   329  		g := make([]int16, 8)
   330  		f(a).Store(g)
   331  		w := want(x)
   332  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   333  	})
   334  }
   335  
   336  // testUint16x8ConvertToInt16 tests the simd conversion method f against the expected behavior generated by want.
   337  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   338  // (extended to at least 128 bits, or truncated to at most 512 bits).
   339  func testUint16x8ConvertToInt16(t *testing.T, f func(x archsimd.Uint16x8) archsimd.Int16x8, want func(x []uint16) []int16) {
   340  	n := 8
   341  	t.Helper()
   342  	forSlice(t, uint16s, n, func(x []uint16) bool {
   343  		t.Helper()
   344  		a := archsimd.LoadUint16x8(x)
   345  		g := make([]int16, 8)
   346  		f(a).Store(g)
   347  		w := want(x)
   348  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   349  	})
   350  }
   351  
   352  // testUint32x4ConvertToInt16 tests the simd conversion method f against the expected behavior generated by want.
   353  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   354  // (extended to at least 128 bits, or truncated to at most 512 bits).
   355  func testUint32x4ConvertToInt16(t *testing.T, f func(x archsimd.Uint32x4) archsimd.Int16x8, want func(x []uint32) []int16) {
   356  	n := 4
   357  	t.Helper()
   358  	forSlice(t, uint32s, n, func(x []uint32) bool {
   359  		t.Helper()
   360  		a := archsimd.LoadUint32x4(x)
   361  		g := make([]int16, 8)
   362  		f(a).Store(g)
   363  		w := want(x)
   364  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   365  	})
   366  }
   367  
   368  // testUint64x2ConvertToInt16 tests the simd conversion method f against the expected behavior generated by want.
   369  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   370  // (extended to at least 128 bits, or truncated to at most 512 bits).
   371  func testUint64x2ConvertToInt16(t *testing.T, f func(x archsimd.Uint64x2) archsimd.Int16x8, want func(x []uint64) []int16) {
   372  	n := 2
   373  	t.Helper()
   374  	forSlice(t, uint64s, n, func(x []uint64) bool {
   375  		t.Helper()
   376  		a := archsimd.LoadUint64x2(x)
   377  		g := make([]int16, 8)
   378  		f(a).Store(g)
   379  		w := want(x)
   380  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   381  	})
   382  }
   383  
   384  // testFloat32x4ConvertToInt16 tests the simd conversion method f against the expected behavior generated by want.
   385  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   386  // (extended to at least 128 bits, or truncated to at most 512 bits).
   387  func testFloat32x4ConvertToInt16(t *testing.T, f func(x archsimd.Float32x4) archsimd.Int16x8, want func(x []float32) []int16) {
   388  	n := 4
   389  	t.Helper()
   390  	forSlice(t, float32s, n, func(x []float32) bool {
   391  		t.Helper()
   392  		a := archsimd.LoadFloat32x4(x)
   393  		g := make([]int16, 8)
   394  		f(a).Store(g)
   395  		w := want(x)
   396  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   397  	})
   398  }
   399  
   400  // testFloat64x2ConvertToInt16 tests the simd conversion method f against the expected behavior generated by want.
   401  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   402  // (extended to at least 128 bits, or truncated to at most 512 bits).
   403  func testFloat64x2ConvertToInt16(t *testing.T, f func(x archsimd.Float64x2) archsimd.Int16x8, want func(x []float64) []int16) {
   404  	n := 2
   405  	t.Helper()
   406  	forSlice(t, float64s, n, func(x []float64) bool {
   407  		t.Helper()
   408  		a := archsimd.LoadFloat64x2(x)
   409  		g := make([]int16, 8)
   410  		f(a).Store(g)
   411  		w := want(x)
   412  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   413  	})
   414  }
   415  
   416  // testInt16x8ConvertToUint16 tests the simd conversion method f against the expected behavior generated by want.
   417  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   418  // (extended to at least 128 bits, or truncated to at most 512 bits).
   419  func testInt16x8ConvertToUint16(t *testing.T, f func(x archsimd.Int16x8) archsimd.Uint16x8, want func(x []int16) []uint16) {
   420  	n := 8
   421  	t.Helper()
   422  	forSlice(t, int16s, n, func(x []int16) bool {
   423  		t.Helper()
   424  		a := archsimd.LoadInt16x8(x)
   425  		g := make([]uint16, 8)
   426  		f(a).Store(g)
   427  		w := want(x)
   428  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   429  	})
   430  }
   431  
   432  // testInt32x4ConvertToUint16 tests the simd conversion method f against the expected behavior generated by want.
   433  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   434  // (extended to at least 128 bits, or truncated to at most 512 bits).
   435  func testInt32x4ConvertToUint16(t *testing.T, f func(x archsimd.Int32x4) archsimd.Uint16x8, want func(x []int32) []uint16) {
   436  	n := 4
   437  	t.Helper()
   438  	forSlice(t, int32s, n, func(x []int32) bool {
   439  		t.Helper()
   440  		a := archsimd.LoadInt32x4(x)
   441  		g := make([]uint16, 8)
   442  		f(a).Store(g)
   443  		w := want(x)
   444  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   445  	})
   446  }
   447  
   448  // testInt64x2ConvertToUint16 tests the simd conversion method f against the expected behavior generated by want.
   449  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   450  // (extended to at least 128 bits, or truncated to at most 512 bits).
   451  func testInt64x2ConvertToUint16(t *testing.T, f func(x archsimd.Int64x2) archsimd.Uint16x8, want func(x []int64) []uint16) {
   452  	n := 2
   453  	t.Helper()
   454  	forSlice(t, int64s, n, func(x []int64) bool {
   455  		t.Helper()
   456  		a := archsimd.LoadInt64x2(x)
   457  		g := make([]uint16, 8)
   458  		f(a).Store(g)
   459  		w := want(x)
   460  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   461  	})
   462  }
   463  
   464  // testUint32x4ConvertToUint16 tests the simd conversion method f against the expected behavior generated by want.
   465  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   466  // (extended to at least 128 bits, or truncated to at most 512 bits).
   467  func testUint32x4ConvertToUint16(t *testing.T, f func(x archsimd.Uint32x4) archsimd.Uint16x8, want func(x []uint32) []uint16) {
   468  	n := 4
   469  	t.Helper()
   470  	forSlice(t, uint32s, n, func(x []uint32) bool {
   471  		t.Helper()
   472  		a := archsimd.LoadUint32x4(x)
   473  		g := make([]uint16, 8)
   474  		f(a).Store(g)
   475  		w := want(x)
   476  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   477  	})
   478  }
   479  
   480  // testUint64x2ConvertToUint16 tests the simd conversion method f against the expected behavior generated by want.
   481  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   482  // (extended to at least 128 bits, or truncated to at most 512 bits).
   483  func testUint64x2ConvertToUint16(t *testing.T, f func(x archsimd.Uint64x2) archsimd.Uint16x8, want func(x []uint64) []uint16) {
   484  	n := 2
   485  	t.Helper()
   486  	forSlice(t, uint64s, n, func(x []uint64) bool {
   487  		t.Helper()
   488  		a := archsimd.LoadUint64x2(x)
   489  		g := make([]uint16, 8)
   490  		f(a).Store(g)
   491  		w := want(x)
   492  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   493  	})
   494  }
   495  
   496  // testFloat32x4ConvertToUint16 tests the simd conversion method f against the expected behavior generated by want.
   497  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   498  // (extended to at least 128 bits, or truncated to at most 512 bits).
   499  func testFloat32x4ConvertToUint16(t *testing.T, f func(x archsimd.Float32x4) archsimd.Uint16x8, want func(x []float32) []uint16) {
   500  	n := 4
   501  	t.Helper()
   502  	forSlice(t, float32s, n, func(x []float32) bool {
   503  		t.Helper()
   504  		a := archsimd.LoadFloat32x4(x)
   505  		g := make([]uint16, 8)
   506  		f(a).Store(g)
   507  		w := want(x)
   508  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   509  	})
   510  }
   511  
   512  // testFloat64x2ConvertToUint16 tests the simd conversion method f against the expected behavior generated by want.
   513  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   514  // (extended to at least 128 bits, or truncated to at most 512 bits).
   515  func testFloat64x2ConvertToUint16(t *testing.T, f func(x archsimd.Float64x2) archsimd.Uint16x8, want func(x []float64) []uint16) {
   516  	n := 2
   517  	t.Helper()
   518  	forSlice(t, float64s, n, func(x []float64) bool {
   519  		t.Helper()
   520  		a := archsimd.LoadFloat64x2(x)
   521  		g := make([]uint16, 8)
   522  		f(a).Store(g)
   523  		w := want(x)
   524  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   525  	})
   526  }
   527  
   528  // testInt64x2ConvertToInt32 tests the simd conversion method f against the expected behavior generated by want.
   529  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   530  // (extended to at least 128 bits, or truncated to at most 512 bits).
   531  func testInt64x2ConvertToInt32(t *testing.T, f func(x archsimd.Int64x2) archsimd.Int32x4, want func(x []int64) []int32) {
   532  	n := 2
   533  	t.Helper()
   534  	forSlice(t, int64s, n, func(x []int64) bool {
   535  		t.Helper()
   536  		a := archsimd.LoadInt64x2(x)
   537  		g := make([]int32, 4)
   538  		f(a).Store(g)
   539  		w := want(x)
   540  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   541  	})
   542  }
   543  
   544  // testUint32x4ConvertToInt32 tests the simd conversion method f against the expected behavior generated by want.
   545  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   546  // (extended to at least 128 bits, or truncated to at most 512 bits).
   547  func testUint32x4ConvertToInt32(t *testing.T, f func(x archsimd.Uint32x4) archsimd.Int32x4, want func(x []uint32) []int32) {
   548  	n := 4
   549  	t.Helper()
   550  	forSlice(t, uint32s, n, func(x []uint32) bool {
   551  		t.Helper()
   552  		a := archsimd.LoadUint32x4(x)
   553  		g := make([]int32, 4)
   554  		f(a).Store(g)
   555  		w := want(x)
   556  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   557  	})
   558  }
   559  
   560  // testUint64x2ConvertToInt32 tests the simd conversion method f against the expected behavior generated by want.
   561  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   562  // (extended to at least 128 bits, or truncated to at most 512 bits).
   563  func testUint64x2ConvertToInt32(t *testing.T, f func(x archsimd.Uint64x2) archsimd.Int32x4, want func(x []uint64) []int32) {
   564  	n := 2
   565  	t.Helper()
   566  	forSlice(t, uint64s, n, func(x []uint64) bool {
   567  		t.Helper()
   568  		a := archsimd.LoadUint64x2(x)
   569  		g := make([]int32, 4)
   570  		f(a).Store(g)
   571  		w := want(x)
   572  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   573  	})
   574  }
   575  
   576  // testFloat32x4ConvertToInt32 tests the simd conversion method f against the expected behavior generated by want.
   577  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   578  // (extended to at least 128 bits, or truncated to at most 512 bits).
   579  func testFloat32x4ConvertToInt32(t *testing.T, f func(x archsimd.Float32x4) archsimd.Int32x4, want func(x []float32) []int32) {
   580  	n := 4
   581  	t.Helper()
   582  	forSlice(t, float32s, n, func(x []float32) bool {
   583  		t.Helper()
   584  		a := archsimd.LoadFloat32x4(x)
   585  		g := make([]int32, 4)
   586  		f(a).Store(g)
   587  		w := want(x)
   588  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   589  	})
   590  }
   591  
   592  // testFloat64x2ConvertToInt32 tests the simd conversion method f against the expected behavior generated by want.
   593  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   594  // (extended to at least 128 bits, or truncated to at most 512 bits).
   595  func testFloat64x2ConvertToInt32(t *testing.T, f func(x archsimd.Float64x2) archsimd.Int32x4, want func(x []float64) []int32) {
   596  	n := 2
   597  	t.Helper()
   598  	forSlice(t, float64s, n, func(x []float64) bool {
   599  		t.Helper()
   600  		a := archsimd.LoadFloat64x2(x)
   601  		g := make([]int32, 4)
   602  		f(a).Store(g)
   603  		w := want(x)
   604  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   605  	})
   606  }
   607  
   608  // testInt32x4ConvertToUint32 tests the simd conversion method f against the expected behavior generated by want.
   609  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   610  // (extended to at least 128 bits, or truncated to at most 512 bits).
   611  func testInt32x4ConvertToUint32(t *testing.T, f func(x archsimd.Int32x4) archsimd.Uint32x4, want func(x []int32) []uint32) {
   612  	n := 4
   613  	t.Helper()
   614  	forSlice(t, int32s, n, func(x []int32) bool {
   615  		t.Helper()
   616  		a := archsimd.LoadInt32x4(x)
   617  		g := make([]uint32, 4)
   618  		f(a).Store(g)
   619  		w := want(x)
   620  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   621  	})
   622  }
   623  
   624  // testInt64x2ConvertToUint32 tests the simd conversion method f against the expected behavior generated by want.
   625  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   626  // (extended to at least 128 bits, or truncated to at most 512 bits).
   627  func testInt64x2ConvertToUint32(t *testing.T, f func(x archsimd.Int64x2) archsimd.Uint32x4, want func(x []int64) []uint32) {
   628  	n := 2
   629  	t.Helper()
   630  	forSlice(t, int64s, n, func(x []int64) bool {
   631  		t.Helper()
   632  		a := archsimd.LoadInt64x2(x)
   633  		g := make([]uint32, 4)
   634  		f(a).Store(g)
   635  		w := want(x)
   636  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   637  	})
   638  }
   639  
   640  // testUint64x2ConvertToUint32 tests the simd conversion method f against the expected behavior generated by want.
   641  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   642  // (extended to at least 128 bits, or truncated to at most 512 bits).
   643  func testUint64x2ConvertToUint32(t *testing.T, f func(x archsimd.Uint64x2) archsimd.Uint32x4, want func(x []uint64) []uint32) {
   644  	n := 2
   645  	t.Helper()
   646  	forSlice(t, uint64s, n, func(x []uint64) bool {
   647  		t.Helper()
   648  		a := archsimd.LoadUint64x2(x)
   649  		g := make([]uint32, 4)
   650  		f(a).Store(g)
   651  		w := want(x)
   652  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   653  	})
   654  }
   655  
   656  // testFloat32x4ConvertToUint32 tests the simd conversion method f against the expected behavior generated by want.
   657  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   658  // (extended to at least 128 bits, or truncated to at most 512 bits).
   659  func testFloat32x4ConvertToUint32(t *testing.T, f func(x archsimd.Float32x4) archsimd.Uint32x4, want func(x []float32) []uint32) {
   660  	n := 4
   661  	t.Helper()
   662  	forSlice(t, float32s, n, func(x []float32) bool {
   663  		t.Helper()
   664  		a := archsimd.LoadFloat32x4(x)
   665  		g := make([]uint32, 4)
   666  		f(a).Store(g)
   667  		w := want(x)
   668  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   669  	})
   670  }
   671  
   672  // testFloat64x2ConvertToUint32 tests the simd conversion method f against the expected behavior generated by want.
   673  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   674  // (extended to at least 128 bits, or truncated to at most 512 bits).
   675  func testFloat64x2ConvertToUint32(t *testing.T, f func(x archsimd.Float64x2) archsimd.Uint32x4, want func(x []float64) []uint32) {
   676  	n := 2
   677  	t.Helper()
   678  	forSlice(t, float64s, n, func(x []float64) bool {
   679  		t.Helper()
   680  		a := archsimd.LoadFloat64x2(x)
   681  		g := make([]uint32, 4)
   682  		f(a).Store(g)
   683  		w := want(x)
   684  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   685  	})
   686  }
   687  
   688  // testUint64x2ConvertToInt64 tests the simd conversion method f against the expected behavior generated by want.
   689  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   690  // (extended to at least 128 bits, or truncated to at most 512 bits).
   691  func testUint64x2ConvertToInt64(t *testing.T, f func(x archsimd.Uint64x2) archsimd.Int64x2, want func(x []uint64) []int64) {
   692  	n := 2
   693  	t.Helper()
   694  	forSlice(t, uint64s, n, func(x []uint64) bool {
   695  		t.Helper()
   696  		a := archsimd.LoadUint64x2(x)
   697  		g := make([]int64, 2)
   698  		f(a).Store(g)
   699  		w := want(x)
   700  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   701  	})
   702  }
   703  
   704  // testFloat64x2ConvertToInt64 tests the simd conversion method f against the expected behavior generated by want.
   705  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   706  // (extended to at least 128 bits, or truncated to at most 512 bits).
   707  func testFloat64x2ConvertToInt64(t *testing.T, f func(x archsimd.Float64x2) archsimd.Int64x2, want func(x []float64) []int64) {
   708  	n := 2
   709  	t.Helper()
   710  	forSlice(t, float64s, n, func(x []float64) bool {
   711  		t.Helper()
   712  		a := archsimd.LoadFloat64x2(x)
   713  		g := make([]int64, 2)
   714  		f(a).Store(g)
   715  		w := want(x)
   716  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   717  	})
   718  }
   719  
   720  // testInt64x2ConvertToUint64 tests the simd conversion method f against the expected behavior generated by want.
   721  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   722  // (extended to at least 128 bits, or truncated to at most 512 bits).
   723  func testInt64x2ConvertToUint64(t *testing.T, f func(x archsimd.Int64x2) archsimd.Uint64x2, want func(x []int64) []uint64) {
   724  	n := 2
   725  	t.Helper()
   726  	forSlice(t, int64s, n, func(x []int64) bool {
   727  		t.Helper()
   728  		a := archsimd.LoadInt64x2(x)
   729  		g := make([]uint64, 2)
   730  		f(a).Store(g)
   731  		w := want(x)
   732  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   733  	})
   734  }
   735  
   736  // testFloat64x2ConvertToUint64 tests the simd conversion method f against the expected behavior generated by want.
   737  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   738  // (extended to at least 128 bits, or truncated to at most 512 bits).
   739  func testFloat64x2ConvertToUint64(t *testing.T, f func(x archsimd.Float64x2) archsimd.Uint64x2, want func(x []float64) []uint64) {
   740  	n := 2
   741  	t.Helper()
   742  	forSlice(t, float64s, n, func(x []float64) bool {
   743  		t.Helper()
   744  		a := archsimd.LoadFloat64x2(x)
   745  		g := make([]uint64, 2)
   746  		f(a).Store(g)
   747  		w := want(x)
   748  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   749  	})
   750  }
   751  
   752  // testInt32x4ConvertToFloat32 tests the simd conversion method f against the expected behavior generated by want.
   753  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   754  // (extended to at least 128 bits, or truncated to at most 512 bits).
   755  func testInt32x4ConvertToFloat32(t *testing.T, f func(x archsimd.Int32x4) archsimd.Float32x4, want func(x []int32) []float32) {
   756  	n := 4
   757  	t.Helper()
   758  	forSlice(t, int32s, n, func(x []int32) bool {
   759  		t.Helper()
   760  		a := archsimd.LoadInt32x4(x)
   761  		g := make([]float32, 4)
   762  		f(a).Store(g)
   763  		w := want(x)
   764  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   765  	})
   766  }
   767  
   768  // testInt64x2ConvertToFloat32 tests the simd conversion method f against the expected behavior generated by want.
   769  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   770  // (extended to at least 128 bits, or truncated to at most 512 bits).
   771  func testInt64x2ConvertToFloat32(t *testing.T, f func(x archsimd.Int64x2) archsimd.Float32x4, want func(x []int64) []float32) {
   772  	n := 2
   773  	t.Helper()
   774  	forSlice(t, int64s, n, func(x []int64) bool {
   775  		t.Helper()
   776  		a := archsimd.LoadInt64x2(x)
   777  		g := make([]float32, 4)
   778  		f(a).Store(g)
   779  		w := want(x)
   780  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   781  	})
   782  }
   783  
   784  // testUint32x4ConvertToFloat32 tests the simd conversion method f against the expected behavior generated by want.
   785  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   786  // (extended to at least 128 bits, or truncated to at most 512 bits).
   787  func testUint32x4ConvertToFloat32(t *testing.T, f func(x archsimd.Uint32x4) archsimd.Float32x4, want func(x []uint32) []float32) {
   788  	n := 4
   789  	t.Helper()
   790  	forSlice(t, uint32s, n, func(x []uint32) bool {
   791  		t.Helper()
   792  		a := archsimd.LoadUint32x4(x)
   793  		g := make([]float32, 4)
   794  		f(a).Store(g)
   795  		w := want(x)
   796  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   797  	})
   798  }
   799  
   800  // testUint64x2ConvertToFloat32 tests the simd conversion method f against the expected behavior generated by want.
   801  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   802  // (extended to at least 128 bits, or truncated to at most 512 bits).
   803  func testUint64x2ConvertToFloat32(t *testing.T, f func(x archsimd.Uint64x2) archsimd.Float32x4, want func(x []uint64) []float32) {
   804  	n := 2
   805  	t.Helper()
   806  	forSlice(t, uint64s, n, func(x []uint64) bool {
   807  		t.Helper()
   808  		a := archsimd.LoadUint64x2(x)
   809  		g := make([]float32, 4)
   810  		f(a).Store(g)
   811  		w := want(x)
   812  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   813  	})
   814  }
   815  
   816  // testFloat64x2ConvertToFloat32 tests the simd conversion method f against the expected behavior generated by want.
   817  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   818  // (extended to at least 128 bits, or truncated to at most 512 bits).
   819  func testFloat64x2ConvertToFloat32(t *testing.T, f func(x archsimd.Float64x2) archsimd.Float32x4, want func(x []float64) []float32) {
   820  	n := 2
   821  	t.Helper()
   822  	forSlice(t, float64s, n, func(x []float64) bool {
   823  		t.Helper()
   824  		a := archsimd.LoadFloat64x2(x)
   825  		g := make([]float32, 4)
   826  		f(a).Store(g)
   827  		w := want(x)
   828  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   829  	})
   830  }
   831  
   832  // testInt64x2ConvertToFloat64 tests the simd conversion method f against the expected behavior generated by want.
   833  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   834  // (extended to at least 128 bits, or truncated to at most 512 bits).
   835  func testInt64x2ConvertToFloat64(t *testing.T, f func(x archsimd.Int64x2) archsimd.Float64x2, want func(x []int64) []float64) {
   836  	n := 2
   837  	t.Helper()
   838  	forSlice(t, int64s, n, func(x []int64) bool {
   839  		t.Helper()
   840  		a := archsimd.LoadInt64x2(x)
   841  		g := make([]float64, 2)
   842  		f(a).Store(g)
   843  		w := want(x)
   844  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   845  	})
   846  }
   847  
   848  // testUint64x2ConvertToFloat64 tests the simd conversion method f against the expected behavior generated by want.
   849  // This is for count-preserving conversions, so if there is a change in size, then there is a change in vector width,
   850  // (extended to at least 128 bits, or truncated to at most 512 bits).
   851  func testUint64x2ConvertToFloat64(t *testing.T, f func(x archsimd.Uint64x2) archsimd.Float64x2, want func(x []uint64) []float64) {
   852  	n := 2
   853  	t.Helper()
   854  	forSlice(t, uint64s, n, func(x []uint64) bool {
   855  		t.Helper()
   856  		a := archsimd.LoadUint64x2(x)
   857  		g := make([]float64, 2)
   858  		f(a).Store(g)
   859  		w := want(x)
   860  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   861  	})
   862  }
   863  
   864  // testInt8x16ConvertLoToInt64x2 tests the simd conversion method f against the expected behavior generated by want.
   865  // This converts only the low 2 elements.
   866  func testInt8x16ConvertLoToInt64x2(t *testing.T, f func(x archsimd.Int8x16) archsimd.Int64x2, want func(x []int8) []int64) {
   867  	n := 16
   868  	t.Helper()
   869  	forSlice(t, int8s, n, func(x []int8) bool {
   870  		t.Helper()
   871  		a := archsimd.LoadInt8x16(x)
   872  		g := make([]int64, 2)
   873  		f(a).Store(g)
   874  		w := want(x)
   875  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   876  	})
   877  }
   878  
   879  // testInt16x8ConvertLoToInt64x2 tests the simd conversion method f against the expected behavior generated by want.
   880  // This converts only the low 2 elements.
   881  func testInt16x8ConvertLoToInt64x2(t *testing.T, f func(x archsimd.Int16x8) archsimd.Int64x2, want func(x []int16) []int64) {
   882  	n := 8
   883  	t.Helper()
   884  	forSlice(t, int16s, n, func(x []int16) bool {
   885  		t.Helper()
   886  		a := archsimd.LoadInt16x8(x)
   887  		g := make([]int64, 2)
   888  		f(a).Store(g)
   889  		w := want(x)
   890  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   891  	})
   892  }
   893  
   894  // testInt32x4ConvertLoToInt64x2 tests the simd conversion method f against the expected behavior generated by want.
   895  // This converts only the low 2 elements.
   896  func testInt32x4ConvertLoToInt64x2(t *testing.T, f func(x archsimd.Int32x4) archsimd.Int64x2, want func(x []int32) []int64) {
   897  	n := 4
   898  	t.Helper()
   899  	forSlice(t, int32s, n, func(x []int32) bool {
   900  		t.Helper()
   901  		a := archsimd.LoadInt32x4(x)
   902  		g := make([]int64, 2)
   903  		f(a).Store(g)
   904  		w := want(x)
   905  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   906  	})
   907  }
   908  
   909  // testInt64x2ConvertLoToInt64x2 tests the simd conversion method f against the expected behavior generated by want.
   910  // This converts only the low 2 elements.
   911  func testInt64x2ConvertLoToInt64x2(t *testing.T, f func(x archsimd.Int64x2) archsimd.Int64x2, want func(x []int64) []int64) {
   912  	n := 2
   913  	t.Helper()
   914  	forSlice(t, int64s, n, func(x []int64) bool {
   915  		t.Helper()
   916  		a := archsimd.LoadInt64x2(x)
   917  		g := make([]int64, 2)
   918  		f(a).Store(g)
   919  		w := want(x)
   920  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   921  	})
   922  }
   923  
   924  // testUint8x16ConvertLoToInt64x2 tests the simd conversion method f against the expected behavior generated by want.
   925  // This converts only the low 2 elements.
   926  func testUint8x16ConvertLoToInt64x2(t *testing.T, f func(x archsimd.Uint8x16) archsimd.Int64x2, want func(x []uint8) []int64) {
   927  	n := 16
   928  	t.Helper()
   929  	forSlice(t, uint8s, n, func(x []uint8) bool {
   930  		t.Helper()
   931  		a := archsimd.LoadUint8x16(x)
   932  		g := make([]int64, 2)
   933  		f(a).Store(g)
   934  		w := want(x)
   935  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   936  	})
   937  }
   938  
   939  // testUint16x8ConvertLoToInt64x2 tests the simd conversion method f against the expected behavior generated by want.
   940  // This converts only the low 2 elements.
   941  func testUint16x8ConvertLoToInt64x2(t *testing.T, f func(x archsimd.Uint16x8) archsimd.Int64x2, want func(x []uint16) []int64) {
   942  	n := 8
   943  	t.Helper()
   944  	forSlice(t, uint16s, n, func(x []uint16) bool {
   945  		t.Helper()
   946  		a := archsimd.LoadUint16x8(x)
   947  		g := make([]int64, 2)
   948  		f(a).Store(g)
   949  		w := want(x)
   950  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   951  	})
   952  }
   953  
   954  // testUint32x4ConvertLoToInt64x2 tests the simd conversion method f against the expected behavior generated by want.
   955  // This converts only the low 2 elements.
   956  func testUint32x4ConvertLoToInt64x2(t *testing.T, f func(x archsimd.Uint32x4) archsimd.Int64x2, want func(x []uint32) []int64) {
   957  	n := 4
   958  	t.Helper()
   959  	forSlice(t, uint32s, n, func(x []uint32) bool {
   960  		t.Helper()
   961  		a := archsimd.LoadUint32x4(x)
   962  		g := make([]int64, 2)
   963  		f(a).Store(g)
   964  		w := want(x)
   965  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   966  	})
   967  }
   968  
   969  // testUint64x2ConvertLoToInt64x2 tests the simd conversion method f against the expected behavior generated by want.
   970  // This converts only the low 2 elements.
   971  func testUint64x2ConvertLoToInt64x2(t *testing.T, f func(x archsimd.Uint64x2) archsimd.Int64x2, want func(x []uint64) []int64) {
   972  	n := 2
   973  	t.Helper()
   974  	forSlice(t, uint64s, n, func(x []uint64) bool {
   975  		t.Helper()
   976  		a := archsimd.LoadUint64x2(x)
   977  		g := make([]int64, 2)
   978  		f(a).Store(g)
   979  		w := want(x)
   980  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   981  	})
   982  }
   983  
   984  // testFloat32x4ConvertLoToInt64x2 tests the simd conversion method f against the expected behavior generated by want.
   985  // This converts only the low 2 elements.
   986  func testFloat32x4ConvertLoToInt64x2(t *testing.T, f func(x archsimd.Float32x4) archsimd.Int64x2, want func(x []float32) []int64) {
   987  	n := 4
   988  	t.Helper()
   989  	forSlice(t, float32s, n, func(x []float32) bool {
   990  		t.Helper()
   991  		a := archsimd.LoadFloat32x4(x)
   992  		g := make([]int64, 2)
   993  		f(a).Store(g)
   994  		w := want(x)
   995  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
   996  	})
   997  }
   998  
   999  // testFloat64x2ConvertLoToInt64x2 tests the simd conversion method f against the expected behavior generated by want.
  1000  // This converts only the low 2 elements.
  1001  func testFloat64x2ConvertLoToInt64x2(t *testing.T, f func(x archsimd.Float64x2) archsimd.Int64x2, want func(x []float64) []int64) {
  1002  	n := 2
  1003  	t.Helper()
  1004  	forSlice(t, float64s, n, func(x []float64) bool {
  1005  		t.Helper()
  1006  		a := archsimd.LoadFloat64x2(x)
  1007  		g := make([]int64, 2)
  1008  		f(a).Store(g)
  1009  		w := want(x)
  1010  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1011  	})
  1012  }
  1013  
  1014  // testInt8x16ConvertLoToUint64x2 tests the simd conversion method f against the expected behavior generated by want.
  1015  // This converts only the low 2 elements.
  1016  func testInt8x16ConvertLoToUint64x2(t *testing.T, f func(x archsimd.Int8x16) archsimd.Uint64x2, want func(x []int8) []uint64) {
  1017  	n := 16
  1018  	t.Helper()
  1019  	forSlice(t, int8s, n, func(x []int8) bool {
  1020  		t.Helper()
  1021  		a := archsimd.LoadInt8x16(x)
  1022  		g := make([]uint64, 2)
  1023  		f(a).Store(g)
  1024  		w := want(x)
  1025  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1026  	})
  1027  }
  1028  
  1029  // testInt16x8ConvertLoToUint64x2 tests the simd conversion method f against the expected behavior generated by want.
  1030  // This converts only the low 2 elements.
  1031  func testInt16x8ConvertLoToUint64x2(t *testing.T, f func(x archsimd.Int16x8) archsimd.Uint64x2, want func(x []int16) []uint64) {
  1032  	n := 8
  1033  	t.Helper()
  1034  	forSlice(t, int16s, n, func(x []int16) bool {
  1035  		t.Helper()
  1036  		a := archsimd.LoadInt16x8(x)
  1037  		g := make([]uint64, 2)
  1038  		f(a).Store(g)
  1039  		w := want(x)
  1040  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1041  	})
  1042  }
  1043  
  1044  // testInt32x4ConvertLoToUint64x2 tests the simd conversion method f against the expected behavior generated by want.
  1045  // This converts only the low 2 elements.
  1046  func testInt32x4ConvertLoToUint64x2(t *testing.T, f func(x archsimd.Int32x4) archsimd.Uint64x2, want func(x []int32) []uint64) {
  1047  	n := 4
  1048  	t.Helper()
  1049  	forSlice(t, int32s, n, func(x []int32) bool {
  1050  		t.Helper()
  1051  		a := archsimd.LoadInt32x4(x)
  1052  		g := make([]uint64, 2)
  1053  		f(a).Store(g)
  1054  		w := want(x)
  1055  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1056  	})
  1057  }
  1058  
  1059  // testInt64x2ConvertLoToUint64x2 tests the simd conversion method f against the expected behavior generated by want.
  1060  // This converts only the low 2 elements.
  1061  func testInt64x2ConvertLoToUint64x2(t *testing.T, f func(x archsimd.Int64x2) archsimd.Uint64x2, want func(x []int64) []uint64) {
  1062  	n := 2
  1063  	t.Helper()
  1064  	forSlice(t, int64s, n, func(x []int64) bool {
  1065  		t.Helper()
  1066  		a := archsimd.LoadInt64x2(x)
  1067  		g := make([]uint64, 2)
  1068  		f(a).Store(g)
  1069  		w := want(x)
  1070  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1071  	})
  1072  }
  1073  
  1074  // testUint8x16ConvertLoToUint64x2 tests the simd conversion method f against the expected behavior generated by want.
  1075  // This converts only the low 2 elements.
  1076  func testUint8x16ConvertLoToUint64x2(t *testing.T, f func(x archsimd.Uint8x16) archsimd.Uint64x2, want func(x []uint8) []uint64) {
  1077  	n := 16
  1078  	t.Helper()
  1079  	forSlice(t, uint8s, n, func(x []uint8) bool {
  1080  		t.Helper()
  1081  		a := archsimd.LoadUint8x16(x)
  1082  		g := make([]uint64, 2)
  1083  		f(a).Store(g)
  1084  		w := want(x)
  1085  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1086  	})
  1087  }
  1088  
  1089  // testUint16x8ConvertLoToUint64x2 tests the simd conversion method f against the expected behavior generated by want.
  1090  // This converts only the low 2 elements.
  1091  func testUint16x8ConvertLoToUint64x2(t *testing.T, f func(x archsimd.Uint16x8) archsimd.Uint64x2, want func(x []uint16) []uint64) {
  1092  	n := 8
  1093  	t.Helper()
  1094  	forSlice(t, uint16s, n, func(x []uint16) bool {
  1095  		t.Helper()
  1096  		a := archsimd.LoadUint16x8(x)
  1097  		g := make([]uint64, 2)
  1098  		f(a).Store(g)
  1099  		w := want(x)
  1100  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1101  	})
  1102  }
  1103  
  1104  // testUint32x4ConvertLoToUint64x2 tests the simd conversion method f against the expected behavior generated by want.
  1105  // This converts only the low 2 elements.
  1106  func testUint32x4ConvertLoToUint64x2(t *testing.T, f func(x archsimd.Uint32x4) archsimd.Uint64x2, want func(x []uint32) []uint64) {
  1107  	n := 4
  1108  	t.Helper()
  1109  	forSlice(t, uint32s, n, func(x []uint32) bool {
  1110  		t.Helper()
  1111  		a := archsimd.LoadUint32x4(x)
  1112  		g := make([]uint64, 2)
  1113  		f(a).Store(g)
  1114  		w := want(x)
  1115  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1116  	})
  1117  }
  1118  
  1119  // testUint64x2ConvertLoToUint64x2 tests the simd conversion method f against the expected behavior generated by want.
  1120  // This converts only the low 2 elements.
  1121  func testUint64x2ConvertLoToUint64x2(t *testing.T, f func(x archsimd.Uint64x2) archsimd.Uint64x2, want func(x []uint64) []uint64) {
  1122  	n := 2
  1123  	t.Helper()
  1124  	forSlice(t, uint64s, n, func(x []uint64) bool {
  1125  		t.Helper()
  1126  		a := archsimd.LoadUint64x2(x)
  1127  		g := make([]uint64, 2)
  1128  		f(a).Store(g)
  1129  		w := want(x)
  1130  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1131  	})
  1132  }
  1133  
  1134  // testFloat32x4ConvertLoToUint64x2 tests the simd conversion method f against the expected behavior generated by want.
  1135  // This converts only the low 2 elements.
  1136  func testFloat32x4ConvertLoToUint64x2(t *testing.T, f func(x archsimd.Float32x4) archsimd.Uint64x2, want func(x []float32) []uint64) {
  1137  	n := 4
  1138  	t.Helper()
  1139  	forSlice(t, float32s, n, func(x []float32) bool {
  1140  		t.Helper()
  1141  		a := archsimd.LoadFloat32x4(x)
  1142  		g := make([]uint64, 2)
  1143  		f(a).Store(g)
  1144  		w := want(x)
  1145  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1146  	})
  1147  }
  1148  
  1149  // testFloat64x2ConvertLoToUint64x2 tests the simd conversion method f against the expected behavior generated by want.
  1150  // This converts only the low 2 elements.
  1151  func testFloat64x2ConvertLoToUint64x2(t *testing.T, f func(x archsimd.Float64x2) archsimd.Uint64x2, want func(x []float64) []uint64) {
  1152  	n := 2
  1153  	t.Helper()
  1154  	forSlice(t, float64s, n, func(x []float64) bool {
  1155  		t.Helper()
  1156  		a := archsimd.LoadFloat64x2(x)
  1157  		g := make([]uint64, 2)
  1158  		f(a).Store(g)
  1159  		w := want(x)
  1160  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1161  	})
  1162  }
  1163  
  1164  // testInt8x16ConvertLoToInt32x4 tests the simd conversion method f against the expected behavior generated by want.
  1165  // This converts only the low 4 elements.
  1166  func testInt8x16ConvertLoToInt32x4(t *testing.T, f func(x archsimd.Int8x16) archsimd.Int32x4, want func(x []int8) []int32) {
  1167  	n := 16
  1168  	t.Helper()
  1169  	forSlice(t, int8s, n, func(x []int8) bool {
  1170  		t.Helper()
  1171  		a := archsimd.LoadInt8x16(x)
  1172  		g := make([]int32, 4)
  1173  		f(a).Store(g)
  1174  		w := want(x)
  1175  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1176  	})
  1177  }
  1178  
  1179  // testInt16x8ConvertLoToInt32x4 tests the simd conversion method f against the expected behavior generated by want.
  1180  // This converts only the low 4 elements.
  1181  func testInt16x8ConvertLoToInt32x4(t *testing.T, f func(x archsimd.Int16x8) archsimd.Int32x4, want func(x []int16) []int32) {
  1182  	n := 8
  1183  	t.Helper()
  1184  	forSlice(t, int16s, n, func(x []int16) bool {
  1185  		t.Helper()
  1186  		a := archsimd.LoadInt16x8(x)
  1187  		g := make([]int32, 4)
  1188  		f(a).Store(g)
  1189  		w := want(x)
  1190  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1191  	})
  1192  }
  1193  
  1194  // testInt32x4ConvertLoToInt32x4 tests the simd conversion method f against the expected behavior generated by want.
  1195  // This converts only the low 4 elements.
  1196  func testInt32x4ConvertLoToInt32x4(t *testing.T, f func(x archsimd.Int32x4) archsimd.Int32x4, want func(x []int32) []int32) {
  1197  	n := 4
  1198  	t.Helper()
  1199  	forSlice(t, int32s, n, func(x []int32) bool {
  1200  		t.Helper()
  1201  		a := archsimd.LoadInt32x4(x)
  1202  		g := make([]int32, 4)
  1203  		f(a).Store(g)
  1204  		w := want(x)
  1205  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1206  	})
  1207  }
  1208  
  1209  // testInt64x2ConvertLoToInt32x4 tests the simd conversion method f against the expected behavior generated by want.
  1210  // This converts only the low 4 elements.
  1211  func testInt64x2ConvertLoToInt32x4(t *testing.T, f func(x archsimd.Int64x2) archsimd.Int32x4, want func(x []int64) []int32) {
  1212  	n := 2
  1213  	t.Helper()
  1214  	forSlice(t, int64s, n, func(x []int64) bool {
  1215  		t.Helper()
  1216  		a := archsimd.LoadInt64x2(x)
  1217  		g := make([]int32, 4)
  1218  		f(a).Store(g)
  1219  		w := want(x)
  1220  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1221  	})
  1222  }
  1223  
  1224  // testUint8x16ConvertLoToInt32x4 tests the simd conversion method f against the expected behavior generated by want.
  1225  // This converts only the low 4 elements.
  1226  func testUint8x16ConvertLoToInt32x4(t *testing.T, f func(x archsimd.Uint8x16) archsimd.Int32x4, want func(x []uint8) []int32) {
  1227  	n := 16
  1228  	t.Helper()
  1229  	forSlice(t, uint8s, n, func(x []uint8) bool {
  1230  		t.Helper()
  1231  		a := archsimd.LoadUint8x16(x)
  1232  		g := make([]int32, 4)
  1233  		f(a).Store(g)
  1234  		w := want(x)
  1235  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1236  	})
  1237  }
  1238  
  1239  // testUint16x8ConvertLoToInt32x4 tests the simd conversion method f against the expected behavior generated by want.
  1240  // This converts only the low 4 elements.
  1241  func testUint16x8ConvertLoToInt32x4(t *testing.T, f func(x archsimd.Uint16x8) archsimd.Int32x4, want func(x []uint16) []int32) {
  1242  	n := 8
  1243  	t.Helper()
  1244  	forSlice(t, uint16s, n, func(x []uint16) bool {
  1245  		t.Helper()
  1246  		a := archsimd.LoadUint16x8(x)
  1247  		g := make([]int32, 4)
  1248  		f(a).Store(g)
  1249  		w := want(x)
  1250  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1251  	})
  1252  }
  1253  
  1254  // testUint32x4ConvertLoToInt32x4 tests the simd conversion method f against the expected behavior generated by want.
  1255  // This converts only the low 4 elements.
  1256  func testUint32x4ConvertLoToInt32x4(t *testing.T, f func(x archsimd.Uint32x4) archsimd.Int32x4, want func(x []uint32) []int32) {
  1257  	n := 4
  1258  	t.Helper()
  1259  	forSlice(t, uint32s, n, func(x []uint32) bool {
  1260  		t.Helper()
  1261  		a := archsimd.LoadUint32x4(x)
  1262  		g := make([]int32, 4)
  1263  		f(a).Store(g)
  1264  		w := want(x)
  1265  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1266  	})
  1267  }
  1268  
  1269  // testUint64x2ConvertLoToInt32x4 tests the simd conversion method f against the expected behavior generated by want.
  1270  // This converts only the low 4 elements.
  1271  func testUint64x2ConvertLoToInt32x4(t *testing.T, f func(x archsimd.Uint64x2) archsimd.Int32x4, want func(x []uint64) []int32) {
  1272  	n := 2
  1273  	t.Helper()
  1274  	forSlice(t, uint64s, n, func(x []uint64) bool {
  1275  		t.Helper()
  1276  		a := archsimd.LoadUint64x2(x)
  1277  		g := make([]int32, 4)
  1278  		f(a).Store(g)
  1279  		w := want(x)
  1280  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1281  	})
  1282  }
  1283  
  1284  // testFloat32x4ConvertLoToInt32x4 tests the simd conversion method f against the expected behavior generated by want.
  1285  // This converts only the low 4 elements.
  1286  func testFloat32x4ConvertLoToInt32x4(t *testing.T, f func(x archsimd.Float32x4) archsimd.Int32x4, want func(x []float32) []int32) {
  1287  	n := 4
  1288  	t.Helper()
  1289  	forSlice(t, float32s, n, func(x []float32) bool {
  1290  		t.Helper()
  1291  		a := archsimd.LoadFloat32x4(x)
  1292  		g := make([]int32, 4)
  1293  		f(a).Store(g)
  1294  		w := want(x)
  1295  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1296  	})
  1297  }
  1298  
  1299  // testFloat64x2ConvertLoToInt32x4 tests the simd conversion method f against the expected behavior generated by want.
  1300  // This converts only the low 4 elements.
  1301  func testFloat64x2ConvertLoToInt32x4(t *testing.T, f func(x archsimd.Float64x2) archsimd.Int32x4, want func(x []float64) []int32) {
  1302  	n := 2
  1303  	t.Helper()
  1304  	forSlice(t, float64s, n, func(x []float64) bool {
  1305  		t.Helper()
  1306  		a := archsimd.LoadFloat64x2(x)
  1307  		g := make([]int32, 4)
  1308  		f(a).Store(g)
  1309  		w := want(x)
  1310  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1311  	})
  1312  }
  1313  
  1314  // testInt8x16ConvertLoToUint32x4 tests the simd conversion method f against the expected behavior generated by want.
  1315  // This converts only the low 4 elements.
  1316  func testInt8x16ConvertLoToUint32x4(t *testing.T, f func(x archsimd.Int8x16) archsimd.Uint32x4, want func(x []int8) []uint32) {
  1317  	n := 16
  1318  	t.Helper()
  1319  	forSlice(t, int8s, n, func(x []int8) bool {
  1320  		t.Helper()
  1321  		a := archsimd.LoadInt8x16(x)
  1322  		g := make([]uint32, 4)
  1323  		f(a).Store(g)
  1324  		w := want(x)
  1325  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1326  	})
  1327  }
  1328  
  1329  // testInt16x8ConvertLoToUint32x4 tests the simd conversion method f against the expected behavior generated by want.
  1330  // This converts only the low 4 elements.
  1331  func testInt16x8ConvertLoToUint32x4(t *testing.T, f func(x archsimd.Int16x8) archsimd.Uint32x4, want func(x []int16) []uint32) {
  1332  	n := 8
  1333  	t.Helper()
  1334  	forSlice(t, int16s, n, func(x []int16) bool {
  1335  		t.Helper()
  1336  		a := archsimd.LoadInt16x8(x)
  1337  		g := make([]uint32, 4)
  1338  		f(a).Store(g)
  1339  		w := want(x)
  1340  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1341  	})
  1342  }
  1343  
  1344  // testInt32x4ConvertLoToUint32x4 tests the simd conversion method f against the expected behavior generated by want.
  1345  // This converts only the low 4 elements.
  1346  func testInt32x4ConvertLoToUint32x4(t *testing.T, f func(x archsimd.Int32x4) archsimd.Uint32x4, want func(x []int32) []uint32) {
  1347  	n := 4
  1348  	t.Helper()
  1349  	forSlice(t, int32s, n, func(x []int32) bool {
  1350  		t.Helper()
  1351  		a := archsimd.LoadInt32x4(x)
  1352  		g := make([]uint32, 4)
  1353  		f(a).Store(g)
  1354  		w := want(x)
  1355  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1356  	})
  1357  }
  1358  
  1359  // testInt64x2ConvertLoToUint32x4 tests the simd conversion method f against the expected behavior generated by want.
  1360  // This converts only the low 4 elements.
  1361  func testInt64x2ConvertLoToUint32x4(t *testing.T, f func(x archsimd.Int64x2) archsimd.Uint32x4, want func(x []int64) []uint32) {
  1362  	n := 2
  1363  	t.Helper()
  1364  	forSlice(t, int64s, n, func(x []int64) bool {
  1365  		t.Helper()
  1366  		a := archsimd.LoadInt64x2(x)
  1367  		g := make([]uint32, 4)
  1368  		f(a).Store(g)
  1369  		w := want(x)
  1370  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1371  	})
  1372  }
  1373  
  1374  // testUint8x16ConvertLoToUint32x4 tests the simd conversion method f against the expected behavior generated by want.
  1375  // This converts only the low 4 elements.
  1376  func testUint8x16ConvertLoToUint32x4(t *testing.T, f func(x archsimd.Uint8x16) archsimd.Uint32x4, want func(x []uint8) []uint32) {
  1377  	n := 16
  1378  	t.Helper()
  1379  	forSlice(t, uint8s, n, func(x []uint8) bool {
  1380  		t.Helper()
  1381  		a := archsimd.LoadUint8x16(x)
  1382  		g := make([]uint32, 4)
  1383  		f(a).Store(g)
  1384  		w := want(x)
  1385  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1386  	})
  1387  }
  1388  
  1389  // testUint16x8ConvertLoToUint32x4 tests the simd conversion method f against the expected behavior generated by want.
  1390  // This converts only the low 4 elements.
  1391  func testUint16x8ConvertLoToUint32x4(t *testing.T, f func(x archsimd.Uint16x8) archsimd.Uint32x4, want func(x []uint16) []uint32) {
  1392  	n := 8
  1393  	t.Helper()
  1394  	forSlice(t, uint16s, n, func(x []uint16) bool {
  1395  		t.Helper()
  1396  		a := archsimd.LoadUint16x8(x)
  1397  		g := make([]uint32, 4)
  1398  		f(a).Store(g)
  1399  		w := want(x)
  1400  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1401  	})
  1402  }
  1403  
  1404  // testUint32x4ConvertLoToUint32x4 tests the simd conversion method f against the expected behavior generated by want.
  1405  // This converts only the low 4 elements.
  1406  func testUint32x4ConvertLoToUint32x4(t *testing.T, f func(x archsimd.Uint32x4) archsimd.Uint32x4, want func(x []uint32) []uint32) {
  1407  	n := 4
  1408  	t.Helper()
  1409  	forSlice(t, uint32s, n, func(x []uint32) bool {
  1410  		t.Helper()
  1411  		a := archsimd.LoadUint32x4(x)
  1412  		g := make([]uint32, 4)
  1413  		f(a).Store(g)
  1414  		w := want(x)
  1415  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1416  	})
  1417  }
  1418  
  1419  // testUint64x2ConvertLoToUint32x4 tests the simd conversion method f against the expected behavior generated by want.
  1420  // This converts only the low 4 elements.
  1421  func testUint64x2ConvertLoToUint32x4(t *testing.T, f func(x archsimd.Uint64x2) archsimd.Uint32x4, want func(x []uint64) []uint32) {
  1422  	n := 2
  1423  	t.Helper()
  1424  	forSlice(t, uint64s, n, func(x []uint64) bool {
  1425  		t.Helper()
  1426  		a := archsimd.LoadUint64x2(x)
  1427  		g := make([]uint32, 4)
  1428  		f(a).Store(g)
  1429  		w := want(x)
  1430  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1431  	})
  1432  }
  1433  
  1434  // testFloat32x4ConvertLoToUint32x4 tests the simd conversion method f against the expected behavior generated by want.
  1435  // This converts only the low 4 elements.
  1436  func testFloat32x4ConvertLoToUint32x4(t *testing.T, f func(x archsimd.Float32x4) archsimd.Uint32x4, want func(x []float32) []uint32) {
  1437  	n := 4
  1438  	t.Helper()
  1439  	forSlice(t, float32s, n, func(x []float32) bool {
  1440  		t.Helper()
  1441  		a := archsimd.LoadFloat32x4(x)
  1442  		g := make([]uint32, 4)
  1443  		f(a).Store(g)
  1444  		w := want(x)
  1445  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1446  	})
  1447  }
  1448  
  1449  // testFloat64x2ConvertLoToUint32x4 tests the simd conversion method f against the expected behavior generated by want.
  1450  // This converts only the low 4 elements.
  1451  func testFloat64x2ConvertLoToUint32x4(t *testing.T, f func(x archsimd.Float64x2) archsimd.Uint32x4, want func(x []float64) []uint32) {
  1452  	n := 2
  1453  	t.Helper()
  1454  	forSlice(t, float64s, n, func(x []float64) bool {
  1455  		t.Helper()
  1456  		a := archsimd.LoadFloat64x2(x)
  1457  		g := make([]uint32, 4)
  1458  		f(a).Store(g)
  1459  		w := want(x)
  1460  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1461  	})
  1462  }
  1463  
  1464  // testInt8x16ConvertLoToInt16x8 tests the simd conversion method f against the expected behavior generated by want.
  1465  // This converts only the low 8 elements.
  1466  func testInt8x16ConvertLoToInt16x8(t *testing.T, f func(x archsimd.Int8x16) archsimd.Int16x8, want func(x []int8) []int16) {
  1467  	n := 16
  1468  	t.Helper()
  1469  	forSlice(t, int8s, n, func(x []int8) bool {
  1470  		t.Helper()
  1471  		a := archsimd.LoadInt8x16(x)
  1472  		g := make([]int16, 8)
  1473  		f(a).Store(g)
  1474  		w := want(x)
  1475  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1476  	})
  1477  }
  1478  
  1479  // testInt16x8ConvertLoToInt16x8 tests the simd conversion method f against the expected behavior generated by want.
  1480  // This converts only the low 8 elements.
  1481  func testInt16x8ConvertLoToInt16x8(t *testing.T, f func(x archsimd.Int16x8) archsimd.Int16x8, want func(x []int16) []int16) {
  1482  	n := 8
  1483  	t.Helper()
  1484  	forSlice(t, int16s, n, func(x []int16) bool {
  1485  		t.Helper()
  1486  		a := archsimd.LoadInt16x8(x)
  1487  		g := make([]int16, 8)
  1488  		f(a).Store(g)
  1489  		w := want(x)
  1490  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1491  	})
  1492  }
  1493  
  1494  // testInt32x4ConvertLoToInt16x8 tests the simd conversion method f against the expected behavior generated by want.
  1495  // This converts only the low 8 elements.
  1496  func testInt32x4ConvertLoToInt16x8(t *testing.T, f func(x archsimd.Int32x4) archsimd.Int16x8, want func(x []int32) []int16) {
  1497  	n := 4
  1498  	t.Helper()
  1499  	forSlice(t, int32s, n, func(x []int32) bool {
  1500  		t.Helper()
  1501  		a := archsimd.LoadInt32x4(x)
  1502  		g := make([]int16, 8)
  1503  		f(a).Store(g)
  1504  		w := want(x)
  1505  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1506  	})
  1507  }
  1508  
  1509  // testInt64x2ConvertLoToInt16x8 tests the simd conversion method f against the expected behavior generated by want.
  1510  // This converts only the low 8 elements.
  1511  func testInt64x2ConvertLoToInt16x8(t *testing.T, f func(x archsimd.Int64x2) archsimd.Int16x8, want func(x []int64) []int16) {
  1512  	n := 2
  1513  	t.Helper()
  1514  	forSlice(t, int64s, n, func(x []int64) bool {
  1515  		t.Helper()
  1516  		a := archsimd.LoadInt64x2(x)
  1517  		g := make([]int16, 8)
  1518  		f(a).Store(g)
  1519  		w := want(x)
  1520  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1521  	})
  1522  }
  1523  
  1524  // testUint8x16ConvertLoToInt16x8 tests the simd conversion method f against the expected behavior generated by want.
  1525  // This converts only the low 8 elements.
  1526  func testUint8x16ConvertLoToInt16x8(t *testing.T, f func(x archsimd.Uint8x16) archsimd.Int16x8, want func(x []uint8) []int16) {
  1527  	n := 16
  1528  	t.Helper()
  1529  	forSlice(t, uint8s, n, func(x []uint8) bool {
  1530  		t.Helper()
  1531  		a := archsimd.LoadUint8x16(x)
  1532  		g := make([]int16, 8)
  1533  		f(a).Store(g)
  1534  		w := want(x)
  1535  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1536  	})
  1537  }
  1538  
  1539  // testUint16x8ConvertLoToInt16x8 tests the simd conversion method f against the expected behavior generated by want.
  1540  // This converts only the low 8 elements.
  1541  func testUint16x8ConvertLoToInt16x8(t *testing.T, f func(x archsimd.Uint16x8) archsimd.Int16x8, want func(x []uint16) []int16) {
  1542  	n := 8
  1543  	t.Helper()
  1544  	forSlice(t, uint16s, n, func(x []uint16) bool {
  1545  		t.Helper()
  1546  		a := archsimd.LoadUint16x8(x)
  1547  		g := make([]int16, 8)
  1548  		f(a).Store(g)
  1549  		w := want(x)
  1550  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1551  	})
  1552  }
  1553  
  1554  // testUint32x4ConvertLoToInt16x8 tests the simd conversion method f against the expected behavior generated by want.
  1555  // This converts only the low 8 elements.
  1556  func testUint32x4ConvertLoToInt16x8(t *testing.T, f func(x archsimd.Uint32x4) archsimd.Int16x8, want func(x []uint32) []int16) {
  1557  	n := 4
  1558  	t.Helper()
  1559  	forSlice(t, uint32s, n, func(x []uint32) bool {
  1560  		t.Helper()
  1561  		a := archsimd.LoadUint32x4(x)
  1562  		g := make([]int16, 8)
  1563  		f(a).Store(g)
  1564  		w := want(x)
  1565  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1566  	})
  1567  }
  1568  
  1569  // testUint64x2ConvertLoToInt16x8 tests the simd conversion method f against the expected behavior generated by want.
  1570  // This converts only the low 8 elements.
  1571  func testUint64x2ConvertLoToInt16x8(t *testing.T, f func(x archsimd.Uint64x2) archsimd.Int16x8, want func(x []uint64) []int16) {
  1572  	n := 2
  1573  	t.Helper()
  1574  	forSlice(t, uint64s, n, func(x []uint64) bool {
  1575  		t.Helper()
  1576  		a := archsimd.LoadUint64x2(x)
  1577  		g := make([]int16, 8)
  1578  		f(a).Store(g)
  1579  		w := want(x)
  1580  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1581  	})
  1582  }
  1583  
  1584  // testFloat32x4ConvertLoToInt16x8 tests the simd conversion method f against the expected behavior generated by want.
  1585  // This converts only the low 8 elements.
  1586  func testFloat32x4ConvertLoToInt16x8(t *testing.T, f func(x archsimd.Float32x4) archsimd.Int16x8, want func(x []float32) []int16) {
  1587  	n := 4
  1588  	t.Helper()
  1589  	forSlice(t, float32s, n, func(x []float32) bool {
  1590  		t.Helper()
  1591  		a := archsimd.LoadFloat32x4(x)
  1592  		g := make([]int16, 8)
  1593  		f(a).Store(g)
  1594  		w := want(x)
  1595  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1596  	})
  1597  }
  1598  
  1599  // testFloat64x2ConvertLoToInt16x8 tests the simd conversion method f against the expected behavior generated by want.
  1600  // This converts only the low 8 elements.
  1601  func testFloat64x2ConvertLoToInt16x8(t *testing.T, f func(x archsimd.Float64x2) archsimd.Int16x8, want func(x []float64) []int16) {
  1602  	n := 2
  1603  	t.Helper()
  1604  	forSlice(t, float64s, n, func(x []float64) bool {
  1605  		t.Helper()
  1606  		a := archsimd.LoadFloat64x2(x)
  1607  		g := make([]int16, 8)
  1608  		f(a).Store(g)
  1609  		w := want(x)
  1610  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1611  	})
  1612  }
  1613  
  1614  // testInt8x16ConvertLoToUint16x8 tests the simd conversion method f against the expected behavior generated by want.
  1615  // This converts only the low 8 elements.
  1616  func testInt8x16ConvertLoToUint16x8(t *testing.T, f func(x archsimd.Int8x16) archsimd.Uint16x8, want func(x []int8) []uint16) {
  1617  	n := 16
  1618  	t.Helper()
  1619  	forSlice(t, int8s, n, func(x []int8) bool {
  1620  		t.Helper()
  1621  		a := archsimd.LoadInt8x16(x)
  1622  		g := make([]uint16, 8)
  1623  		f(a).Store(g)
  1624  		w := want(x)
  1625  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1626  	})
  1627  }
  1628  
  1629  // testInt16x8ConvertLoToUint16x8 tests the simd conversion method f against the expected behavior generated by want.
  1630  // This converts only the low 8 elements.
  1631  func testInt16x8ConvertLoToUint16x8(t *testing.T, f func(x archsimd.Int16x8) archsimd.Uint16x8, want func(x []int16) []uint16) {
  1632  	n := 8
  1633  	t.Helper()
  1634  	forSlice(t, int16s, n, func(x []int16) bool {
  1635  		t.Helper()
  1636  		a := archsimd.LoadInt16x8(x)
  1637  		g := make([]uint16, 8)
  1638  		f(a).Store(g)
  1639  		w := want(x)
  1640  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1641  	})
  1642  }
  1643  
  1644  // testInt32x4ConvertLoToUint16x8 tests the simd conversion method f against the expected behavior generated by want.
  1645  // This converts only the low 8 elements.
  1646  func testInt32x4ConvertLoToUint16x8(t *testing.T, f func(x archsimd.Int32x4) archsimd.Uint16x8, want func(x []int32) []uint16) {
  1647  	n := 4
  1648  	t.Helper()
  1649  	forSlice(t, int32s, n, func(x []int32) bool {
  1650  		t.Helper()
  1651  		a := archsimd.LoadInt32x4(x)
  1652  		g := make([]uint16, 8)
  1653  		f(a).Store(g)
  1654  		w := want(x)
  1655  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1656  	})
  1657  }
  1658  
  1659  // testInt64x2ConvertLoToUint16x8 tests the simd conversion method f against the expected behavior generated by want.
  1660  // This converts only the low 8 elements.
  1661  func testInt64x2ConvertLoToUint16x8(t *testing.T, f func(x archsimd.Int64x2) archsimd.Uint16x8, want func(x []int64) []uint16) {
  1662  	n := 2
  1663  	t.Helper()
  1664  	forSlice(t, int64s, n, func(x []int64) bool {
  1665  		t.Helper()
  1666  		a := archsimd.LoadInt64x2(x)
  1667  		g := make([]uint16, 8)
  1668  		f(a).Store(g)
  1669  		w := want(x)
  1670  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1671  	})
  1672  }
  1673  
  1674  // testUint8x16ConvertLoToUint16x8 tests the simd conversion method f against the expected behavior generated by want.
  1675  // This converts only the low 8 elements.
  1676  func testUint8x16ConvertLoToUint16x8(t *testing.T, f func(x archsimd.Uint8x16) archsimd.Uint16x8, want func(x []uint8) []uint16) {
  1677  	n := 16
  1678  	t.Helper()
  1679  	forSlice(t, uint8s, n, func(x []uint8) bool {
  1680  		t.Helper()
  1681  		a := archsimd.LoadUint8x16(x)
  1682  		g := make([]uint16, 8)
  1683  		f(a).Store(g)
  1684  		w := want(x)
  1685  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1686  	})
  1687  }
  1688  
  1689  // testUint16x8ConvertLoToUint16x8 tests the simd conversion method f against the expected behavior generated by want.
  1690  // This converts only the low 8 elements.
  1691  func testUint16x8ConvertLoToUint16x8(t *testing.T, f func(x archsimd.Uint16x8) archsimd.Uint16x8, want func(x []uint16) []uint16) {
  1692  	n := 8
  1693  	t.Helper()
  1694  	forSlice(t, uint16s, n, func(x []uint16) bool {
  1695  		t.Helper()
  1696  		a := archsimd.LoadUint16x8(x)
  1697  		g := make([]uint16, 8)
  1698  		f(a).Store(g)
  1699  		w := want(x)
  1700  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1701  	})
  1702  }
  1703  
  1704  // testUint32x4ConvertLoToUint16x8 tests the simd conversion method f against the expected behavior generated by want.
  1705  // This converts only the low 8 elements.
  1706  func testUint32x4ConvertLoToUint16x8(t *testing.T, f func(x archsimd.Uint32x4) archsimd.Uint16x8, want func(x []uint32) []uint16) {
  1707  	n := 4
  1708  	t.Helper()
  1709  	forSlice(t, uint32s, n, func(x []uint32) bool {
  1710  		t.Helper()
  1711  		a := archsimd.LoadUint32x4(x)
  1712  		g := make([]uint16, 8)
  1713  		f(a).Store(g)
  1714  		w := want(x)
  1715  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1716  	})
  1717  }
  1718  
  1719  // testUint64x2ConvertLoToUint16x8 tests the simd conversion method f against the expected behavior generated by want.
  1720  // This converts only the low 8 elements.
  1721  func testUint64x2ConvertLoToUint16x8(t *testing.T, f func(x archsimd.Uint64x2) archsimd.Uint16x8, want func(x []uint64) []uint16) {
  1722  	n := 2
  1723  	t.Helper()
  1724  	forSlice(t, uint64s, n, func(x []uint64) bool {
  1725  		t.Helper()
  1726  		a := archsimd.LoadUint64x2(x)
  1727  		g := make([]uint16, 8)
  1728  		f(a).Store(g)
  1729  		w := want(x)
  1730  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1731  	})
  1732  }
  1733  
  1734  // testFloat32x4ConvertLoToUint16x8 tests the simd conversion method f against the expected behavior generated by want.
  1735  // This converts only the low 8 elements.
  1736  func testFloat32x4ConvertLoToUint16x8(t *testing.T, f func(x archsimd.Float32x4) archsimd.Uint16x8, want func(x []float32) []uint16) {
  1737  	n := 4
  1738  	t.Helper()
  1739  	forSlice(t, float32s, n, func(x []float32) bool {
  1740  		t.Helper()
  1741  		a := archsimd.LoadFloat32x4(x)
  1742  		g := make([]uint16, 8)
  1743  		f(a).Store(g)
  1744  		w := want(x)
  1745  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1746  	})
  1747  }
  1748  
  1749  // testFloat64x2ConvertLoToUint16x8 tests the simd conversion method f against the expected behavior generated by want.
  1750  // This converts only the low 8 elements.
  1751  func testFloat64x2ConvertLoToUint16x8(t *testing.T, f func(x archsimd.Float64x2) archsimd.Uint16x8, want func(x []float64) []uint16) {
  1752  	n := 2
  1753  	t.Helper()
  1754  	forSlice(t, float64s, n, func(x []float64) bool {
  1755  		t.Helper()
  1756  		a := archsimd.LoadFloat64x2(x)
  1757  		g := make([]uint16, 8)
  1758  		f(a).Store(g)
  1759  		w := want(x)
  1760  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1761  	})
  1762  }
  1763  
  1764  // testInt8x16ConvertLoToFloat64x2 tests the simd conversion method f against the expected behavior generated by want.
  1765  // This converts only the low 2 elements.
  1766  func testInt8x16ConvertLoToFloat64x2(t *testing.T, f func(x archsimd.Int8x16) archsimd.Float64x2, want func(x []int8) []float64) {
  1767  	n := 16
  1768  	t.Helper()
  1769  	forSlice(t, int8s, n, func(x []int8) bool {
  1770  		t.Helper()
  1771  		a := archsimd.LoadInt8x16(x)
  1772  		g := make([]float64, 2)
  1773  		f(a).Store(g)
  1774  		w := want(x)
  1775  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1776  	})
  1777  }
  1778  
  1779  // testInt16x8ConvertLoToFloat64x2 tests the simd conversion method f against the expected behavior generated by want.
  1780  // This converts only the low 2 elements.
  1781  func testInt16x8ConvertLoToFloat64x2(t *testing.T, f func(x archsimd.Int16x8) archsimd.Float64x2, want func(x []int16) []float64) {
  1782  	n := 8
  1783  	t.Helper()
  1784  	forSlice(t, int16s, n, func(x []int16) bool {
  1785  		t.Helper()
  1786  		a := archsimd.LoadInt16x8(x)
  1787  		g := make([]float64, 2)
  1788  		f(a).Store(g)
  1789  		w := want(x)
  1790  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1791  	})
  1792  }
  1793  
  1794  // testInt32x4ConvertLoToFloat64x2 tests the simd conversion method f against the expected behavior generated by want.
  1795  // This converts only the low 2 elements.
  1796  func testInt32x4ConvertLoToFloat64x2(t *testing.T, f func(x archsimd.Int32x4) archsimd.Float64x2, want func(x []int32) []float64) {
  1797  	n := 4
  1798  	t.Helper()
  1799  	forSlice(t, int32s, n, func(x []int32) bool {
  1800  		t.Helper()
  1801  		a := archsimd.LoadInt32x4(x)
  1802  		g := make([]float64, 2)
  1803  		f(a).Store(g)
  1804  		w := want(x)
  1805  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1806  	})
  1807  }
  1808  
  1809  // testInt64x2ConvertLoToFloat64x2 tests the simd conversion method f against the expected behavior generated by want.
  1810  // This converts only the low 2 elements.
  1811  func testInt64x2ConvertLoToFloat64x2(t *testing.T, f func(x archsimd.Int64x2) archsimd.Float64x2, want func(x []int64) []float64) {
  1812  	n := 2
  1813  	t.Helper()
  1814  	forSlice(t, int64s, n, func(x []int64) bool {
  1815  		t.Helper()
  1816  		a := archsimd.LoadInt64x2(x)
  1817  		g := make([]float64, 2)
  1818  		f(a).Store(g)
  1819  		w := want(x)
  1820  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1821  	})
  1822  }
  1823  
  1824  // testUint8x16ConvertLoToFloat64x2 tests the simd conversion method f against the expected behavior generated by want.
  1825  // This converts only the low 2 elements.
  1826  func testUint8x16ConvertLoToFloat64x2(t *testing.T, f func(x archsimd.Uint8x16) archsimd.Float64x2, want func(x []uint8) []float64) {
  1827  	n := 16
  1828  	t.Helper()
  1829  	forSlice(t, uint8s, n, func(x []uint8) bool {
  1830  		t.Helper()
  1831  		a := archsimd.LoadUint8x16(x)
  1832  		g := make([]float64, 2)
  1833  		f(a).Store(g)
  1834  		w := want(x)
  1835  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1836  	})
  1837  }
  1838  
  1839  // testUint16x8ConvertLoToFloat64x2 tests the simd conversion method f against the expected behavior generated by want.
  1840  // This converts only the low 2 elements.
  1841  func testUint16x8ConvertLoToFloat64x2(t *testing.T, f func(x archsimd.Uint16x8) archsimd.Float64x2, want func(x []uint16) []float64) {
  1842  	n := 8
  1843  	t.Helper()
  1844  	forSlice(t, uint16s, n, func(x []uint16) bool {
  1845  		t.Helper()
  1846  		a := archsimd.LoadUint16x8(x)
  1847  		g := make([]float64, 2)
  1848  		f(a).Store(g)
  1849  		w := want(x)
  1850  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1851  	})
  1852  }
  1853  
  1854  // testUint32x4ConvertLoToFloat64x2 tests the simd conversion method f against the expected behavior generated by want.
  1855  // This converts only the low 2 elements.
  1856  func testUint32x4ConvertLoToFloat64x2(t *testing.T, f func(x archsimd.Uint32x4) archsimd.Float64x2, want func(x []uint32) []float64) {
  1857  	n := 4
  1858  	t.Helper()
  1859  	forSlice(t, uint32s, n, func(x []uint32) bool {
  1860  		t.Helper()
  1861  		a := archsimd.LoadUint32x4(x)
  1862  		g := make([]float64, 2)
  1863  		f(a).Store(g)
  1864  		w := want(x)
  1865  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1866  	})
  1867  }
  1868  
  1869  // testUint64x2ConvertLoToFloat64x2 tests the simd conversion method f against the expected behavior generated by want.
  1870  // This converts only the low 2 elements.
  1871  func testUint64x2ConvertLoToFloat64x2(t *testing.T, f func(x archsimd.Uint64x2) archsimd.Float64x2, want func(x []uint64) []float64) {
  1872  	n := 2
  1873  	t.Helper()
  1874  	forSlice(t, uint64s, n, func(x []uint64) bool {
  1875  		t.Helper()
  1876  		a := archsimd.LoadUint64x2(x)
  1877  		g := make([]float64, 2)
  1878  		f(a).Store(g)
  1879  		w := want(x)
  1880  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1881  	})
  1882  }
  1883  
  1884  // testFloat32x4ConvertLoToFloat64x2 tests the simd conversion method f against the expected behavior generated by want.
  1885  // This converts only the low 2 elements.
  1886  func testFloat32x4ConvertLoToFloat64x2(t *testing.T, f func(x archsimd.Float32x4) archsimd.Float64x2, want func(x []float32) []float64) {
  1887  	n := 4
  1888  	t.Helper()
  1889  	forSlice(t, float32s, n, func(x []float32) bool {
  1890  		t.Helper()
  1891  		a := archsimd.LoadFloat32x4(x)
  1892  		g := make([]float64, 2)
  1893  		f(a).Store(g)
  1894  		w := want(x)
  1895  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1896  	})
  1897  }
  1898  
  1899  // testFloat64x2ConvertLoToFloat64x2 tests the simd conversion method f against the expected behavior generated by want.
  1900  // This converts only the low 2 elements.
  1901  func testFloat64x2ConvertLoToFloat64x2(t *testing.T, f func(x archsimd.Float64x2) archsimd.Float64x2, want func(x []float64) []float64) {
  1902  	n := 2
  1903  	t.Helper()
  1904  	forSlice(t, float64s, n, func(x []float64) bool {
  1905  		t.Helper()
  1906  		a := archsimd.LoadFloat64x2(x)
  1907  		g := make([]float64, 2)
  1908  		f(a).Store(g)
  1909  		w := want(x)
  1910  		return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x) })
  1911  	})
  1912  }
  1913  
  1914  // testFloat32x4UnaryFlaky tests the simd unary method f against the expected behavior generated by want,
  1915  // but using a flakiness parameter because we haven't exactly figured out how simd floating point works
  1916  func testFloat32x4UnaryFlaky(t *testing.T, f func(x archsimd.Float32x4) archsimd.Float32x4, want func(x []float32) []float32, flakiness float64) {
  1917  	n := 4
  1918  	t.Helper()
  1919  	forSlice(t, float32s, n, func(x []float32) bool {
  1920  		t.Helper()
  1921  		a := archsimd.LoadFloat32x4(x)
  1922  		g := make([]float32, n)
  1923  		f(a).Store(g)
  1924  		w := want(x)
  1925  		return checkSlicesLogInput(t, g, w, flakiness, func() { t.Helper(); t.Logf("x=%v", x) })
  1926  	})
  1927  }
  1928  
  1929  // testFloat64x2UnaryFlaky tests the simd unary method f against the expected behavior generated by want,
  1930  // but using a flakiness parameter because we haven't exactly figured out how simd floating point works
  1931  func testFloat64x2UnaryFlaky(t *testing.T, f func(x archsimd.Float64x2) archsimd.Float64x2, want func(x []float64) []float64, flakiness float64) {
  1932  	n := 2
  1933  	t.Helper()
  1934  	forSlice(t, float64s, n, func(x []float64) bool {
  1935  		t.Helper()
  1936  		a := archsimd.LoadFloat64x2(x)
  1937  		g := make([]float64, n)
  1938  		f(a).Store(g)
  1939  		w := want(x)
  1940  		return checkSlicesLogInput(t, g, w, flakiness, func() { t.Helper(); t.Logf("x=%v", x) })
  1941  	})
  1942  }
  1943  

View as plain text