summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86/avx-intrinsics-fast-isel.ll
blob: 4efec2c23c5cda65b2d52c54b8395b83da0732b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -fast-isel -mtriple=i386-unknown-unknown -mattr=avx,aes,pclmul | FileCheck %s --check-prefix=ALL --check-prefix=X32
; RUN: llc < %s -fast-isel -mtriple=x86_64-unknown-unknown -mattr=avx,aes,pclmul | FileCheck %s --check-prefix=ALL --check-prefix=X64

; NOTE: This should use IR equivalent to what is generated by clang/test/CodeGen/avx-builtins.c

define <4 x double> @test_mm256_add_pd(<4 x double> %a0, <4 x double> %a1) {
; X32-LABEL: test_mm256_add_pd:
; X32:       # BB#0:
; X32-NEXT:    vaddpd %ymm1, %ymm0, %ymm0
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_add_pd:
; X64:       # BB#0:
; X64-NEXT:    vaddpd %ymm1, %ymm0, %ymm0
; X64-NEXT:    retq
  %res = fadd <4 x double> %a0, %a1
  ret <4 x double> %res
}

define <8 x float> @test_mm256_add_ps(<8 x float> %a0, <8 x float> %a1) {
; X32-LABEL: test_mm256_add_ps:
; X32:       # BB#0:
; X32-NEXT:    vaddps %ymm1, %ymm0, %ymm0
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_add_ps:
; X64:       # BB#0:
; X64-NEXT:    vaddps %ymm1, %ymm0, %ymm0
; X64-NEXT:    retq
  %res = fadd <8 x float> %a0, %a1
  ret <8 x float> %res
}

define <4 x double> @test_mm256_addsub_pd(<4 x double> %a0, <4 x double> %a1) {
; X32-LABEL: test_mm256_addsub_pd:
; X32:       # BB#0:
; X32-NEXT:    vaddsubpd %ymm1, %ymm0, %ymm0
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_addsub_pd:
; X64:       # BB#0:
; X64-NEXT:    vaddsubpd %ymm1, %ymm0, %ymm0
; X64-NEXT:    retq
  %res = call <4 x double> @llvm.x86.avx.addsub.pd.256(<4 x double> %a0, <4 x double> %a1)
  ret <4 x double> %res
}
declare <4 x double> @llvm.x86.avx.addsub.pd.256(<4 x double>, <4 x double>) nounwind readnone

define <8 x float> @test_mm256_addsub_ps(<8 x float> %a0, <8 x float> %a1) {
; X32-LABEL: test_mm256_addsub_ps:
; X32:       # BB#0:
; X32-NEXT:    vaddsubps %ymm1, %ymm0, %ymm0
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_addsub_ps:
; X64:       # BB#0:
; X64-NEXT:    vaddsubps %ymm1, %ymm0, %ymm0
; X64-NEXT:    retq
  %res = call <8 x float> @llvm.x86.avx.addsub.ps.256(<8 x float> %a0, <8 x float> %a1)
  ret <8 x float> %res
}
declare <8 x float> @llvm.x86.avx.addsub.ps.256(<8 x float>, <8 x float>) nounwind readnone

define <4 x double> @test_mm256_and_pd(<4 x double> %a0, <4 x double> %a1) {
; X32-LABEL: test_mm256_and_pd:
; X32:       # BB#0:
; X32-NEXT:    vandps %ymm1, %ymm0, %ymm0
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_and_pd:
; X64:       # BB#0:
; X64-NEXT:    vandps %ymm1, %ymm0, %ymm0
; X64-NEXT:    retq
  %1 = bitcast <4 x double> %a0 to <4 x i64>
  %2 = bitcast <4 x double> %a1 to <4 x i64>
  %res = and <4 x i64> %1, %2
  %bc = bitcast <4 x i64> %res to <4 x double>
  ret <4 x double> %bc
}

define <8 x float> @test_mm256_and_ps(<8 x float> %a0, <8 x float> %a1) {
; X32-LABEL: test_mm256_and_ps:
; X32:       # BB#0:
; X32-NEXT:    vandps %ymm1, %ymm0, %ymm0
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_and_ps:
; X64:       # BB#0:
; X64-NEXT:    vandps %ymm1, %ymm0, %ymm0
; X64-NEXT:    retq
  %1 = bitcast <8 x float> %a0 to <8 x i32>
  %2 = bitcast <8 x float> %a1 to <8 x i32>
  %res = and <8 x i32> %1, %2
  %bc = bitcast <8 x i32> %res to <8 x float>
  ret <8 x float> %bc
}

