Source file
src/simd/shuffles_amd64.go
1
2
3
4
5
6
7 package simd
8
9
10
11
12
13
14
15
16
17
18
19
20 const (
21 _LLLL = iota
22 _HLLL
23 _LHLL
24 _HHLL
25 _LLHL
26 _HLHL
27 _LHHL
28 _HHHL
29 _LLLH
30 _HLLH
31 _LHLH
32 _HHLH
33 _LLHH
34 _HLHH
35 _LHHH
36 _HHHH
37 )
38
39
40
41
42 const (
43 _LL = iota
44 _HL
45 _LH
46 _HH
47 )
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63 func (x Int32x4) SelectFromPair(a, b, c, d uint8, y Int32x4) Int32x4 {
64
65
66
67
68 pattern := a>>2 + (b&4)>>1 + (c & 4) + (d&4)<<1
69
70
71
72
73 a, b, c, d = a&3, b&3, c&3, d&3
74
75 switch pattern {
76 case _LLLL:
77 return x.concatSelectedConstant(cscimm4(a, b, c, d), x)
78 case _HHHH:
79 return y.concatSelectedConstant(cscimm4(a, b, c, d), y)
80 case _LLHH:
81 return x.concatSelectedConstant(cscimm4(a, b, c, d), y)
82 case _HHLL:
83 return y.concatSelectedConstant(cscimm4(a, b, c, d), x)
84
85 case _HLLL:
86 z := y.concatSelectedConstant(cscimm4(a, a, b, b), x)
87 return z.concatSelectedConstant(cscimm4(0, 2, c, d), x)
88 case _LHLL:
89 z := x.concatSelectedConstant(cscimm4(a, a, b, b), y)
90 return z.concatSelectedConstant(cscimm4(0, 2, c, d), x)
91
92 case _HLHH:
93 z := y.concatSelectedConstant(cscimm4(a, a, b, b), x)
94 return z.concatSelectedConstant(cscimm4(0, 2, c, d), y)
95 case _LHHH:
96 z := x.concatSelectedConstant(cscimm4(a, a, b, b), y)
97 return z.concatSelectedConstant(cscimm4(0, 2, c, d), y)
98
99 case _LLLH:
100 z := x.concatSelectedConstant(cscimm4(c, c, d, d), y)
101 return x.concatSelectedConstant(cscimm4(a, b, 0, 2), z)
102 case _LLHL:
103 z := y.concatSelectedConstant(cscimm4(c, c, d, d), x)
104 return x.concatSelectedConstant(cscimm4(a, b, 0, 2), z)
105 case _HHLH:
106 z := x.concatSelectedConstant(cscimm4(c, c, d, d), y)
107 return y.concatSelectedConstant(cscimm4(a, b, 0, 2), z)
108 case _HHHL:
109 z := y.concatSelectedConstant(cscimm4(c, c, d, d), x)
110 return y.concatSelectedConstant(cscimm4(a, b, 0, 2), z)
111
112 case _LHLH:
113 z := x.concatSelectedConstant(cscimm4(a, c, b, d), y)
114 return z.concatSelectedConstant(0b11_01_10_00 , z)
115 case _HLHL:
116 z := x.concatSelectedConstant(cscimm4(b, d, a, c), y)
117 return z.concatSelectedConstant(0b01_11_00_10 , z)
118 case _HLLH:
119 z := x.concatSelectedConstant(cscimm4(b, c, a, d), y)
120 return z.concatSelectedConstant(0b11_01_00_10 , z)
121 case _LHHL:
122 z := x.concatSelectedConstant(cscimm4(a, d, b, c), y)
123 return z.concatSelectedConstant(0b01_11_10_00 , z)
124 }
125 panic("missing case, switch should be exhaustive")
126 }
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142 func (x Uint32x4) SelectFromPair(a, b, c, d uint8, y Uint32x4) Uint32x4 {
143 pattern := a>>2 + (b&4)>>1 + (c & 4) + (d&4)<<1
144
145 a, b, c, d = a&3, b&3, c&3, d&3
146
147 switch pattern {
148 case _LLLL:
149 return x.concatSelectedConstant(cscimm4(a, b, c, d), x)
150 case _HHHH:
151 return y.concatSelectedConstant(cscimm4(a, b, c, d), y)
152 case _LLHH:
153 return x.concatSelectedConstant(cscimm4(a, b, c, d), y)
154 case _HHLL:
155 return y.concatSelectedConstant(cscimm4(a, b, c, d), x)
156
157 case _HLLL:
158 z := y.concatSelectedConstant(cscimm4(a, a, b, b), x)
159 return z.concatSelectedConstant(cscimm4(0, 2, c, d), x)
160 case _LHLL:
161 z := x.concatSelectedConstant(cscimm4(a, a, b, b), y)
162 return z.concatSelectedConstant(cscimm4(0, 2, c, d), x)
163
164 case _HLHH:
165 z := y.concatSelectedConstant(cscimm4(a, a, b, b), x)
166 return z.concatSelectedConstant(cscimm4(0, 2, c, d), y)
167 case _LHHH:
168 z := x.concatSelectedConstant(cscimm4(a, a, b, b), y)
169 return z.concatSelectedConstant(cscimm4(0, 2, c, d), y)
170
171 case _LLLH:
172 z := x.concatSelectedConstant(cscimm4(c, c, d, d), y)
173 return x.concatSelectedConstant(cscimm4(a, b, 0, 2), z)
174 case _LLHL:
175 z := y.concatSelectedConstant(cscimm4(c, c, d, d), x)
176 return x.concatSelectedConstant(cscimm4(a, b, 0, 2), z)
177 case _HHLH:
178 z := x.concatSelectedConstant(cscimm4(c, c, d, d), y)
179 return y.concatSelectedConstant(cscimm4(a, b, 0, 2), z)
180 case _HHHL:
181 z := y.concatSelectedConstant(cscimm4(c, c, d, d), x)
182 return y.concatSelectedConstant(cscimm4(a, b, 0, 2), z)
183
184 case _LHLH:
185 z := x.concatSelectedConstant(cscimm4(a, c, b, d), y)
186 return z.concatSelectedConstant(0b11_01_10_00 , z)
187 case _HLHL:
188 z := x.concatSelectedConstant(cscimm4(b, d, a, c), y)
189 return z.concatSelectedConstant(0b01_11_00_10 , z)
190 case _HLLH:
191 z := x.concatSelectedConstant(cscimm4(b, c, a, d), y)
192 return z.concatSelectedConstant(0b11_01_00_10 , z)
193 case _LHHL:
194 z := x.concatSelectedConstant(cscimm4(a, d, b, c), y)
195 return z.concatSelectedConstant(0b01_11_10_00 , z)
196 }
197 panic("missing case, switch should be exhaustive")
198 }
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214 func (x Float32x4) SelectFromPair(a, b, c, d uint8, y Float32x4) Float32x4 {
215 pattern := a>>2 + (b&4)>>1 + (c & 4) + (d&4)<<1
216
217 a, b, c, d = a&3, b&3, c&3, d&3
218
219 switch pattern {
220 case _LLLL:
221 return x.concatSelectedConstant(cscimm4(a, b, c, d), x)
222 case _HHHH:
223 return y.concatSelectedConstant(cscimm4(a, b, c, d), y)
224 case _LLHH:
225 return x.concatSelectedConstant(cscimm4(a, b, c, d), y)
226 case _HHLL:
227 return y.concatSelectedConstant(cscimm4(a, b, c, d), x)
228
229 case _HLLL:
230 z := y.concatSelectedConstant(cscimm4(a, a, b, b), x)
231 return z.concatSelectedConstant(cscimm4(0, 2, c, d), x)
232 case _LHLL:
233 z := x.concatSelectedConstant(cscimm4(a, a, b, b), y)
234 return z.concatSelectedConstant(cscimm4(0, 2, c, d), x)
235
236 case _HLHH:
237 z := y.concatSelectedConstant(cscimm4(a, a, b, b), x)
238 return z.concatSelectedConstant(cscimm4(0, 2, c, d), y)
239 case _LHHH:
240 z := x.concatSelectedConstant(cscimm4(a, a, b, b), y)
241 return z.concatSelectedConstant(cscimm4(0, 2, c, d), y)
242
243 case _LLLH:
244 z := x.concatSelectedConstant(cscimm4(c, c, d, d), y)
245 return x.concatSelectedConstant(cscimm4(a, b, 0, 2), z)
246 case _LLHL:
247 z := y.concatSelectedConstant(cscimm4(c, c, d, d), x)
248 return x.concatSelectedConstant(cscimm4(a, b, 0, 2), z)
249 case _HHLH:
250 z := x.concatSelectedConstant(cscimm4(c, c, d, d), y)
251 return y.concatSelectedConstant(cscimm4(a, b, 0, 2), z)
252 case _HHHL:
253 z := y.concatSelectedConstant(cscimm4(c, c, d, d), x)
254 return y.concatSelectedConstant(cscimm4(a, b, 0, 2), z)
255
256 case _LHLH:
257 z := x.concatSelectedConstant(cscimm4(a, c, b, d), y)
258 return z.concatSelectedConstant(0b11_01_10_00 , z)
259 case _HLHL:
260 z := x.concatSelectedConstant(cscimm4(b, d, a, c), y)
261 return z.concatSelectedConstant(0b01_11_00_10 , z)
262 case _HLLH:
263 z := x.concatSelectedConstant(cscimm4(b, c, a, d), y)
264 return z.concatSelectedConstant(0b11_01_00_10 , z)
265 case _LHHL:
266 z := x.concatSelectedConstant(cscimm4(a, d, b, c), y)
267 return z.concatSelectedConstant(0b01_11_10_00 , z)
268 }
269 panic("missing case, switch should be exhaustive")
270 }
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289 func (x Int32x8) SelectFromPairGrouped(a, b, c, d uint8, y Int32x8) Int32x8 {
290 pattern := a>>2 + (b&4)>>1 + (c & 4) + (d&4)<<1
291
292 a, b, c, d = a&3, b&3, c&3, d&3
293
294 switch pattern {
295 case _LLLL:
296 return x.concatSelectedConstantGrouped(cscimm4(a, b, c, d), x)
297 case _HHHH:
298 return y.concatSelectedConstantGrouped(cscimm4(a, b, c, d), y)
299 case _LLHH:
300 return x.concatSelectedConstantGrouped(cscimm4(a, b, c, d), y)
301 case _HHLL:
302 return y.concatSelectedConstantGrouped(cscimm4(a, b, c, d), x)
303
304 case _HLLL:
305 z := y.concatSelectedConstantGrouped(cscimm4(a, a, b, b), x)
306 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), x)
307 case _LHLL:
308 z := x.concatSelectedConstantGrouped(cscimm4(a, a, b, b), y)
309 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), x)
310
311 case _HLHH:
312 z := y.concatSelectedConstantGrouped(cscimm4(a, a, b, b), x)
313 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), y)
314 case _LHHH:
315 z := x.concatSelectedConstantGrouped(cscimm4(a, a, b, b), y)
316 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), y)
317
318 case _LLLH:
319 z := x.concatSelectedConstantGrouped(cscimm4(c, c, d, d), y)
320 return x.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
321 case _LLHL:
322 z := y.concatSelectedConstantGrouped(cscimm4(c, c, d, d), x)
323 return x.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
324 case _HHLH:
325 z := x.concatSelectedConstantGrouped(cscimm4(c, c, d, d), y)
326 return y.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
327 case _HHHL:
328 z := y.concatSelectedConstantGrouped(cscimm4(c, c, d, d), x)
329 return y.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
330
331 case _LHLH:
332 z := x.concatSelectedConstantGrouped(cscimm4(a, c, b, d), y)
333 return z.concatSelectedConstantGrouped(0b11_01_10_00 , z)
334 case _HLHL:
335 z := x.concatSelectedConstantGrouped(cscimm4(b, d, a, c), y)
336 return z.concatSelectedConstantGrouped(0b01_11_00_10 , z)
337 case _HLLH:
338 z := x.concatSelectedConstantGrouped(cscimm4(b, c, a, d), y)
339 return z.concatSelectedConstantGrouped(0b11_01_00_10 , z)
340 case _LHHL:
341 z := x.concatSelectedConstantGrouped(cscimm4(a, d, b, c), y)
342 return z.concatSelectedConstantGrouped(0b01_11_10_00 , z)
343 }
344 panic("missing case, switch should be exhaustive")
345 }
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364 func (x Uint32x8) SelectFromPairGrouped(a, b, c, d uint8, y Uint32x8) Uint32x8 {
365 pattern := a>>2 + (b&4)>>1 + (c & 4) + (d&4)<<1
366
367 a, b, c, d = a&3, b&3, c&3, d&3
368
369 switch pattern {
370 case _LLLL:
371 return x.concatSelectedConstantGrouped(cscimm4(a, b, c, d), x)
372 case _HHHH:
373 return y.concatSelectedConstantGrouped(cscimm4(a, b, c, d), y)
374 case _LLHH:
375 return x.concatSelectedConstantGrouped(cscimm4(a, b, c, d), y)
376 case _HHLL:
377 return y.concatSelectedConstantGrouped(cscimm4(a, b, c, d), x)
378
379 case _HLLL:
380 z := y.concatSelectedConstantGrouped(cscimm4(a, a, b, b), x)
381 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), x)
382 case _LHLL:
383 z := x.concatSelectedConstantGrouped(cscimm4(a, a, b, b), y)
384 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), x)
385
386 case _HLHH:
387 z := y.concatSelectedConstantGrouped(cscimm4(a, a, b, b), x)
388 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), y)
389 case _LHHH:
390 z := x.concatSelectedConstantGrouped(cscimm4(a, a, b, b), y)
391 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), y)
392
393 case _LLLH:
394 z := x.concatSelectedConstantGrouped(cscimm4(c, c, d, d), y)
395 return x.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
396 case _LLHL:
397 z := y.concatSelectedConstantGrouped(cscimm4(c, c, d, d), x)
398 return x.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
399 case _HHLH:
400 z := x.concatSelectedConstantGrouped(cscimm4(c, c, d, d), y)
401 return y.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
402 case _HHHL:
403 z := y.concatSelectedConstantGrouped(cscimm4(c, c, d, d), x)
404 return y.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
405
406 case _LHLH:
407 z := x.concatSelectedConstantGrouped(cscimm4(a, c, b, d), y)
408 return z.concatSelectedConstantGrouped(0b11_01_10_00 , z)
409 case _HLHL:
410 z := x.concatSelectedConstantGrouped(cscimm4(b, d, a, c), y)
411 return z.concatSelectedConstantGrouped(0b01_11_00_10 , z)
412 case _HLLH:
413 z := x.concatSelectedConstantGrouped(cscimm4(b, c, a, d), y)
414 return z.concatSelectedConstantGrouped(0b11_01_00_10 , z)
415 case _LHHL:
416 z := x.concatSelectedConstantGrouped(cscimm4(a, d, b, c), y)
417 return z.concatSelectedConstantGrouped(0b01_11_10_00 , z)
418 }
419 panic("missing case, switch should be exhaustive")
420 }
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439 func (x Float32x8) SelectFromPairGrouped(a, b, c, d uint8, y Float32x8) Float32x8 {
440 pattern := a>>2 + (b&4)>>1 + (c & 4) + (d&4)<<1
441
442 a, b, c, d = a&3, b&3, c&3, d&3
443
444 switch pattern {
445 case _LLLL:
446 return x.concatSelectedConstantGrouped(cscimm4(a, b, c, d), x)
447 case _HHHH:
448 return y.concatSelectedConstantGrouped(cscimm4(a, b, c, d), y)
449 case _LLHH:
450 return x.concatSelectedConstantGrouped(cscimm4(a, b, c, d), y)
451 case _HHLL:
452 return y.concatSelectedConstantGrouped(cscimm4(a, b, c, d), x)
453
454 case _HLLL:
455 z := y.concatSelectedConstantGrouped(cscimm4(a, a, b, b), x)
456 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), x)
457 case _LHLL:
458 z := x.concatSelectedConstantGrouped(cscimm4(a, a, b, b), y)
459 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), x)
460
461 case _HLHH:
462 z := y.concatSelectedConstantGrouped(cscimm4(a, a, b, b), x)
463 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), y)
464 case _LHHH:
465 z := x.concatSelectedConstantGrouped(cscimm4(a, a, b, b), y)
466 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), y)
467
468 case _LLLH:
469 z := x.concatSelectedConstantGrouped(cscimm4(c, c, d, d), y)
470 return x.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
471 case _LLHL:
472 z := y.concatSelectedConstantGrouped(cscimm4(c, c, d, d), x)
473 return x.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
474 case _HHLH:
475 z := x.concatSelectedConstantGrouped(cscimm4(c, c, d, d), y)
476 return y.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
477 case _HHHL:
478 z := y.concatSelectedConstantGrouped(cscimm4(c, c, d, d), x)
479 return y.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
480
481 case _LHLH:
482 z := x.concatSelectedConstantGrouped(cscimm4(a, c, b, d), y)
483 return z.concatSelectedConstantGrouped(0b11_01_10_00 , z)
484 case _HLHL:
485 z := x.concatSelectedConstantGrouped(cscimm4(b, d, a, c), y)
486 return z.concatSelectedConstantGrouped(0b01_11_00_10 , z)
487 case _HLLH:
488 z := x.concatSelectedConstantGrouped(cscimm4(b, c, a, d), y)
489 return z.concatSelectedConstantGrouped(0b11_01_00_10 , z)
490 case _LHHL:
491 z := x.concatSelectedConstantGrouped(cscimm4(a, d, b, c), y)
492 return z.concatSelectedConstantGrouped(0b01_11_10_00 , z)
493 }
494 panic("missing case, switch should be exhaustive")
495 }
496
497
498
499
500
501
502
503
504
505
506
507
508
509 func (x Int32x16) SelectFromPairGrouped(a, b, c, d uint8, y Int32x16) Int32x16 {
510 pattern := a>>2 + (b&4)>>1 + (c & 4) + (d&4)<<1
511
512 a, b, c, d = a&3, b&3, c&3, d&3
513
514 switch pattern {
515 case _LLLL:
516 return x.concatSelectedConstantGrouped(cscimm4(a, b, c, d), x)
517 case _HHHH:
518 return y.concatSelectedConstantGrouped(cscimm4(a, b, c, d), y)
519 case _LLHH:
520 return x.concatSelectedConstantGrouped(cscimm4(a, b, c, d), y)
521 case _HHLL:
522 return y.concatSelectedConstantGrouped(cscimm4(a, b, c, d), x)
523
524 case _HLLL:
525 z := y.concatSelectedConstantGrouped(cscimm4(a, a, b, b), x)
526 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), x)
527 case _LHLL:
528 z := x.concatSelectedConstantGrouped(cscimm4(a, a, b, b), y)
529 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), x)
530
531 case _HLHH:
532 z := y.concatSelectedConstantGrouped(cscimm4(a, a, b, b), x)
533 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), y)
534 case _LHHH:
535 z := x.concatSelectedConstantGrouped(cscimm4(a, a, b, b), y)
536 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), y)
537
538 case _LLLH:
539 z := x.concatSelectedConstantGrouped(cscimm4(c, c, d, d), y)
540 return x.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
541 case _LLHL:
542 z := y.concatSelectedConstantGrouped(cscimm4(c, c, d, d), x)
543 return x.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
544 case _HHLH:
545 z := x.concatSelectedConstantGrouped(cscimm4(c, c, d, d), y)
546 return y.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
547 case _HHHL:
548 z := y.concatSelectedConstantGrouped(cscimm4(c, c, d, d), x)
549 return y.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
550
551 case _LHLH:
552 z := x.concatSelectedConstantGrouped(cscimm4(a, c, b, d), y)
553 return z.concatSelectedConstantGrouped(0b11_01_10_00 , z)
554 case _HLHL:
555 z := x.concatSelectedConstantGrouped(cscimm4(b, d, a, c), y)
556 return z.concatSelectedConstantGrouped(0b01_11_00_10 , z)
557 case _HLLH:
558 z := x.concatSelectedConstantGrouped(cscimm4(b, c, a, d), y)
559 return z.concatSelectedConstantGrouped(0b11_01_00_10 , z)
560 case _LHHL:
561 z := x.concatSelectedConstantGrouped(cscimm4(a, d, b, c), y)
562 return z.concatSelectedConstantGrouped(0b01_11_10_00 , z)
563 }
564 panic("missing case, switch should be exhaustive")
565 }
566
567
568
569
570
571
572
573
574
575
576
577
578
579 func (x Uint32x16) SelectFromPairGrouped(a, b, c, d uint8, y Uint32x16) Uint32x16 {
580 pattern := a>>2 + (b&4)>>1 + (c & 4) + (d&4)<<1
581
582 a, b, c, d = a&3, b&3, c&3, d&3
583
584 switch pattern {
585 case _LLLL:
586 return x.concatSelectedConstantGrouped(cscimm4(a, b, c, d), x)
587 case _HHHH:
588 return y.concatSelectedConstantGrouped(cscimm4(a, b, c, d), y)
589 case _LLHH:
590 return x.concatSelectedConstantGrouped(cscimm4(a, b, c, d), y)
591 case _HHLL:
592 return y.concatSelectedConstantGrouped(cscimm4(a, b, c, d), x)
593
594 case _HLLL:
595 z := y.concatSelectedConstantGrouped(cscimm4(a, a, b, b), x)
596 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), x)
597 case _LHLL:
598 z := x.concatSelectedConstantGrouped(cscimm4(a, a, b, b), y)
599 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), x)
600
601 case _HLHH:
602 z := y.concatSelectedConstantGrouped(cscimm4(a, a, b, b), x)
603 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), y)
604 case _LHHH:
605 z := x.concatSelectedConstantGrouped(cscimm4(a, a, b, b), y)
606 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), y)
607
608 case _LLLH:
609 z := x.concatSelectedConstantGrouped(cscimm4(c, c, d, d), y)
610 return x.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
611 case _LLHL:
612 z := y.concatSelectedConstantGrouped(cscimm4(c, c, d, d), x)
613 return x.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
614 case _HHLH:
615 z := x.concatSelectedConstantGrouped(cscimm4(c, c, d, d), y)
616 return y.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
617 case _HHHL:
618 z := y.concatSelectedConstantGrouped(cscimm4(c, c, d, d), x)
619 return y.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
620
621 case _LHLH:
622 z := x.concatSelectedConstantGrouped(cscimm4(a, c, b, d), y)
623 return z.concatSelectedConstantGrouped(0b11_01_10_00 , z)
624 case _HLHL:
625 z := x.concatSelectedConstantGrouped(cscimm4(b, d, a, c), y)
626 return z.concatSelectedConstantGrouped(0b01_11_00_10 , z)
627 case _HLLH:
628 z := x.concatSelectedConstantGrouped(cscimm4(b, c, a, d), y)
629 return z.concatSelectedConstantGrouped(0b11_01_00_10 , z)
630 case _LHHL:
631 z := x.concatSelectedConstantGrouped(cscimm4(a, d, b, c), y)
632 return z.concatSelectedConstantGrouped(0b01_11_10_00 , z)
633 }
634 panic("missing case, switch should be exhaustive")
635 }
636
637
638
639
640
641
642
643
644
645
646
647
648
649 func (x Float32x16) SelectFromPairGrouped(a, b, c, d uint8, y Float32x16) Float32x16 {
650 pattern := a>>2 + (b&4)>>1 + (c & 4) + (d&4)<<1
651
652 a, b, c, d = a&3, b&3, c&3, d&3
653
654 switch pattern {
655 case _LLLL:
656 return x.concatSelectedConstantGrouped(cscimm4(a, b, c, d), x)
657 case _HHHH:
658 return y.concatSelectedConstantGrouped(cscimm4(a, b, c, d), y)
659 case _LLHH:
660 return x.concatSelectedConstantGrouped(cscimm4(a, b, c, d), y)
661 case _HHLL:
662 return y.concatSelectedConstantGrouped(cscimm4(a, b, c, d), x)
663
664 case _HLLL:
665 z := y.concatSelectedConstantGrouped(cscimm4(a, a, b, b), x)
666 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), x)
667 case _LHLL:
668 z := x.concatSelectedConstantGrouped(cscimm4(a, a, b, b), y)
669 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), x)
670
671 case _HLHH:
672 z := y.concatSelectedConstantGrouped(cscimm4(a, a, b, b), x)
673 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), y)
674 case _LHHH:
675 z := x.concatSelectedConstantGrouped(cscimm4(a, a, b, b), y)
676 return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), y)
677
678 case _LLLH:
679 z := x.concatSelectedConstantGrouped(cscimm4(c, c, d, d), y)
680 return x.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
681 case _LLHL:
682 z := y.concatSelectedConstantGrouped(cscimm4(c, c, d, d), x)
683 return x.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
684 case _HHLH:
685 z := x.concatSelectedConstantGrouped(cscimm4(c, c, d, d), y)
686 return y.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
687 case _HHHL:
688 z := y.concatSelectedConstantGrouped(cscimm4(c, c, d, d), x)
689 return y.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
690
691 case _LHLH:
692 z := x.concatSelectedConstantGrouped(cscimm4(a, c, b, d), y)
693 return z.concatSelectedConstantGrouped(0b11_01_10_00 , z)
694 case _HLHL:
695 z := x.concatSelectedConstantGrouped(cscimm4(b, d, a, c), y)
696 return z.concatSelectedConstantGrouped(0b01_11_00_10 , z)
697 case _HLLH:
698 z := x.concatSelectedConstantGrouped(cscimm4(b, c, a, d), y)
699 return z.concatSelectedConstantGrouped(0b11_01_00_10 , z)
700 case _LHHL:
701 z := x.concatSelectedConstantGrouped(cscimm4(a, d, b, c), y)
702 return z.concatSelectedConstantGrouped(0b01_11_10_00 , z)
703 }
704 panic("missing case, switch should be exhaustive")
705 }
706
707
708
709 func cscimm4(a, b, c, d uint8) uint8 {
710 return uint8(a + b<<2 + c<<4 + d<<6)
711 }
712
713
714
715 func cscimm2(a, b uint8) uint8 {
716 return uint8(a + b<<1)
717 }
718
719
720
721
722 func cscimm2g2(a, b uint8) uint8 {
723 g := cscimm2(a, b)
724 return g + g<<2
725 }
726
727
728
729
730 func cscimm2g4(a, b uint8) uint8 {
731 g := cscimm2g2(a, b)
732 return g + g<<4
733 }
734
735
736
737
738
739
740
741
742
743
744
745 func (x Uint64x2) SelectFromPair(a, b uint8, y Uint64x2) Uint64x2 {
746 pattern := (a&2)>>1 + (b & 2)
747
748 a, b = a&1, b&1
749
750 switch pattern {
751 case _LL:
752 return x.concatSelectedConstant(cscimm2(a, b), x)
753 case _HH:
754 return y.concatSelectedConstant(cscimm2(a, b), y)
755 case _LH:
756 return x.concatSelectedConstant(cscimm2(a, b), y)
757 case _HL:
758 return y.concatSelectedConstant(cscimm2(a, b), x)
759 }
760 panic("missing case, switch should be exhaustive")
761 }
762
763
764
765
766
767
768
769
770
771
772
773
774 func (x Uint64x4) SelectFromPairGrouped(a, b uint8, y Uint64x4) Uint64x4 {
775 pattern := (a&2)>>1 + (b & 2)
776
777 a, b = a&1, b&1
778
779 switch pattern {
780 case _LL:
781 return x.concatSelectedConstantGrouped(cscimm2g2(a, b), x)
782 case _HH:
783 return y.concatSelectedConstantGrouped(cscimm2g2(a, b), y)
784 case _LH:
785 return x.concatSelectedConstantGrouped(cscimm2g2(a, b), y)
786 case _HL:
787 return y.concatSelectedConstantGrouped(cscimm2g2(a, b), x)
788 }
789 panic("missing case, switch should be exhaustive")
790 }
791
792
793
794
795
796
797
798
799
800
801
802
803 func (x Uint64x8) SelectFromPairGrouped(a, b uint8, y Uint64x8) Uint64x8 {
804 pattern := (a&2)>>1 + (b & 2)
805
806 a, b = a&1, b&1
807
808 switch pattern {
809 case _LL:
810 return x.concatSelectedConstantGrouped(cscimm2g4(a, b), x)
811 case _HH:
812 return y.concatSelectedConstantGrouped(cscimm2g4(a, b), y)
813 case _LH:
814 return x.concatSelectedConstantGrouped(cscimm2g4(a, b), y)
815 case _HL:
816 return y.concatSelectedConstantGrouped(cscimm2g4(a, b), x)
817 }
818 panic("missing case, switch should be exhaustive")
819 }
820
821
822
823
824
825
826
827
828
829
830
831 func (x Float64x2) SelectFromPair(a, b uint8, y Float64x2) Float64x2 {
832 pattern := (a&2)>>1 + (b & 2)
833
834 a, b = a&1, b&1
835
836 switch pattern {
837 case _LL:
838 return x.concatSelectedConstant(cscimm2(a, b), x)
839 case _HH:
840 return y.concatSelectedConstant(cscimm2(a, b), y)
841 case _LH:
842 return x.concatSelectedConstant(cscimm2(a, b), y)
843 case _HL:
844 return y.concatSelectedConstant(cscimm2(a, b), x)
845 }
846 panic("missing case, switch should be exhaustive")
847 }
848
849
850
851
852
853
854
855
856
857
858
859
860 func (x Float64x4) SelectFromPairGrouped(a, b uint8, y Float64x4) Float64x4 {
861 pattern := (a&2)>>1 + (b & 2)
862
863 a, b = a&1, b&1
864
865 switch pattern {
866 case _LL:
867 return x.concatSelectedConstantGrouped(cscimm2g2(a, b), x)
868 case _HH:
869 return y.concatSelectedConstantGrouped(cscimm2g2(a, b), y)
870 case _LH:
871 return x.concatSelectedConstantGrouped(cscimm2g2(a, b), y)
872 case _HL:
873 return y.concatSelectedConstantGrouped(cscimm2g2(a, b), x)
874 }
875 panic("missing case, switch should be exhaustive")
876 }
877
878
879
880
881
882
883
884
885
886
887
888
889 func (x Float64x8) SelectFromPairGrouped(a, b uint8, y Float64x8) Float64x8 {
890 pattern := (a&2)>>1 + (b & 2)
891
892 a, b = a&1, b&1
893
894 switch pattern {
895 case _LL:
896 return x.concatSelectedConstantGrouped(cscimm2g4(a, b), x)
897 case _HH:
898 return y.concatSelectedConstantGrouped(cscimm2g4(a, b), y)
899 case _LH:
900 return x.concatSelectedConstantGrouped(cscimm2g4(a, b), y)
901 case _HL:
902 return y.concatSelectedConstantGrouped(cscimm2g4(a, b), x)
903 }
904 panic("missing case, switch should be exhaustive")
905 }
906
907
908
909
910
911
912
913
914
915
916
917 func (x Int64x2) SelectFromPair(a, b uint8, y Int64x2) Int64x2 {
918 pattern := (a&2)>>1 + (b & 2)
919
920 a, b = a&1, b&1
921
922 switch pattern {
923 case _LL:
924 return x.concatSelectedConstant(cscimm2(a, b), x)
925 case _HH:
926 return y.concatSelectedConstant(cscimm2(a, b), y)
927 case _LH:
928 return x.concatSelectedConstant(cscimm2(a, b), y)
929 case _HL:
930 return y.concatSelectedConstant(cscimm2(a, b), x)
931 }
932 panic("missing case, switch should be exhaustive")
933 }
934
935
936
937
938
939
940
941
942
943
944
945
946 func (x Int64x4) SelectFromPairGrouped(a, b uint8, y Int64x4) Int64x4 {
947 pattern := (a&2)>>1 + (b & 2)
948
949 a, b = a&1, b&1
950
951 switch pattern {
952 case _LL:
953 return x.concatSelectedConstantGrouped(cscimm2g2(a, b), x)
954 case _HH:
955 return y.concatSelectedConstantGrouped(cscimm2g2(a, b), y)
956 case _LH:
957 return x.concatSelectedConstantGrouped(cscimm2g2(a, b), y)
958 case _HL:
959 return y.concatSelectedConstantGrouped(cscimm2g2(a, b), x)
960 }
961 panic("missing case, switch should be exhaustive")
962 }
963
964
965
966
967
968
969
970
971
972
973
974
975 func (x Int64x8) SelectFromPairGrouped(a, b uint8, y Int64x8) Int64x8 {
976 pattern := (a&2)>>1 + (b & 2)
977
978 a, b = a&1, b&1
979
980 switch pattern {
981 case _LL:
982 return x.concatSelectedConstantGrouped(cscimm2g4(a, b), x)
983 case _HH:
984 return y.concatSelectedConstantGrouped(cscimm2g4(a, b), y)
985 case _LH:
986 return x.concatSelectedConstantGrouped(cscimm2g4(a, b), y)
987 case _HL:
988 return y.concatSelectedConstantGrouped(cscimm2g4(a, b), x)
989 }
990 panic("missing case, switch should be exhaustive")
991 }
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004 func (x Int32x4) PermuteScalars(a, b, c, d uint8) Int32x4 {
1005 return x.permuteScalars(a&3 | (b&3)<<2 | (c&3)<<4 | d<<6)
1006 }
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017 func (x Uint32x4) PermuteScalars(a, b, c, d uint8) Uint32x4 {
1018 return x.permuteScalars(a&3 | (b&3)<<2 | (c&3)<<4 | d<<6)
1019 }
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032 func (x Int32x8) PermuteScalarsGrouped(a, b, c, d uint8) Int32x8 {
1033 return x.permuteScalarsGrouped(a&3 | (b&3)<<2 | (c&3)<<4 | d<<6)
1034 }
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047 func (x Int32x16) PermuteScalarsGrouped(a, b, c, d uint8) Int32x16 {
1048 return x.permuteScalarsGrouped(a&3 | (b&3)<<2 | (c&3)<<4 | d<<6)
1049 }
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060 func (x Uint32x8) PermuteScalarsGrouped(a, b, c, d uint8) Uint32x8 {
1061 return x.permuteScalarsGrouped(a&3 | (b&3)<<2 | (c&3)<<4 | d<<6)
1062 }
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075 func (x Uint32x16) PermuteScalarsGrouped(a, b, c, d uint8) Uint32x16 {
1076 return x.permuteScalarsGrouped(a&3 | (b&3)<<2 | (c&3)<<4 | d<<6)
1077 }
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090 func (x Int16x8) PermuteScalarsHi(a, b, c, d uint8) Int16x8 {
1091 return x.permuteScalarsHi(a&3 | (b&3)<<2 | (c&3)<<4 | d<<6)
1092 }
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103 func (x Uint16x8) PermuteScalarsHi(a, b, c, d uint8) Uint16x8 {
1104 return x.permuteScalarsHi(a&3 | (b&3)<<2 | (c&3)<<4 | d<<6)
1105 }
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120 func (x Int16x16) PermuteScalarsHiGrouped(a, b, c, d uint8) Int16x16 {
1121 return x.permuteScalarsHiGrouped(a&3 | (b&3)<<2 | (c&3)<<4 | d<<6)
1122 }
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137 func (x Int16x32) PermuteScalarsHiGrouped(a, b, c, d uint8) Int16x32 {
1138 return x.permuteScalarsHiGrouped(a&3 | (b&3)<<2 | (c&3)<<4 | d<<6)
1139 }
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154 func (x Uint16x16) PermuteScalarsHiGrouped(a, b, c, d uint8) Uint16x16 {
1155 return x.permuteScalarsHiGrouped(a&3 | (b&3)<<2 | (c&3)<<4 | d<<6)
1156 }
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171 func (x Uint16x32) PermuteScalarsHiGrouped(a, b, c, d uint8) Uint16x32 {
1172 return x.permuteScalarsHiGrouped(a&3 | (b&3)<<2 | (c&3)<<4 | d<<6)
1173 }
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186 func (x Int16x8) PermuteScalarsLo(a, b, c, d uint8) Int16x8 {
1187 return x.permuteScalarsLo(a&3 | (b&3)<<2 | (c&3)<<4 | d<<6)
1188 }
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199 func (x Uint16x8) PermuteScalarsLo(a, b, c, d uint8) Uint16x8 {
1200 return x.permuteScalarsLo(a&3 | (b&3)<<2 | (c&3)<<4 | d<<6)
1201 }
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216 func (x Int16x16) PermuteScalarsLoGrouped(a, b, c, d uint8) Int16x16 {
1217 return x.permuteScalarsLoGrouped(a&3 | (b&3)<<2 | (c&3)<<4 | d<<6)
1218 }
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233 func (x Int16x32) PermuteScalarsLoGrouped(a, b, c, d uint8) Int16x32 {
1234 return x.permuteScalarsLoGrouped(a&3 | (b&3)<<2 | (c&3)<<4 | d<<6)
1235 }
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247 func (x Uint16x16) PermuteScalarsLoGrouped(a, b, c, d uint8) Uint16x16 {
1248 return x.permuteScalarsLoGrouped(a&3 | (b&3)<<2 | (c&3)<<4 | d<<6)
1249 }
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266 func (x Uint16x32) PermuteScalarsLoGrouped(a, b, c, d uint8) Uint16x32 {
1267 return x.permuteScalarsLoGrouped(a&3 | (b&3)<<2 | (c&3)<<4 | d<<6)
1268 }
1269
View as plain text