Skip to content

Commit be9bc54

Browse files
committed
[X86] vselect.ll - add vXi8 select-by-constant tests with repeated/broadcastable shuffle mask
1 parent 22e3bf4 commit be9bc54

File tree

1 file changed

+75
-2
lines changed

1 file changed

+75
-2
lines changed

llvm/test/CodeGen/X86/vselect.ll

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
22
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefixes=SSE,SSE2
33
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.1 | FileCheck %s --check-prefixes=SSE,SSE41
4-
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefix=AVX
5-
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefix=AVX
4+
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefixes=AVX,AVX1
5+
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=AVX,AVX2
66

77
; Verify that we don't emit packed vector shifts instructions if the
88
; condition used by the vector select is a vector of constants.
@@ -425,6 +425,79 @@ define <2 x i64> @test25(<2 x i64> %a, <2 x i64> %b) {
425425
ret <2 x i64> %1
426426
}
427427

428+
define <16 x i8> @test26(<16 x i8> %a, <16 x i8> %b) {
429+
; SSE2-LABEL: test26:
430+
; SSE2: # %bb.0:
431+
; SSE2-NEXT: movaps {{.*#+}} xmm2 = [255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0]
432+
; SSE2-NEXT: andps %xmm2, %xmm1
433+
; SSE2-NEXT: andnps %xmm0, %xmm2
434+
; SSE2-NEXT: orps %xmm1, %xmm2
435+
; SSE2-NEXT: movaps %xmm2, %xmm0
436+
; SSE2-NEXT: retq
437+
;
438+
; SSE41-LABEL: test26:
439+
; SSE41: # %bb.0:
440+
; SSE41-NEXT: movdqa %xmm0, %xmm2
441+
; SSE41-NEXT: movaps {{.*#+}} xmm0 = [255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0]
442+
; SSE41-NEXT: pblendvb %xmm0, %xmm1, %xmm2
443+
; SSE41-NEXT: movdqa %xmm2, %xmm0
444+
; SSE41-NEXT: retq
445+
;
446+
; AVX1-LABEL: test26:
447+
; AVX1: # %bb.0:
448+
; AVX1-NEXT: vbroadcastss {{.*#+}} xmm2 = [255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0]
449+
; AVX1-NEXT: vpblendvb %xmm2, %xmm1, %xmm0, %xmm0
450+
; AVX1-NEXT: retq
451+
;
452+
; AVX2-LABEL: test26:
453+
; AVX2: # %bb.0:
454+
; AVX2-NEXT: vpbroadcastw {{.*#+}} xmm2 = [255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0]
455+
; AVX2-NEXT: vpblendvb %xmm2, %xmm1, %xmm0, %xmm0
456+
; AVX2-NEXT: retq
457+
%1 = select <16 x i1> <i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true, i1 false, i1 true>, <16 x i8> %a, <16 x i8> %b
458+
ret <16 x i8> %1
459+
}
460+
461+
define <32 x i8> @test27(<32 x i8> %a, <32 x i8> %b) {
462+
; SSE2-LABEL: test27:
463+
; SSE2: # %bb.0:
464+
; SSE2-NEXT: movaps {{.*#+}} xmm4 = [255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255]
465+
; SSE2-NEXT: movaps %xmm4, %xmm5
466+
; SSE2-NEXT: andnps %xmm2, %xmm5
467+
; SSE2-NEXT: andps %xmm4, %xmm0
468+
; SSE2-NEXT: orps %xmm5, %xmm0
469+
; SSE2-NEXT: andps %xmm4, %xmm1
470+
; SSE2-NEXT: andnps %xmm3, %xmm4
471+
; SSE2-NEXT: orps %xmm4, %xmm1
472+
; SSE2-NEXT: retq
473+
;
474+
; SSE41-LABEL: test27:
475+
; SSE41: # %bb.0:
476+
; SSE41-NEXT: movdqa %xmm0, %xmm4
477+
; SSE41-NEXT: movaps {{.*#+}} xmm0 = [255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255]
478+
; SSE41-NEXT: pblendvb %xmm0, %xmm4, %xmm2
479+
; SSE41-NEXT: pblendvb %xmm0, %xmm1, %xmm3
480+
; SSE41-NEXT: movdqa %xmm2, %xmm0
481+
; SSE41-NEXT: movdqa %xmm3, %xmm1
482+
; SSE41-NEXT: retq
483+
;
484+
; AVX1-LABEL: test27:
485+
; AVX1: # %bb.0:
486+
; AVX1-NEXT: vbroadcastss {{.*#+}} ymm2 = [255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255]
487+
; AVX1-NEXT: vandnps %ymm1, %ymm2, %ymm1
488+
; AVX1-NEXT: vandps %ymm2, %ymm0, %ymm0
489+
; AVX1-NEXT: vorps %ymm1, %ymm0, %ymm0
490+
; AVX1-NEXT: retq
491+
;
492+
; AVX2-LABEL: test27:
493+
; AVX2: # %bb.0:
494+
; AVX2-NEXT: vpbroadcastd {{.*#+}} ymm2 = [255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,255]
495+
; AVX2-NEXT: vpblendvb %ymm2, %ymm0, %ymm1, %ymm0
496+
; AVX2-NEXT: retq
497+
%1 = select <32 x i1> <i1 true, i1 false, i1 false, i1 true, i1 true, i1 false, i1 false, i1 true, i1 true, i1 false, i1 false, i1 true, i1 true, i1 false, i1 false, i1 true, i1 true, i1 false, i1 false, i1 true, i1 true, i1 false, i1 false, i1 true, i1 true, i1 false, i1 false, i1 true, i1 true, i1 false, i1 false, i1 true>, <32 x i8> %a, <32 x i8> %b
498+
ret <32 x i8> %1
499+
}
500+
428501
define <4 x float> @select_of_shuffles_0(<2 x float> %a0, <2 x float> %b0, <2 x float> %a1, <2 x float> %b1) {
429502
; SSE-LABEL: select_of_shuffles_0:
430503
; SSE: # %bb.0:

0 commit comments

Comments
 (0)