define <4 x double> @test_mm256_andnot_pd(<4 x double> %a0, <4 x double> %a1) {
; X32-LABEL: test_mm256_andnot_pd:
; X32:       # BB#0:
; X32-NEXT:    vpcmpeqd %xmm2, %xmm2, %xmm2
; X32-NEXT:    vinsertf128 $1, %xmm2, %ymm2, %ymm2
; X32-NEXT:    vxorps %ymm2, %ymm0, %ymm0
; X32-NEXT:    vandps %ymm1, %ymm0, %ymm0
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_andnot_pd:
; X64:       # BB#0:
; X64-NEXT:    vpcmpeqd %xmm2, %xmm2, %xmm2
; X64-NEXT:    vinsertf128 $1, %xmm2, %ymm2, %ymm2
; X64-NEXT:    vxorps %ymm2, %ymm0, %ymm0
; X64-NEXT:    vandps %ymm1, %ymm0, %ymm0
; X64-NEXT:    retq
  %1 = bitcast <4 x double> %a0 to <4 x i64>
  %2 = bitcast <4 x double> %a1 to <4 x i64>
  %3 = xor <4 x i64> %1, <i64 -1, i64 -1, i64 -1, i64 -1>
  %res = and <4 x i64> %3, %2
  %bc = bitcast <4 x i64> %res to <4 x double>
  ret <4 x double> %bc
}

define <8 x float> @test_mm256_andnot_ps(<8 x float> %a0, <8 x float> %a1) {
; X32-LABEL: test_mm256_andnot_ps:
; X32:       # BB#0:
; X32-NEXT:    vandnps %ymm1, %ymm0, %ymm0
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_andnot_ps:
; X64:       # BB#0:
; X64-NEXT:    vandnps %ymm1, %ymm0, %ymm0
; X64-NEXT:    retq
  %1 = bitcast <8 x float> %a0 to <8 x i32>
  %2 = bitcast <8 x float> %a1 to <8 x i32>
  %3 = xor <8 x i32> %1, <i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1>
  %res = and <8 x i32> %3, %2
  %bc = bitcast <8 x i32> %res to <8 x float>
  ret <8 x float> %bc
}

