1
2
3
4
5
6
7
8
9 package simd_test
10
11 import (
12 "simd"
13 "testing"
14 )
15
16
17 func testInt8x16Ternary(t *testing.T, f func(_, _, _ simd.Int8x16) simd.Int8x16, want func(_, _, _ []int8) []int8) {
18 n := 16
19 t.Helper()
20 forSliceTriple(t, int8s, n, func(x, y, z []int8) bool {
21 t.Helper()
22 a := simd.LoadInt8x16Slice(x)
23 b := simd.LoadInt8x16Slice(y)
24 c := simd.LoadInt8x16Slice(z)
25 g := make([]int8, n)
26 f(a, b, c).StoreSlice(g)
27 w := want(x, y, z)
28 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
29 })
30 }
31
32
33 func testInt16x8Ternary(t *testing.T, f func(_, _, _ simd.Int16x8) simd.Int16x8, want func(_, _, _ []int16) []int16) {
34 n := 8
35 t.Helper()
36 forSliceTriple(t, int16s, n, func(x, y, z []int16) bool {
37 t.Helper()
38 a := simd.LoadInt16x8Slice(x)
39 b := simd.LoadInt16x8Slice(y)
40 c := simd.LoadInt16x8Slice(z)
41 g := make([]int16, n)
42 f(a, b, c).StoreSlice(g)
43 w := want(x, y, z)
44 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
45 })
46 }
47
48
49 func testInt32x4Ternary(t *testing.T, f func(_, _, _ simd.Int32x4) simd.Int32x4, want func(_, _, _ []int32) []int32) {
50 n := 4
51 t.Helper()
52 forSliceTriple(t, int32s, n, func(x, y, z []int32) bool {
53 t.Helper()
54 a := simd.LoadInt32x4Slice(x)
55 b := simd.LoadInt32x4Slice(y)
56 c := simd.LoadInt32x4Slice(z)
57 g := make([]int32, n)
58 f(a, b, c).StoreSlice(g)
59 w := want(x, y, z)
60 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
61 })
62 }
63
64
65 func testInt64x2Ternary(t *testing.T, f func(_, _, _ simd.Int64x2) simd.Int64x2, want func(_, _, _ []int64) []int64) {
66 n := 2
67 t.Helper()
68 forSliceTriple(t, int64s, n, func(x, y, z []int64) bool {
69 t.Helper()
70 a := simd.LoadInt64x2Slice(x)
71 b := simd.LoadInt64x2Slice(y)
72 c := simd.LoadInt64x2Slice(z)
73 g := make([]int64, n)
74 f(a, b, c).StoreSlice(g)
75 w := want(x, y, z)
76 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
77 })
78 }
79
80
81 func testUint8x16Ternary(t *testing.T, f func(_, _, _ simd.Uint8x16) simd.Uint8x16, want func(_, _, _ []uint8) []uint8) {
82 n := 16
83 t.Helper()
84 forSliceTriple(t, uint8s, n, func(x, y, z []uint8) bool {
85 t.Helper()
86 a := simd.LoadUint8x16Slice(x)
87 b := simd.LoadUint8x16Slice(y)
88 c := simd.LoadUint8x16Slice(z)
89 g := make([]uint8, n)
90 f(a, b, c).StoreSlice(g)
91 w := want(x, y, z)
92 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
93 })
94 }
95
96
97 func testUint16x8Ternary(t *testing.T, f func(_, _, _ simd.Uint16x8) simd.Uint16x8, want func(_, _, _ []uint16) []uint16) {
98 n := 8
99 t.Helper()
100 forSliceTriple(t, uint16s, n, func(x, y, z []uint16) bool {
101 t.Helper()
102 a := simd.LoadUint16x8Slice(x)
103 b := simd.LoadUint16x8Slice(y)
104 c := simd.LoadUint16x8Slice(z)
105 g := make([]uint16, n)
106 f(a, b, c).StoreSlice(g)
107 w := want(x, y, z)
108 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
109 })
110 }
111
112
113 func testUint32x4Ternary(t *testing.T, f func(_, _, _ simd.Uint32x4) simd.Uint32x4, want func(_, _, _ []uint32) []uint32) {
114 n := 4
115 t.Helper()
116 forSliceTriple(t, uint32s, n, func(x, y, z []uint32) bool {
117 t.Helper()
118 a := simd.LoadUint32x4Slice(x)
119 b := simd.LoadUint32x4Slice(y)
120 c := simd.LoadUint32x4Slice(z)
121 g := make([]uint32, n)
122 f(a, b, c).StoreSlice(g)
123 w := want(x, y, z)
124 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
125 })
126 }
127
128
129 func testUint64x2Ternary(t *testing.T, f func(_, _, _ simd.Uint64x2) simd.Uint64x2, want func(_, _, _ []uint64) []uint64) {
130 n := 2
131 t.Helper()
132 forSliceTriple(t, uint64s, n, func(x, y, z []uint64) bool {
133 t.Helper()
134 a := simd.LoadUint64x2Slice(x)
135 b := simd.LoadUint64x2Slice(y)
136 c := simd.LoadUint64x2Slice(z)
137 g := make([]uint64, n)
138 f(a, b, c).StoreSlice(g)
139 w := want(x, y, z)
140 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
141 })
142 }
143
144
145 func testFloat32x4Ternary(t *testing.T, f func(_, _, _ simd.Float32x4) simd.Float32x4, want func(_, _, _ []float32) []float32) {
146 n := 4
147 t.Helper()
148 forSliceTriple(t, float32s, n, func(x, y, z []float32) bool {
149 t.Helper()
150 a := simd.LoadFloat32x4Slice(x)
151 b := simd.LoadFloat32x4Slice(y)
152 c := simd.LoadFloat32x4Slice(z)
153 g := make([]float32, n)
154 f(a, b, c).StoreSlice(g)
155 w := want(x, y, z)
156 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
157 })
158 }
159
160
161 func testFloat64x2Ternary(t *testing.T, f func(_, _, _ simd.Float64x2) simd.Float64x2, want func(_, _, _ []float64) []float64) {
162 n := 2
163 t.Helper()
164 forSliceTriple(t, float64s, n, func(x, y, z []float64) bool {
165 t.Helper()
166 a := simd.LoadFloat64x2Slice(x)
167 b := simd.LoadFloat64x2Slice(y)
168 c := simd.LoadFloat64x2Slice(z)
169 g := make([]float64, n)
170 f(a, b, c).StoreSlice(g)
171 w := want(x, y, z)
172 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
173 })
174 }
175
176
177 func testInt8x32Ternary(t *testing.T, f func(_, _, _ simd.Int8x32) simd.Int8x32, want func(_, _, _ []int8) []int8) {
178 n := 32
179 t.Helper()
180 forSliceTriple(t, int8s, n, func(x, y, z []int8) bool {
181 t.Helper()
182 a := simd.LoadInt8x32Slice(x)
183 b := simd.LoadInt8x32Slice(y)
184 c := simd.LoadInt8x32Slice(z)
185 g := make([]int8, n)
186 f(a, b, c).StoreSlice(g)
187 w := want(x, y, z)
188 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
189 })
190 }
191
192
193 func testInt16x16Ternary(t *testing.T, f func(_, _, _ simd.Int16x16) simd.Int16x16, want func(_, _, _ []int16) []int16) {
194 n := 16
195 t.Helper()
196 forSliceTriple(t, int16s, n, func(x, y, z []int16) bool {
197 t.Helper()
198 a := simd.LoadInt16x16Slice(x)
199 b := simd.LoadInt16x16Slice(y)
200 c := simd.LoadInt16x16Slice(z)
201 g := make([]int16, n)
202 f(a, b, c).StoreSlice(g)
203 w := want(x, y, z)
204 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
205 })
206 }
207
208
209 func testInt32x8Ternary(t *testing.T, f func(_, _, _ simd.Int32x8) simd.Int32x8, want func(_, _, _ []int32) []int32) {
210 n := 8
211 t.Helper()
212 forSliceTriple(t, int32s, n, func(x, y, z []int32) bool {
213 t.Helper()
214 a := simd.LoadInt32x8Slice(x)
215 b := simd.LoadInt32x8Slice(y)
216 c := simd.LoadInt32x8Slice(z)
217 g := make([]int32, n)
218 f(a, b, c).StoreSlice(g)
219 w := want(x, y, z)
220 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
221 })
222 }
223
224
225 func testInt64x4Ternary(t *testing.T, f func(_, _, _ simd.Int64x4) simd.Int64x4, want func(_, _, _ []int64) []int64) {
226 n := 4
227 t.Helper()
228 forSliceTriple(t, int64s, n, func(x, y, z []int64) bool {
229 t.Helper()
230 a := simd.LoadInt64x4Slice(x)
231 b := simd.LoadInt64x4Slice(y)
232 c := simd.LoadInt64x4Slice(z)
233 g := make([]int64, n)
234 f(a, b, c).StoreSlice(g)
235 w := want(x, y, z)
236 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
237 })
238 }
239
240
241 func testUint8x32Ternary(t *testing.T, f func(_, _, _ simd.Uint8x32) simd.Uint8x32, want func(_, _, _ []uint8) []uint8) {
242 n := 32
243 t.Helper()
244 forSliceTriple(t, uint8s, n, func(x, y, z []uint8) bool {
245 t.Helper()
246 a := simd.LoadUint8x32Slice(x)
247 b := simd.LoadUint8x32Slice(y)
248 c := simd.LoadUint8x32Slice(z)
249 g := make([]uint8, n)
250 f(a, b, c).StoreSlice(g)
251 w := want(x, y, z)
252 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
253 })
254 }
255
256
257 func testUint16x16Ternary(t *testing.T, f func(_, _, _ simd.Uint16x16) simd.Uint16x16, want func(_, _, _ []uint16) []uint16) {
258 n := 16
259 t.Helper()
260 forSliceTriple(t, uint16s, n, func(x, y, z []uint16) bool {
261 t.Helper()
262 a := simd.LoadUint16x16Slice(x)
263 b := simd.LoadUint16x16Slice(y)
264 c := simd.LoadUint16x16Slice(z)
265 g := make([]uint16, n)
266 f(a, b, c).StoreSlice(g)
267 w := want(x, y, z)
268 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
269 })
270 }
271
272
273 func testUint32x8Ternary(t *testing.T, f func(_, _, _ simd.Uint32x8) simd.Uint32x8, want func(_, _, _ []uint32) []uint32) {
274 n := 8
275 t.Helper()
276 forSliceTriple(t, uint32s, n, func(x, y, z []uint32) bool {
277 t.Helper()
278 a := simd.LoadUint32x8Slice(x)
279 b := simd.LoadUint32x8Slice(y)
280 c := simd.LoadUint32x8Slice(z)
281 g := make([]uint32, n)
282 f(a, b, c).StoreSlice(g)
283 w := want(x, y, z)
284 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
285 })
286 }
287
288
289 func testUint64x4Ternary(t *testing.T, f func(_, _, _ simd.Uint64x4) simd.Uint64x4, want func(_, _, _ []uint64) []uint64) {
290 n := 4
291 t.Helper()
292 forSliceTriple(t, uint64s, n, func(x, y, z []uint64) bool {
293 t.Helper()
294 a := simd.LoadUint64x4Slice(x)
295 b := simd.LoadUint64x4Slice(y)
296 c := simd.LoadUint64x4Slice(z)
297 g := make([]uint64, n)
298 f(a, b, c).StoreSlice(g)
299 w := want(x, y, z)
300 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
301 })
302 }
303
304
305 func testFloat32x8Ternary(t *testing.T, f func(_, _, _ simd.Float32x8) simd.Float32x8, want func(_, _, _ []float32) []float32) {
306 n := 8
307 t.Helper()
308 forSliceTriple(t, float32s, n, func(x, y, z []float32) bool {
309 t.Helper()
310 a := simd.LoadFloat32x8Slice(x)
311 b := simd.LoadFloat32x8Slice(y)
312 c := simd.LoadFloat32x8Slice(z)
313 g := make([]float32, n)
314 f(a, b, c).StoreSlice(g)
315 w := want(x, y, z)
316 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
317 })
318 }
319
320
321 func testFloat64x4Ternary(t *testing.T, f func(_, _, _ simd.Float64x4) simd.Float64x4, want func(_, _, _ []float64) []float64) {
322 n := 4
323 t.Helper()
324 forSliceTriple(t, float64s, n, func(x, y, z []float64) bool {
325 t.Helper()
326 a := simd.LoadFloat64x4Slice(x)
327 b := simd.LoadFloat64x4Slice(y)
328 c := simd.LoadFloat64x4Slice(z)
329 g := make([]float64, n)
330 f(a, b, c).StoreSlice(g)
331 w := want(x, y, z)
332 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
333 })
334 }
335
336
337 func testInt8x64Ternary(t *testing.T, f func(_, _, _ simd.Int8x64) simd.Int8x64, want func(_, _, _ []int8) []int8) {
338 n := 64
339 t.Helper()
340 forSliceTriple(t, int8s, n, func(x, y, z []int8) bool {
341 t.Helper()
342 a := simd.LoadInt8x64Slice(x)
343 b := simd.LoadInt8x64Slice(y)
344 c := simd.LoadInt8x64Slice(z)
345 g := make([]int8, n)
346 f(a, b, c).StoreSlice(g)
347 w := want(x, y, z)
348 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
349 })
350 }
351
352
353 func testInt16x32Ternary(t *testing.T, f func(_, _, _ simd.Int16x32) simd.Int16x32, want func(_, _, _ []int16) []int16) {
354 n := 32
355 t.Helper()
356 forSliceTriple(t, int16s, n, func(x, y, z []int16) bool {
357 t.Helper()
358 a := simd.LoadInt16x32Slice(x)
359 b := simd.LoadInt16x32Slice(y)
360 c := simd.LoadInt16x32Slice(z)
361 g := make([]int16, n)
362 f(a, b, c).StoreSlice(g)
363 w := want(x, y, z)
364 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
365 })
366 }
367
368
369 func testInt32x16Ternary(t *testing.T, f func(_, _, _ simd.Int32x16) simd.Int32x16, want func(_, _, _ []int32) []int32) {
370 n := 16
371 t.Helper()
372 forSliceTriple(t, int32s, n, func(x, y, z []int32) bool {
373 t.Helper()
374 a := simd.LoadInt32x16Slice(x)
375 b := simd.LoadInt32x16Slice(y)
376 c := simd.LoadInt32x16Slice(z)
377 g := make([]int32, n)
378 f(a, b, c).StoreSlice(g)
379 w := want(x, y, z)
380 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
381 })
382 }
383
384
385 func testInt64x8Ternary(t *testing.T, f func(_, _, _ simd.Int64x8) simd.Int64x8, want func(_, _, _ []int64) []int64) {
386 n := 8
387 t.Helper()
388 forSliceTriple(t, int64s, n, func(x, y, z []int64) bool {
389 t.Helper()
390 a := simd.LoadInt64x8Slice(x)
391 b := simd.LoadInt64x8Slice(y)
392 c := simd.LoadInt64x8Slice(z)
393 g := make([]int64, n)
394 f(a, b, c).StoreSlice(g)
395 w := want(x, y, z)
396 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
397 })
398 }
399
400
401 func testUint8x64Ternary(t *testing.T, f func(_, _, _ simd.Uint8x64) simd.Uint8x64, want func(_, _, _ []uint8) []uint8) {
402 n := 64
403 t.Helper()
404 forSliceTriple(t, uint8s, n, func(x, y, z []uint8) bool {
405 t.Helper()
406 a := simd.LoadUint8x64Slice(x)
407 b := simd.LoadUint8x64Slice(y)
408 c := simd.LoadUint8x64Slice(z)
409 g := make([]uint8, n)
410 f(a, b, c).StoreSlice(g)
411 w := want(x, y, z)
412 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
413 })
414 }
415
416
417 func testUint16x32Ternary(t *testing.T, f func(_, _, _ simd.Uint16x32) simd.Uint16x32, want func(_, _, _ []uint16) []uint16) {
418 n := 32
419 t.Helper()
420 forSliceTriple(t, uint16s, n, func(x, y, z []uint16) bool {
421 t.Helper()
422 a := simd.LoadUint16x32Slice(x)
423 b := simd.LoadUint16x32Slice(y)
424 c := simd.LoadUint16x32Slice(z)
425 g := make([]uint16, n)
426 f(a, b, c).StoreSlice(g)
427 w := want(x, y, z)
428 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
429 })
430 }
431
432
433 func testUint32x16Ternary(t *testing.T, f func(_, _, _ simd.Uint32x16) simd.Uint32x16, want func(_, _, _ []uint32) []uint32) {
434 n := 16
435 t.Helper()
436 forSliceTriple(t, uint32s, n, func(x, y, z []uint32) bool {
437 t.Helper()
438 a := simd.LoadUint32x16Slice(x)
439 b := simd.LoadUint32x16Slice(y)
440 c := simd.LoadUint32x16Slice(z)
441 g := make([]uint32, n)
442 f(a, b, c).StoreSlice(g)
443 w := want(x, y, z)
444 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
445 })
446 }
447
448
449 func testUint64x8Ternary(t *testing.T, f func(_, _, _ simd.Uint64x8) simd.Uint64x8, want func(_, _, _ []uint64) []uint64) {
450 n := 8
451 t.Helper()
452 forSliceTriple(t, uint64s, n, func(x, y, z []uint64) bool {
453 t.Helper()
454 a := simd.LoadUint64x8Slice(x)
455 b := simd.LoadUint64x8Slice(y)
456 c := simd.LoadUint64x8Slice(z)
457 g := make([]uint64, n)
458 f(a, b, c).StoreSlice(g)
459 w := want(x, y, z)
460 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
461 })
462 }
463
464
465 func testFloat32x16Ternary(t *testing.T, f func(_, _, _ simd.Float32x16) simd.Float32x16, want func(_, _, _ []float32) []float32) {
466 n := 16
467 t.Helper()
468 forSliceTriple(t, float32s, n, func(x, y, z []float32) bool {
469 t.Helper()
470 a := simd.LoadFloat32x16Slice(x)
471 b := simd.LoadFloat32x16Slice(y)
472 c := simd.LoadFloat32x16Slice(z)
473 g := make([]float32, n)
474 f(a, b, c).StoreSlice(g)
475 w := want(x, y, z)
476 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
477 })
478 }
479
480
481 func testFloat64x8Ternary(t *testing.T, f func(_, _, _ simd.Float64x8) simd.Float64x8, want func(_, _, _ []float64) []float64) {
482 n := 8
483 t.Helper()
484 forSliceTriple(t, float64s, n, func(x, y, z []float64) bool {
485 t.Helper()
486 a := simd.LoadFloat64x8Slice(x)
487 b := simd.LoadFloat64x8Slice(y)
488 c := simd.LoadFloat64x8Slice(z)
489 g := make([]float64, n)
490 f(a, b, c).StoreSlice(g)
491 w := want(x, y, z)
492 return checkSlicesLogInput(t, g, w, 0.0, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
493 })
494 }
495
496
497
498 func testFloat32x4TernaryFlaky(t *testing.T, f func(x, y, z simd.Float32x4) simd.Float32x4, want func(x, y, z []float32) []float32, flakiness float64) {
499 n := 4
500 t.Helper()
501 forSliceTriple(t, float32s, n, func(x, y, z []float32) bool {
502 t.Helper()
503 a := simd.LoadFloat32x4Slice(x)
504 b := simd.LoadFloat32x4Slice(y)
505 c := simd.LoadFloat32x4Slice(z)
506 g := make([]float32, n)
507 f(a, b, c).StoreSlice(g)
508 w := want(x, y, z)
509 return checkSlicesLogInput(t, g, w, flakiness, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
510 })
511 }
512
513
514
515 func testFloat32x8TernaryFlaky(t *testing.T, f func(x, y, z simd.Float32x8) simd.Float32x8, want func(x, y, z []float32) []float32, flakiness float64) {
516 n := 8
517 t.Helper()
518 forSliceTriple(t, float32s, n, func(x, y, z []float32) bool {
519 t.Helper()
520 a := simd.LoadFloat32x8Slice(x)
521 b := simd.LoadFloat32x8Slice(y)
522 c := simd.LoadFloat32x8Slice(z)
523 g := make([]float32, n)
524 f(a, b, c).StoreSlice(g)
525 w := want(x, y, z)
526 return checkSlicesLogInput(t, g, w, flakiness, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
527 })
528 }
529
530
531
532 func testFloat32x16TernaryFlaky(t *testing.T, f func(x, y, z simd.Float32x16) simd.Float32x16, want func(x, y, z []float32) []float32, flakiness float64) {
533 n := 16
534 t.Helper()
535 forSliceTriple(t, float32s, n, func(x, y, z []float32) bool {
536 t.Helper()
537 a := simd.LoadFloat32x16Slice(x)
538 b := simd.LoadFloat32x16Slice(y)
539 c := simd.LoadFloat32x16Slice(z)
540 g := make([]float32, n)
541 f(a, b, c).StoreSlice(g)
542 w := want(x, y, z)
543 return checkSlicesLogInput(t, g, w, flakiness, func() { t.Helper(); t.Logf("x=%v", x); t.Logf("y=%v", y); t.Logf("z=%v", z) })
544 })
545 }
546
View as plain text