| 1 |
// Code generated by 'tmplgen'; DO NOT EDIT. |
| 2 |
|
| 3 |
//go:build goexperiment.simd && amd64 |
| 4 |
|
| 5 |
// This file contains functions testing binary 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 |
// testInt8x16Binary tests the simd binary method f against the expected behavior generated by want |
| 17 |
func testInt8x16Binary(t *testing.T, f func(_, _ archsimd.Int8x16) archsimd.Int8x16, want func(_, _ []int8) []int8) { |
| 18 |
n := 16 |
| 19 |
t.Helper() |
| 20 |
forSlicePair(t, int8s, n, func(x, y []int8) bool { |
| 21 |
t.Helper() |
| 22 |
a := archsimd.LoadInt8x16Slice(x) |
| 23 |
b := archsimd.LoadInt8x16Slice(y) |
| 24 |
g := make([]int8, n) |
| 25 |
f(a, b).StoreSlice(g) |
| 26 |
w := want(x, y) |
| 27 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 28 |
}) |
| 29 |
} |
| 30 |
|
| 31 |
// testInt16x8Binary tests the simd binary method f against the expected behavior generated by want |
| 32 |
func testInt16x8Binary(t *testing.T, f func(_, _ archsimd.Int16x8) archsimd.Int16x8, want func(_, _ []int16) []int16) { |
| 33 |
n := 8 |
| 34 |
t.Helper() |
| 35 |
forSlicePair(t, int16s, n, func(x, y []int16) bool { |
| 36 |
t.Helper() |
| 37 |
a := archsimd.LoadInt16x8Slice(x) |
| 38 |
b := archsimd.LoadInt16x8Slice(y) |
| 39 |
g := make([]int16, n) |
| 40 |
f(a, b).StoreSlice(g) |
| 41 |
w := want(x, y) |
| 42 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 43 |
}) |
| 44 |
} |
| 45 |
|
| 46 |
// testInt32x4Binary tests the simd binary method f against the expected behavior generated by want |
| 47 |
func testInt32x4Binary(t *testing.T, f func(_, _ archsimd.Int32x4) archsimd.Int32x4, want func(_, _ []int32) []int32) { |
| 48 |
n := 4 |
| 49 |
t.Helper() |
| 50 |
forSlicePair(t, int32s, n, func(x, y []int32) bool { |
| 51 |
t.Helper() |
| 52 |
a := archsimd.LoadInt32x4Slice(x) |
| 53 |
b := archsimd.LoadInt32x4Slice(y) |
| 54 |
g := make([]int32, n) |
| 55 |
f(a, b).StoreSlice(g) |
| 56 |
w := want(x, y) |
| 57 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 58 |
}) |
| 59 |
} |
| 60 |
|
| 61 |
// testInt64x2Binary tests the simd binary method f against the expected behavior generated by want |
| 62 |
func testInt64x2Binary(t *testing.T, f func(_, _ archsimd.Int64x2) archsimd.Int64x2, want func(_, _ []int64) []int64) { |
| 63 |
n := 2 |
| 64 |
t.Helper() |
| 65 |
forSlicePair(t, int64s, n, func(x, y []int64) bool { |
| 66 |
t.Helper() |
| 67 |
a := archsimd.LoadInt64x2Slice(x) |
| 68 |
b := archsimd.LoadInt64x2Slice(y) |
| 69 |
g := make([]int64, n) |
| 70 |
f(a, b).StoreSlice(g) |
| 71 |
w := want(x, y) |
| 72 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 73 |
}) |
| 74 |
} |
| 75 |
|
| 76 |
// testUint8x16Binary tests the simd binary method f against the expected behavior generated by want |
| 77 |
func testUint8x16Binary(t *testing.T, f func(_, _ archsimd.Uint8x16) archsimd.Uint8x16, want func(_, _ []uint8) []uint8) { |
| 78 |
n := 16 |
| 79 |
t.Helper() |
| 80 |
forSlicePair(t, uint8s, n, func(x, y []uint8) bool { |
| 81 |
t.Helper() |
| 82 |
a := archsimd.LoadUint8x16Slice(x) |
| 83 |
b := archsimd.LoadUint8x16Slice(y) |
| 84 |
g := make([]uint8, n) |
| 85 |
f(a, b).StoreSlice(g) |
| 86 |
w := want(x, y) |
| 87 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 88 |
}) |
| 89 |
} |
| 90 |
|
| 91 |
// testUint16x8Binary tests the simd binary method f against the expected behavior generated by want |
| 92 |
func testUint16x8Binary(t *testing.T, f func(_, _ archsimd.Uint16x8) archsimd.Uint16x8, want func(_, _ []uint16) []uint16) { |
| 93 |
n := 8 |
| 94 |
t.Helper() |
| 95 |
forSlicePair(t, uint16s, n, func(x, y []uint16) bool { |
| 96 |
t.Helper() |
| 97 |
a := archsimd.LoadUint16x8Slice(x) |
| 98 |
b := archsimd.LoadUint16x8Slice(y) |
| 99 |
g := make([]uint16, n) |
| 100 |
f(a, b).StoreSlice(g) |
| 101 |
w := want(x, y) |
| 102 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 103 |
}) |
| 104 |
} |
| 105 |
|
| 106 |
// testUint32x4Binary tests the simd binary method f against the expected behavior generated by want |
| 107 |
func testUint32x4Binary(t *testing.T, f func(_, _ archsimd.Uint32x4) archsimd.Uint32x4, want func(_, _ []uint32) []uint32) { |
| 108 |
n := 4 |
| 109 |
t.Helper() |
| 110 |
forSlicePair(t, uint32s, n, func(x, y []uint32) bool { |
| 111 |
t.Helper() |
| 112 |
a := archsimd.LoadUint32x4Slice(x) |
| 113 |
b := archsimd.LoadUint32x4Slice(y) |
| 114 |
g := make([]uint32, n) |
| 115 |
f(a, b).StoreSlice(g) |
| 116 |
w := want(x, y) |
| 117 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 118 |
}) |
| 119 |
} |
| 120 |
|
| 121 |
// testUint64x2Binary tests the simd binary method f against the expected behavior generated by want |
| 122 |
func testUint64x2Binary(t *testing.T, f func(_, _ archsimd.Uint64x2) archsimd.Uint64x2, want func(_, _ []uint64) []uint64) { |
| 123 |
n := 2 |
| 124 |
t.Helper() |
| 125 |
forSlicePair(t, uint64s, n, func(x, y []uint64) bool { |
| 126 |
t.Helper() |
| 127 |
a := archsimd.LoadUint64x2Slice(x) |
| 128 |
b := archsimd.LoadUint64x2Slice(y) |
| 129 |
g := make([]uint64, n) |
| 130 |
f(a, b).StoreSlice(g) |
| 131 |
w := want(x, y) |
| 132 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 133 |
}) |
| 134 |
} |
| 135 |
|
| 136 |
// testFloat32x4Binary tests the simd binary method f against the expected behavior generated by want |
| 137 |
func testFloat32x4Binary(t *testing.T, f func(_, _ archsimd.Float32x4) archsimd.Float32x4, want func(_, _ []float32) []float32) { |
| 138 |
n := 4 |
| 139 |
t.Helper() |
| 140 |
forSlicePair(t, float32s, n, func(x, y []float32) bool { |
| 141 |
t.Helper() |
| 142 |
a := archsimd.LoadFloat32x4Slice(x) |
| 143 |
b := archsimd.LoadFloat32x4Slice(y) |
| 144 |
g := make([]float32, n) |
| 145 |
f(a, b).StoreSlice(g) |
| 146 |
w := want(x, y) |
| 147 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 148 |
}) |
| 149 |
} |
| 150 |
|
| 151 |
// testFloat64x2Binary tests the simd binary method f against the expected behavior generated by want |
| 152 |
func testFloat64x2Binary(t *testing.T, f func(_, _ archsimd.Float64x2) archsimd.Float64x2, want func(_, _ []float64) []float64) { |
| 153 |
n := 2 |
| 154 |
t.Helper() |
| 155 |
forSlicePair(t, float64s, n, func(x, y []float64) bool { |
| 156 |
t.Helper() |
| 157 |
a := archsimd.LoadFloat64x2Slice(x) |
| 158 |
b := archsimd.LoadFloat64x2Slice(y) |
| 159 |
g := make([]float64, n) |
| 160 |
f(a, b).StoreSlice(g) |
| 161 |
w := want(x, y) |
| 162 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 163 |
}) |
| 164 |
} |
| 165 |
|
| 166 |
// testInt8x32Binary tests the simd binary method f against the expected behavior generated by want |
| 167 |
func testInt8x32Binary(t *testing.T, f func(_, _ archsimd.Int8x32) archsimd.Int8x32, want func(_, _ []int8) []int8) { |
| 168 |
n := 32 |
| 169 |
t.Helper() |
| 170 |
forSlicePair(t, int8s, n, func(x, y []int8) bool { |
| 171 |
t.Helper() |
| 172 |
a := archsimd.LoadInt8x32Slice(x) |
| 173 |
b := archsimd.LoadInt8x32Slice(y) |
| 174 |
g := make([]int8, n) |
| 175 |
f(a, b).StoreSlice(g) |
| 176 |
w := want(x, y) |
| 177 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 178 |
}) |
| 179 |
} |
| 180 |
|
| 181 |
// testInt16x16Binary tests the simd binary method f against the expected behavior generated by want |
| 182 |
func testInt16x16Binary(t *testing.T, f func(_, _ archsimd.Int16x16) archsimd.Int16x16, want func(_, _ []int16) []int16) { |
| 183 |
n := 16 |
| 184 |
t.Helper() |
| 185 |
forSlicePair(t, int16s, n, func(x, y []int16) bool { |
| 186 |
t.Helper() |
| 187 |
a := archsimd.LoadInt16x16Slice(x) |
| 188 |
b := archsimd.LoadInt16x16Slice(y) |
| 189 |
g := make([]int16, n) |
| 190 |
f(a, b).StoreSlice(g) |
| 191 |
w := want(x, y) |
| 192 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 193 |
}) |
| 194 |
} |
| 195 |
|
| 196 |
// testInt32x8Binary tests the simd binary method f against the expected behavior generated by want |
| 197 |
func testInt32x8Binary(t *testing.T, f func(_, _ archsimd.Int32x8) archsimd.Int32x8, want func(_, _ []int32) []int32) { |
| 198 |
n := 8 |
| 199 |
t.Helper() |
| 200 |
forSlicePair(t, int32s, n, func(x, y []int32) bool { |
| 201 |
t.Helper() |
| 202 |
a := archsimd.LoadInt32x8Slice(x) |
| 203 |
b := archsimd.LoadInt32x8Slice(y) |
| 204 |
g := make([]int32, n) |
| 205 |
f(a, b).StoreSlice(g) |
| 206 |
w := want(x, y) |
| 207 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 208 |
}) |
| 209 |
} |
| 210 |
|
| 211 |
// testInt64x4Binary tests the simd binary method f against the expected behavior generated by want |
| 212 |
func testInt64x4Binary(t *testing.T, f func(_, _ archsimd.Int64x4) archsimd.Int64x4, want func(_, _ []int64) []int64) { |
| 213 |
n := 4 |
| 214 |
t.Helper() |
| 215 |
forSlicePair(t, int64s, n, func(x, y []int64) bool { |
| 216 |
t.Helper() |
| 217 |
a := archsimd.LoadInt64x4Slice(x) |
| 218 |
b := archsimd.LoadInt64x4Slice(y) |
| 219 |
g := make([]int64, n) |
| 220 |
f(a, b).StoreSlice(g) |
| 221 |
w := want(x, y) |
| 222 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 223 |
}) |
| 224 |
} |
| 225 |
|
| 226 |
// testUint8x32Binary tests the simd binary method f against the expected behavior generated by want |
| 227 |
func testUint8x32Binary(t *testing.T, f func(_, _ archsimd.Uint8x32) archsimd.Uint8x32, want func(_, _ []uint8) []uint8) { |
| 228 |
n := 32 |
| 229 |
t.Helper() |
| 230 |
forSlicePair(t, uint8s, n, func(x, y []uint8) bool { |
| 231 |
t.Helper() |
| 232 |
a := archsimd.LoadUint8x32Slice(x) |
| 233 |
b := archsimd.LoadUint8x32Slice(y) |
| 234 |
g := make([]uint8, n) |
| 235 |
f(a, b).StoreSlice(g) |
| 236 |
w := want(x, y) |
| 237 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 238 |
}) |
| 239 |
} |
| 240 |
|
| 241 |
// testUint16x16Binary tests the simd binary method f against the expected behavior generated by want |
| 242 |
func testUint16x16Binary(t *testing.T, f func(_, _ archsimd.Uint16x16) archsimd.Uint16x16, want func(_, _ []uint16) []uint16) { |
| 243 |
n := 16 |
| 244 |
t.Helper() |
| 245 |
forSlicePair(t, uint16s, n, func(x, y []uint16) bool { |
| 246 |
t.Helper() |
| 247 |
a := archsimd.LoadUint16x16Slice(x) |
| 248 |
b := archsimd.LoadUint16x16Slice(y) |
| 249 |
g := make([]uint16, n) |
| 250 |
f(a, b).StoreSlice(g) |
| 251 |
w := want(x, y) |
| 252 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 253 |
}) |
| 254 |
} |
| 255 |
|
| 256 |
// testUint32x8Binary tests the simd binary method f against the expected behavior generated by want |
| 257 |
func testUint32x8Binary(t *testing.T, f func(_, _ archsimd.Uint32x8) archsimd.Uint32x8, want func(_, _ []uint32) []uint32) { |
| 258 |
n := 8 |
| 259 |
t.Helper() |
| 260 |
forSlicePair(t, uint32s, n, func(x, y []uint32) bool { |
| 261 |
t.Helper() |
| 262 |
a := archsimd.LoadUint32x8Slice(x) |
| 263 |
b := archsimd.LoadUint32x8Slice(y) |
| 264 |
g := make([]uint32, n) |
| 265 |
f(a, b).StoreSlice(g) |
| 266 |
w := want(x, y) |
| 267 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 268 |
}) |
| 269 |
} |
| 270 |
|
| 271 |
// testUint64x4Binary tests the simd binary method f against the expected behavior generated by want |
| 272 |
func testUint64x4Binary(t *testing.T, f func(_, _ archsimd.Uint64x4) archsimd.Uint64x4, want func(_, _ []uint64) []uint64) { |
| 273 |
n := 4 |
| 274 |
t.Helper() |
| 275 |
forSlicePair(t, uint64s, n, func(x, y []uint64) bool { |
| 276 |
t.Helper() |
| 277 |
a := archsimd.LoadUint64x4Slice(x) |
| 278 |
b := archsimd.LoadUint64x4Slice(y) |
| 279 |
g := make([]uint64, n) |
| 280 |
f(a, b).StoreSlice(g) |
| 281 |
w := want(x, y) |
| 282 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 283 |
}) |
| 284 |
} |
| 285 |
|
| 286 |
// testFloat32x8Binary tests the simd binary method f against the expected behavior generated by want |
| 287 |
func testFloat32x8Binary(t *testing.T, f func(_, _ archsimd.Float32x8) archsimd.Float32x8, want func(_, _ []float32) []float32) { |
| 288 |
n := 8 |
| 289 |
t.Helper() |
| 290 |
forSlicePair(t, float32s, n, func(x, y []float32) bool { |
| 291 |
t.Helper() |
| 292 |
a := archsimd.LoadFloat32x8Slice(x) |
| 293 |
b := archsimd.LoadFloat32x8Slice(y) |
| 294 |
g := make([]float32, n) |
| 295 |
f(a, b).StoreSlice(g) |
| 296 |
w := want(x, y) |
| 297 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 298 |
}) |
| 299 |
} |
| 300 |
|
| 301 |
// testFloat64x4Binary tests the simd binary method f against the expected behavior generated by want |
| 302 |
func testFloat64x4Binary(t *testing.T, f func(_, _ archsimd.Float64x4) archsimd.Float64x4, want func(_, _ []float64) []float64) { |
| 303 |
n := 4 |
| 304 |
t.Helper() |
| 305 |
forSlicePair(t, float64s, n, func(x, y []float64) bool { |
| 306 |
t.Helper() |
| 307 |
a := archsimd.LoadFloat64x4Slice(x) |
| 308 |
b := archsimd.LoadFloat64x4Slice(y) |
| 309 |
g := make([]float64, n) |
| 310 |
f(a, b).StoreSlice(g) |
| 311 |
w := want(x, y) |
| 312 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 313 |
}) |
| 314 |
} |
| 315 |
|
| 316 |
// testInt8x64Binary tests the simd binary method f against the expected behavior generated by want |
| 317 |
func testInt8x64Binary(t *testing.T, f func(_, _ archsimd.Int8x64) archsimd.Int8x64, want func(_, _ []int8) []int8) { |
| 318 |
n := 64 |
| 319 |
t.Helper() |
| 320 |
forSlicePair(t, int8s, n, func(x, y []int8) bool { |
| 321 |
t.Helper() |
| 322 |
a := archsimd.LoadInt8x64Slice(x) |
| 323 |
b := archsimd.LoadInt8x64Slice(y) |
| 324 |
g := make([]int8, n) |
| 325 |
f(a, b).StoreSlice(g) |
| 326 |
w := want(x, y) |
| 327 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 328 |
}) |
| 329 |
} |
| 330 |
|
| 331 |
// testInt16x32Binary tests the simd binary method f against the expected behavior generated by want |
| 332 |
func testInt16x32Binary(t *testing.T, f func(_, _ archsimd.Int16x32) archsimd.Int16x32, want func(_, _ []int16) []int16) { |
| 333 |
n := 32 |
| 334 |
t.Helper() |
| 335 |
forSlicePair(t, int16s, n, func(x, y []int16) bool { |
| 336 |
t.Helper() |
| 337 |
a := archsimd.LoadInt16x32Slice(x) |
| 338 |
b := archsimd.LoadInt16x32Slice(y) |
| 339 |
g := make([]int16, n) |
| 340 |
f(a, b).StoreSlice(g) |
| 341 |
w := want(x, y) |
| 342 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 343 |
}) |
| 344 |
} |
| 345 |
|
| 346 |
// testInt32x16Binary tests the simd binary method f against the expected behavior generated by want |
| 347 |
func testInt32x16Binary(t *testing.T, f func(_, _ archsimd.Int32x16) archsimd.Int32x16, want func(_, _ []int32) []int32) { |
| 348 |
n := 16 |
| 349 |
t.Helper() |
| 350 |
forSlicePair(t, int32s, n, func(x, y []int32) bool { |
| 351 |
t.Helper() |
| 352 |
a := archsimd.LoadInt32x16Slice(x) |
| 353 |
b := archsimd.LoadInt32x16Slice(y) |
| 354 |
g := make([]int32, n) |
| 355 |
f(a, b).StoreSlice(g) |
| 356 |
w := want(x, y) |
| 357 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 358 |
}) |
| 359 |
} |
| 360 |
|
| 361 |
// testInt64x8Binary tests the simd binary method f against the expected behavior generated by want |
| 362 |
func testInt64x8Binary(t *testing.T, f func(_, _ archsimd.Int64x8) archsimd.Int64x8, want func(_, _ []int64) []int64) { |
| 363 |
n := 8 |
| 364 |
t.Helper() |
| 365 |
forSlicePair(t, int64s, n, func(x, y []int64) bool { |
| 366 |
t.Helper() |
| 367 |
a := archsimd.LoadInt64x8Slice(x) |
| 368 |
b := archsimd.LoadInt64x8Slice(y) |
| 369 |
g := make([]int64, n) |
| 370 |
f(a, b).StoreSlice(g) |
| 371 |
w := want(x, y) |
| 372 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 373 |
}) |
| 374 |
} |
| 375 |
|
| 376 |
// testUint8x64Binary tests the simd binary method f against the expected behavior generated by want |
| 377 |
func testUint8x64Binary(t *testing.T, f func(_, _ archsimd.Uint8x64) archsimd.Uint8x64, want func(_, _ []uint8) []uint8) { |
| 378 |
n := 64 |
| 379 |
t.Helper() |
| 380 |
forSlicePair(t, uint8s, n, func(x, y []uint8) bool { |
| 381 |
t.Helper() |
| 382 |
a := archsimd.LoadUint8x64Slice(x) |
| 383 |
b := archsimd.LoadUint8x64Slice(y) |
| 384 |
g := make([]uint8, n) |
| 385 |
f(a, b).StoreSlice(g) |
| 386 |
w := want(x, y) |
| 387 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 388 |
}) |
| 389 |
} |
| 390 |
|
| 391 |
// testUint16x32Binary tests the simd binary method f against the expected behavior generated by want |
| 392 |
func testUint16x32Binary(t *testing.T, f func(_, _ archsimd.Uint16x32) archsimd.Uint16x32, want func(_, _ []uint16) []uint16) { |
| 393 |
n := 32 |
| 394 |
t.Helper() |
| 395 |
forSlicePair(t, uint16s, n, func(x, y []uint16) bool { |
| 396 |
t.Helper() |
| 397 |
a := archsimd.LoadUint16x32Slice(x) |
| 398 |
b := archsimd.LoadUint16x32Slice(y) |
| 399 |
g := make([]uint16, n) |
| 400 |
f(a, b).StoreSlice(g) |
| 401 |
w := want(x, y) |
| 402 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 403 |
}) |
| 404 |
} |
| 405 |
|
| 406 |
// testUint32x16Binary tests the simd binary method f against the expected behavior generated by want |
| 407 |
func testUint32x16Binary(t *testing.T, f func(_, _ archsimd.Uint32x16) archsimd.Uint32x16, want func(_, _ []uint32) []uint32) { |
| 408 |
n := 16 |
| 409 |
t.Helper() |
| 410 |
forSlicePair(t, uint32s, n, func(x, y []uint32) bool { |
| 411 |
t.Helper() |
| 412 |
a := archsimd.LoadUint32x16Slice(x) |
| 413 |
b := archsimd.LoadUint32x16Slice(y) |
| 414 |
g := make([]uint32, n) |
| 415 |
f(a, b).StoreSlice(g) |
| 416 |
w := want(x, y) |
| 417 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 418 |
}) |
| 419 |
} |
| 420 |
|
| 421 |
// testUint64x8Binary tests the simd binary method f against the expected behavior generated by want |
| 422 |
func testUint64x8Binary(t *testing.T, f func(_, _ archsimd.Uint64x8) archsimd.Uint64x8, want func(_, _ []uint64) []uint64) { |
| 423 |
n := 8 |
| 424 |
t.Helper() |
| 425 |
forSlicePair(t, uint64s, n, func(x, y []uint64) bool { |
| 426 |
t.Helper() |
| 427 |
a := archsimd.LoadUint64x8Slice(x) |
| 428 |
b := archsimd.LoadUint64x8Slice(y) |
| 429 |
g := make([]uint64, n) |
| 430 |
f(a, b).StoreSlice(g) |
| 431 |
w := want(x, y) |
| 432 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 433 |
}) |
| 434 |
} |
| 435 |
|
| 436 |
// testFloat32x16Binary tests the simd binary method f against the expected behavior generated by want |
| 437 |
func testFloat32x16Binary(t *testing.T, f func(_, _ archsimd.Float32x16) archsimd.Float32x16, want func(_, _ []float32) []float32) { |
| 438 |
n := 16 |
| 439 |
t.Helper() |
| 440 |
forSlicePair(t, float32s, n, func(x, y []float32) bool { |
| 441 |
t.Helper() |
| 442 |
a := archsimd.LoadFloat32x16Slice(x) |
| 443 |
b := archsimd.LoadFloat32x16Slice(y) |
| 444 |
g := make([]float32, n) |
| 445 |
f(a, b).StoreSlice(g) |
| 446 |
w := want(x, y) |
| 447 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 448 |
}) |
| 449 |
} |
| 450 |
|
| 451 |
// testFloat64x8Binary tests the simd binary method f against the expected behavior generated by want |
| 452 |
func testFloat64x8Binary(t *testing.T, f func(_, _ archsimd.Float64x8) archsimd.Float64x8, want func(_, _ []float64) []float64) { |
| 453 |
n := 8 |
| 454 |
t.Helper() |
| 455 |
forSlicePair(t, float64s, n, func(x, y []float64) bool { |
| 456 |
t.Helper() |
| 457 |
a := archsimd.LoadFloat64x8Slice(x) |
| 458 |
b := archsimd.LoadFloat64x8Slice(y) |
| 459 |
g := make([]float64, n) |
| 460 |
f(a, b).StoreSlice(g) |
| 461 |
w := want(x, y) |
| 462 |
return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y) }) |
| 463 |
}) |
| 464 |
} |