1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-- -mattr=sse4.1 < %s | FileCheck %s -check-prefix=SSE4
3 ; RUN: llc -mtriple=x86_64-- -mattr=avx < %s | FileCheck %s -check-prefix=AVX1
4 ; RUN: llc -mtriple=x86_64-- -mattr=avx2 < %s | FileCheck %s -check-prefix=AVX2
6 define <16 x i16> @split16(<16 x i16> %a, <16 x i16> %b, <16 x i8> %__mask) {
9 ; SSE4-NEXT: pminuw %xmm2, %xmm0
10 ; SSE4-NEXT: pminuw %xmm3, %xmm1
13 ; AVX1-LABEL: split16:
15 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
16 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
17 ; AVX1-NEXT: vpminuw %xmm2, %xmm3, %xmm2
18 ; AVX1-NEXT: vpminuw %xmm1, %xmm0, %xmm0
19 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
22 ; AVX2-LABEL: split16:
24 ; AVX2-NEXT: vpminuw %ymm1, %ymm0, %ymm0
26 %1 = icmp ult <16 x i16> %a, %b
27 %2 = select <16 x i1> %1, <16 x i16> %a, <16 x i16> %b
31 define <32 x i16> @split32(<32 x i16> %a, <32 x i16> %b, <32 x i8> %__mask) {
32 ; SSE4-LABEL: split32:
34 ; SSE4-NEXT: pminuw %xmm4, %xmm0
35 ; SSE4-NEXT: pminuw %xmm5, %xmm1
36 ; SSE4-NEXT: pminuw %xmm6, %xmm2
37 ; SSE4-NEXT: pminuw %xmm7, %xmm3
40 ; AVX1-LABEL: split32:
42 ; AVX1-NEXT: vextractf128 $1, %ymm2, %xmm4
43 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm5
44 ; AVX1-NEXT: vpminuw %xmm4, %xmm5, %xmm4
45 ; AVX1-NEXT: vpminuw %xmm2, %xmm0, %xmm0
46 ; AVX1-NEXT: vinsertf128 $1, %xmm4, %ymm0, %ymm0
47 ; AVX1-NEXT: vextractf128 $1, %ymm3, %xmm2
48 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm4
49 ; AVX1-NEXT: vpminuw %xmm2, %xmm4, %xmm2
50 ; AVX1-NEXT: vpminuw %xmm3, %xmm1, %xmm1
51 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm1, %ymm1
54 ; AVX2-LABEL: split32:
56 ; AVX2-NEXT: vpminuw %ymm2, %ymm0, %ymm0
57 ; AVX2-NEXT: vpminuw %ymm3, %ymm1, %ymm1
59 %1 = icmp ult <32 x i16> %a, %b
60 %2 = select <32 x i1> %1, <32 x i16> %a, <32 x i16> %b
65 define i128 @split128(<2 x i128> %a, <2 x i128> %b) {
66 ; SSE4-LABEL: split128:
68 ; SSE4-NEXT: movq %rdx, %rax
69 ; SSE4-NEXT: addq %r8, %rdi
70 ; SSE4-NEXT: adcq %r9, %rsi
71 ; SSE4-NEXT: addq {{[0-9]+}}(%rsp), %rax
72 ; SSE4-NEXT: adcq {{[0-9]+}}(%rsp), %rcx
73 ; SSE4-NEXT: addq %rdi, %rax
74 ; SSE4-NEXT: adcq %rsi, %rcx
75 ; SSE4-NEXT: movq %rcx, %rdx
78 ; AVX1-LABEL: split128:
80 ; AVX1-NEXT: movq %rdx, %rax
81 ; AVX1-NEXT: addq %r8, %rdi
82 ; AVX1-NEXT: adcq %r9, %rsi
83 ; AVX1-NEXT: addq {{[0-9]+}}(%rsp), %rax
84 ; AVX1-NEXT: adcq {{[0-9]+}}(%rsp), %rcx
85 ; AVX1-NEXT: addq %rdi, %rax
86 ; AVX1-NEXT: adcq %rsi, %rcx
87 ; AVX1-NEXT: movq %rcx, %rdx
90 ; AVX2-LABEL: split128:
92 ; AVX2-NEXT: movq %rdx, %rax
93 ; AVX2-NEXT: addq %r8, %rdi
94 ; AVX2-NEXT: adcq %r9, %rsi
95 ; AVX2-NEXT: addq {{[0-9]+}}(%rsp), %rax
96 ; AVX2-NEXT: adcq {{[0-9]+}}(%rsp), %rcx
97 ; AVX2-NEXT: addq %rdi, %rax
98 ; AVX2-NEXT: adcq %rsi, %rcx
99 ; AVX2-NEXT: movq %rcx, %rdx
101 %add = add nsw <2 x i128> %a, %b
102 %rdx.shuf = shufflevector <2 x i128> %add, <2 x i128> undef, <2 x i32> <i32 undef, i32 0>
103 %bin.rdx = add <2 x i128> %add, %rdx.shuf
104 %e = extractelement <2 x i128> %bin.rdx, i32 1