define <4 x double> @test_mm256_blend_pd(<4 x double> %a0, <4 x double> %a1) {
; X32-LABEL: test_mm256_blend_pd:
; X32:       # BB#0:
; X32-NEXT:    vblendpd {{.*#+}} ymm0 = ymm0[0],ymm1[1,2],ymm0[3]
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_blend_pd:
; X64:       # BB#0:
; X64-NEXT:    vblendpd {{.*#+}} ymm0 = ymm0[0],ymm1[1,2],ymm0[3]
; X64-NEXT:    retq
  %res = shufflevector <4 x double> %a0, <4 x double> %a1, <4 x i32> <i32 0, i32 5, i32 6, i32 3>
  ret <4 x double> %res
}

define <8 x float> @test_mm256_blend_ps(<8 x float> %a0, <8 x float> %a1) {
; X32-LABEL: test_mm256_blend_ps:
; X32:       # BB#0:
; X32-NEXT:    vblendps {{.*#+}} ymm0 = ymm0[0],ymm1[1,2,3],ymm0[4,5,6],ymm1[7]
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_blend_ps:
; X64:       # BB#0:
; X64-NEXT:    vblendps {{.*#+}} ymm0 = ymm0[0],ymm1[1,2,3],ymm0[4,5,6],ymm1[7]
; X64-NEXT:    retq
  %res = shufflevector <8 x float> %a0, <8 x float> %a1, <8 x i32> <i32 0, i32 9, i32 10, i32 11, i32 4, i32 5, i32 6, i32 15>
  ret <8 x float> %res
}

define <4 x double> @test_mm256_blendv_pd(<4 x double> %a0, <4 x double> %a1, <4 x double> %a2) {
; X32-LABEL: test_mm256_blendv_pd:
; X32:       # BB#0:
; X32-NEXT:    vblendvpd %ymm2, %ymm1, %ymm0, %ymm0
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_blendv_pd:
; X64:       # BB#0:
; X64-NEXT:    vblendvpd %ymm2, %ymm1, %ymm0, %ymm0
; X64-NEXT:    retq
  %res = call <4 x double> @llvm.x86.avx.blendv.pd.256(<4 x double> %a0, <4 x double> %a1, <4 x double> %a2) ; <<4 x double>> [#uses=1]
  ret <4 x double> %res
}
declare <4 x double> @llvm.x86.avx.blendv.pd.256(<4 x double>, <4 x double>, <4 x double>) nounwind readnone

define <8 x float> @test_mm256_blendv_ps(<8 x float> %a0, <8 x float> %a1, <8 x float> %a2) {
; X32-LABEL: test_mm256_blendv_ps:
; X32:       # BB#0:
; X32-NEXT:    vblendvps %ymm2, %ymm1, %ymm0, %ymm0
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_blendv_ps:
; X64:       # BB#0:
; X64-NEXT:    vblendvps %ymm2, %ymm1, %ymm0, %ymm0
; X64-NEXT:    retq
  %res = call <8 x float> @llvm.x86.avx.blendv.ps.256(<8 x float> %a0, <8 x float> %a1, <8 x float> %a2) ; <<8 x float>> [#uses=1]
  ret <8 x float> %res
}
declare <8 x float> @llvm.x86.avx.blendv.ps.256(<8 x float>, <8 x float>, <8 x float>) nounwind readnone

define <4 x double> @test_mm256_broadcast_pd(i8* %a0) {
; X32-LABEL: test_mm256_broadcast_pd:
; X32:       # BB#0:
; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax
; X32-NEXT:    vbroadcastf128 (%eax), %ymm0
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_broadcast_pd:
; X64:       # BB#0:
; X64-NEXT:    vbroadcastf128 (%rdi), %ymm0
; X64-NEXT:    retq
  %res = call <4 x double> @llvm.x86.avx.vbroadcastf128.pd.256(i8* %a0) ; <<4 x double>> [#uses=1]
  ret <4 x double> %res
}
declare <4 x double> @llvm.x86.avx.vbroadcastf128.pd.256(i8*) nounwind readonly

define <8 x float> @test_mm256_broadcast_ps(i8* %a0) {
; X32-LABEL: test_mm256_broadcast_ps:
; X32:       # BB#0:
; X32-NEXT:    movl {{[0-9]+}}(%esp), %eax
; X32-NEXT:    vbroadcastf128 (%eax), %ymm0
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_broadcast_ps:
; X64:       # BB#0:
; X64-NEXT:    vbroadcastf128 (%rdi), %ymm0
; X64-NEXT:    retq
  %res = call <8 x float> @llvm.x86.avx.vbroadcastf128.ps.256(i8* %a0) ; <<8 x float>> [#uses=1]
  ret <8 x float> %res
}
declare <8 x float> @llvm.x86.avx.vbroadcastf128.ps.256(i8*) nounwind readonly

; TODO test_mm256_broadcast_sd
; TODO test_mm_broadcast_ss
; TODO test_mm256_broadcast_sd
; TODO test_mm256_castpd_ps
; TODO test_mm256_castpd_si256
; TODO test_mm256_castpd128_pd256
; TODO test_mm256_castpd256_pd128
; TODO test_mm256_castps_pd
; TODO test_mm256_castps_si256
; TODO test_mm256_castps128_ps256
; TODO test_mm256_castps256_ps128
; TODO test_mm256_castsi128_si256
; TODO test_mm256_castsi256_pd
; TODO test_mm256_castsi256_ps
; TODO test_mm256_castsi256_si128
; TODO test_mm256_ceil_pd
; TODO test_mm256_ceil_ps
; TODO test_mm_cmp_pd
; TODO test_mm256_cmp_pd
; TODO test _mm_cmp_ps
; TODO test _mm256_cmp_ps
; TODO test_mm_cmp_sd
; TODO test_mm_cmp_ss
; TODO test_mm256_cvtepi32_pd
; TODO test_mm256_cvtepi32_ps
; TODO test_mm256_cvtpd_epi32
; TODO test_mm256_cvtpd_ps
; TODO test_mm256_cvtps_epi32
; TODO test_mm256_cvtps_pd
; TODO test_mm256_cvttpd_epi32
; TODO test_mm256_cvttps_epi32

define <4 x double> @test_mm256_div_pd(<4 x double> %a0, <4 x double> %a1) {
; X32-LABEL: test_mm256_div_pd:
; X32:       # BB#0:
; X32-NEXT:    vdivpd %ymm1, %ymm0, %ymm0
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_div_pd:
; X64:       # BB#0:
; X64-NEXT:    vdivpd %ymm1, %ymm0, %ymm0
; X64-NEXT:    retq
  %res = fdiv <4 x double> %a0, %a1
  ret <4 x double> %res
}

define <8 x float> @test_mm256_div_ps(<8 x float> %a0, <8 x float> %a1) {
; X32-LABEL: test_mm256_div_ps:
; X32:       # BB#0:
; X32-NEXT:    vdivps %ymm1, %ymm0, %ymm0
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_div_ps:
; X64:       # BB#0:
; X64-NEXT:    vdivps %ymm1, %ymm0, %ymm0
; X64-NEXT:    retq
  %res = fdiv <8 x float> %a0, %a1
  ret <8 x float> %res
}

; TODO test_mm256_dp_ps
; TODO test_mm256_extract_epi16
; TODO test_mm256_extract_epi32
; TODO test_mm256_extract_epi64
; TODO test_mm256_extract_epi8
; TODO test_mm256_extractf128_pd
; TODO test_mm256_extractf128_ps
; TODO test_mm256_extractf128_si256
; TODO test_mm256_floor_pd
; TODO test_mm256_floor_ps
; TODO test_mm256_hadd_pd
; TODO test_mm256_hadd_ps
; TODO test_mm256_hsub_pd
; TODO test_mm256_hsub_ps
; TODO test_mm256_insert_epi16
; TODO test_mm256_insert_epi32
; TODO test_mm256_insert_epi64
; TODO test_mm256_insert_epi8
; TODO test_mm256_insertf128_pd
; TODO test_mm256_insertf128_ps
; TODO test_mm256_insertf128_si256
; TODO test_mm256_lddqu_si256
; TODO test_mm256_load_pd
; TODO test_mm256_load_ps
; TODO test_mm256_load_si256
; TODO test_mm256_loadu_pd
; TODO test_mm256_loadu_ps
; TODO test_mm256_loadu_si256
; TODO test_mm256_loadu2_m128
; TODO test_mm256_loadu2_m128d
; TODO test_mm256_loadu2_m128i
; TODO test_mm_maskload_pd
; TODO test_mm256_maskload_pd
; TODO test_mm_maskload_ps
; TODO test_mm256_maskload_ps
; TODO test_mm_maskstore_pd
; TODO test_mm256_maskstore_pd
; TODO test_mm_maskstore_ps
; TODO test_mm256_maskstore_ps
; TODO test_mm256_max_pd
; TODO test_mm256_max_ps
; TODO test_mm256_min_pd
; TODO test_mm256_min_ps
; TODO test_mm256_movedup_pd
; TODO test_mm256_movehdup_ps
; TODO test_mm256_moveldup_ps
; TODO test_mm256_movemask_pd
; TODO test_mm256_movemask_ps

define <4 x double> @test_mm256_mul_pd(<4 x double> %a0, <4 x double> %a1) {
; X32-LABEL: test_mm256_mul_pd:
; X32:       # BB#0:
; X32-NEXT:    vmulpd %ymm1, %ymm0, %ymm0
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_mul_pd:
; X64:       # BB#0:
; X64-NEXT:    vmulpd %ymm1, %ymm0, %ymm0
; X64-NEXT:    retq
  %res = fmul <4 x double> %a0, %a1
  ret <4 x double> %res
}

define <8 x float> @test_mm256_mul_ps(<8 x float> %a0, <8 x float> %a1) {
; X32-LABEL: test_mm256_mul_ps:
; X32:       # BB#0:
; X32-NEXT:    vmulps %ymm1, %ymm0, %ymm0
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_mul_ps:
; X64:       # BB#0:
; X64-NEXT:    vmulps %ymm1, %ymm0, %ymm0
; X64-NEXT:    retq
  %res = fmul <8 x float> %a0, %a1
  ret <8 x float> %res
}

; TODO test_mm256_or_pd
; TODO test_mm256_or_ps
; TODO test_mm_permute_pd
; TODO test_mm256_permute_pd
; TODO test_mm_permute_ps
; TODO test_mm256_permute_ps

define <4 x double> @test_mm256_permute2f128_pd(<4 x double> %a0, <4 x double> %a1) {
; X32-LABEL: test_mm256_permute2f128_pd:
; X32:       # BB#0:
; X32-NEXT:    vperm2f128 {{.*#+}} ymm0 = zero,zero,ymm1[0,1]
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_permute2f128_pd:
; X64:       # BB#0:
; X64-NEXT:    vperm2f128 {{.*#+}} ymm0 = zero,zero,ymm1[0,1]
; X64-NEXT:    retq
  %res = call <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double> %a0, <4 x double> %a1, i8 44)
  ret <4 x double> %res
}
declare <4 x double> @llvm.x86.avx.vperm2f128.pd.256(<4 x double>, <4 x double>, i8) nounwind readnone

; PR26667
define <8 x float> @test_mm256_permute2f128_ps(<8 x float> %a0, <8 x float> %a1) {
; X32-LABEL: test_mm256_permute2f128_ps:
; X32:       # BB#0:
; X32-NEXT:    vmovaps %ymm1, %ymm0
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_permute2f128_ps:
; X64:       # BB#0:
; X64-NEXT:    vmovaps %ymm1, %ymm0
; X64-NEXT:    retq
  %res = call <8 x float> @llvm.x86.avx.vperm2f128.ps.256(<8 x float> %a0, <8 x float> %a1, i8 50)
  ret <8 x float> %res
}
declare <8 x float> @llvm.x86.avx.vperm2f128.ps.256(<8 x float>, <8 x float>, i8) nounwind readnone

define <4 x i64> @test_mm256_permute2f128_si256(<4 x i64> %a0, <4 x i64> %a1) {
; X32-LABEL: test_mm256_permute2f128_si256:
; X32:       # BB#0:
; X32-NEXT:    vperm2f128 {{.*#+}} ymm0 = ymm1[2,3,0,1]
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_permute2f128_si256:
; X64:       # BB#0:
; X64-NEXT:    vperm2f128 {{.*#+}} ymm0 = ymm1[2,3,0,1]
; X64-NEXT:    retq
  %1 = bitcast <4 x i64> %a0 to <8 x i32>
  %2 = bitcast <4 x i64> %a1 to <8 x i32>
  %res = call <8 x i32> @llvm.x86.avx.vperm2f128.si.256(<8 x i32> %1, <8 x i32> %2, i8 35)
  %bc = bitcast <8 x i32> %res to <4 x i64>
  ret <4 x i64> %bc
}
declare <8 x i32> @llvm.x86.avx.vperm2f128.si.256(<8 x i32>, <8 x i32>, i8) nounwind readnone

; TODO test_mm_permutevar_pd
; TODO test_mm256_permutevar_pd
; TODO test_mm_permutevar_ps
; TODO test_mm256_permutevar_ps
; TODO test_mm256_rcp_ps
; TODO test_mm256_round_pd
; TODO test_mm256_round_ps
; TODO test_mm256_rsqrt_ps
; TODO test_mm256_set_epi16
; TODO test_mm256_set_epi32
; TODO test_mm256_set_epi64x
; TODO test_mm256_set_epi8
; TODO test_mm256_set_m128
; TODO test_mm256_set_m128d
; TODO test_mm256_set_m128i
; TODO test_mm256_set_pd
; TODO test_mm256_set_ps
; TODO test_mm256_set1_epi16
; TODO test_mm256_set1_epi32
; TODO test_mm256_set1_epi64x
; TODO test_mm256_set1_epi8
; TODO test_mm256_set1_pd
; TODO test_mm256_set1_ps
; TODO test_mm256_setr_epi16
; TODO test_mm256_setr_epi32
; TODO test_mm256_setr_epi64x
; TODO test_mm256_setr_epi8
; TODO test_mm256_setr_m128
; TODO test_mm256_setr_m128d
; TODO test_mm256_setr_m128i
; TODO test_mm256_setr_pd
; TODO test_mm256_setr_ps
; TODO test_mm256_setzero_pd
; TODO test_mm256_setzero_ps
; TODO test_mm256_setzero_si256
; TODO test_mm256_shuffle_pd
; TODO test_mm256_shuffle_ps
; TODO test_mm256_sqrt_pd
; TODO test_mm256_sqrt_ps
; TODO test_mm256_store_pd
; TODO test_mm256_store_ps
; TODO test_mm256_store_si256
; TODO test_mm256_storeu_pd
; TODO test_mm256_storeu_ps
; TODO test_mm256_storeu_si256
; TODO test_mm256_storeu2_m128
; TODO test_mm256_storeu2_m128d
; TODO test_mm256_storeu2_m128i
; TODO test_mm256_stream_pd
; TODO test_mm256_stream_ps
; TODO test_mm256_stream_si256

define <4 x double> @test_mm256_sub_pd(<4 x double> %a0, <4 x double> %a1) {
; X32-LABEL: test_mm256_sub_pd:
; X32:       # BB#0:
; X32-NEXT:    vsubpd %ymm1, %ymm0, %ymm0
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_sub_pd:
; X64:       # BB#0:
; X64-NEXT:    vsubpd %ymm1, %ymm0, %ymm0
; X64-NEXT:    retq
  %res = fsub <4 x double> %a0, %a1
  ret <4 x double> %res
}

define <8 x float> @test_mm256_sub_ps(<8 x float> %a0, <8 x float> %a1) {
; X32-LABEL: test_mm256_sub_ps:
; X32:       # BB#0:
; X32-NEXT:    vsubps %ymm1, %ymm0, %ymm0
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_sub_ps:
; X64:       # BB#0:
; X64-NEXT:    vsubps %ymm1, %ymm0, %ymm0
; X64-NEXT:    retq
  %res = fsub <8 x float> %a0, %a1
  ret <8 x float> %res
}

; TODO test_mm_testc_pd
; TODO test_mm256_testc_pd
; TODO test_mm_testc_ps
; TODO test_mm256_testc_ps
; TODO test_mm256_testc_si256
; TODO test_mm_testnzc_pd
; TODO test_mm256_testnzc_pd
; TODO test_mm_testnzc_ps
; TODO test_mm256_testnzc_ps
; TODO test_mm256_testnzc_si256
; TODO test_mm_testz_pd
; TODO test_mm256_testz_pd
; TODO test_mm_testz_ps
; TODO test_mm256_testz_ps
; TODO test_mm256_testz_si256

define <2 x double> @test_mm_undefined_pd() {
; X32-LABEL: test_mm_undefined_pd:
; X32:       # BB#0:
; X32-NEXT:    retl
;
; X64-LABEL: test_mm_undefined_pd:
; X64:       # BB#0:
; X64-NEXT:    retq
  ret <2 x double> undef
}

define <4 x double> @test_mm256_undefined_pd() {
; X32-LABEL: test_mm256_undefined_pd:
; X32:       # BB#0:
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_undefined_pd:
; X64:       # BB#0:
; X64-NEXT:    retq
  ret <4 x double> undef
}

define <4 x float> @test_mm_undefined_ps() {
; X32-LABEL: test_mm_undefined_ps:
; X32:       # BB#0:
; X32-NEXT:    retl
;
; X64-LABEL: test_mm_undefined_ps:
; X64:       # BB#0:
; X64-NEXT:    retq
  ret <4 x float> undef
}

define <8 x float> @test_mm256_undefined_ps() {
; X32-LABEL: test_mm256_undefined_ps:
; X32:       # BB#0:
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_undefined_ps:
; X64:       # BB#0:
; X64-NEXT:    retq
  ret <8 x float> undef
}

define <2 x i64> @test_mm_undefined_si256() {
; X32-LABEL: test_mm_undefined_si256:
; X32:       # BB#0:
; X32-NEXT:    retl
;
; X64-LABEL: test_mm_undefined_si256:
; X64:       # BB#0:
; X64-NEXT:    retq
  ret <2 x i64> undef
}

define <4 x i64> @test_mm256_undefined_si256() {
; X32-LABEL: test_mm256_undefined_si256:
; X32:       # BB#0:
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_undefined_si256:
; X64:       # BB#0:
; X64-NEXT:    retq
  ret <4 x i64> undef
}

define <4 x double> @test_mm256_unpackhi_pd(<4 x double> %a0, <4 x double> %a1) {
; X32-LABEL: test_mm256_unpackhi_pd:
; X32:       # BB#0:
; X32-NEXT:    vunpckhpd {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[3]
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_unpackhi_pd:
; X64:       # BB#0:
; X64-NEXT:    vunpckhpd {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[3]
; X64-NEXT:    retq
  %res = shufflevector <4 x double> %a0, <4 x double> %a1, <4 x i32> <i32 1, i32 5, i32 3, i32 7>
  ret <4 x double> %res
}

define <8 x float> @test_mm256_unpackhi_ps(<8 x float> %a0, <8 x float> %a1) {
; X32-LABEL: test_mm256_unpackhi_ps:
; X32:       # BB#0:
; X32-NEXT:    vunpckhps {{.*#+}} ymm0 = ymm0[2],ymm1[2],ymm0[3],ymm1[3],ymm0[6],ymm1[6],ymm0[7],ymm1[7]
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_unpackhi_ps:
; X64:       # BB#0:
; X64-NEXT:    vunpckhps {{.*#+}} ymm0 = ymm0[2],ymm1[2],ymm0[3],ymm1[3],ymm0[6],ymm1[6],ymm0[7],ymm1[7]
; X64-NEXT:    retq
  %res = shufflevector <8 x float> %a0, <8 x float> %a1, <8 x i32> <i32 2, i32 10, i32 3, i32 11, i32 6, i32 14, i32 7, i32 15>
  ret <8 x float> %res
}

define <4 x double> @test_mm256_unpacklo_pd(<4 x double> %a0, <4 x double> %a1) {
; X32-LABEL: test_mm256_unpacklo_pd:
; X32:       # BB#0:
; X32-NEXT:    vunpcklpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[2],ymm1[2]
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_unpacklo_pd:
; X64:       # BB#0:
; X64-NEXT:    vunpcklpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[2],ymm1[2]
; X64-NEXT:    retq
  %res = shufflevector <4 x double> %a0, <4 x double> %a1, <4 x i32> <i32 0, i32 4, i32 2, i32 6>
  ret <4 x double> %res
}

define <8 x float> @test_mm256_unpacklo_ps(<8 x float> %a0, <8 x float> %a1) {
; X32-LABEL: test_mm256_unpacklo_ps:
; X32:       # BB#0:
; X32-NEXT:    vunpcklps {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[1],ymm1[1],ymm0[4],ymm1[4],ymm0[5],ymm1[5]
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_unpacklo_ps:
; X64:       # BB#0:
; X64-NEXT:    vunpcklps {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[1],ymm1[1],ymm0[4],ymm1[4],ymm0[5],ymm1[5]
; X64-NEXT:    retq
  %res = shufflevector <8 x float> %a0, <8 x float> %a1, <8 x i32> <i32 0, i32 8, i32 1, i32 9, i32 4, i32 12, i32 5, i32 13>
  ret <8 x float> %res
}

define <4 x double> @test_mm256_xor_pd(<4 x double> %a0, <4 x double> %a1) {
; X32-LABEL: test_mm256_xor_pd:
; X32:       # BB#0:
; X32-NEXT:    vxorps %ymm1, %ymm0, %ymm0
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_xor_pd:
; X64:       # BB#0:
; X64-NEXT:    vxorps %ymm1, %ymm0, %ymm0
; X64-NEXT:    retq
  %1 = bitcast <4 x double> %a0 to <4 x i64>
  %2 = bitcast <4 x double> %a1 to <4 x i64>
  %res = xor <4 x i64> %1, %2
  %bc = bitcast <4 x i64> %res to <4 x double>
  ret <4 x double> %bc
}

define <8 x float> @test_mm256_xor_ps(<8 x float> %a0, <8 x float> %a1) {
; X32-LABEL: test_mm256_xor_ps:
; X32:       # BB#0:
; X32-NEXT:    vxorps %ymm1, %ymm0, %ymm0
; X32-NEXT:    retl
;
; X64-LABEL: test_mm256_xor_ps:
; X64:       # BB#0:
; X64-NEXT:    vxorps %ymm1, %ymm0, %ymm0
; X64-NEXT:    retq
  %1 = bitcast <8 x float> %a0 to <8 x i32>
  %2 = bitcast <8 x float> %a1 to <8 x i32>
  %res = xor <8 x i32> %1, %2
  %bc = bitcast <8 x i32> %res to <8 x float>
  ret <8 x float> %bc
}

; TODO test_mm256_zeroall
; TODO test_mm256_zeroupper
OpenPOWER on IntegriCloud