1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefix=SSE2
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=AVX,AVX2
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f | FileCheck %s --check-prefixes=AVX,AVX512,AVX512F
5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512bw | FileCheck %s --check-prefixes=AVX,AVX512,AVX512BW
7 define <4 x i32> @test1(<8 x i32> %v) {
14 ; AVX-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
15 ; AVX-NEXT: vzeroupper
17 %x = sext <8 x i32> %v to <8 x i64>
18 %s = shufflevector <8 x i64> %x, <8 x i64> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
19 %t = trunc <4 x i64> %s to <4 x i32>
23 define <4 x i32> @test2(<8 x i32> %v) {
26 ; SSE2-NEXT: movaps %xmm1, %xmm0
31 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm0
32 ; AVX-NEXT: vzeroupper
34 %x = sext <8 x i32> %v to <8 x i64>
35 %s = shufflevector <8 x i64> %x, <8 x i64> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
36 %t = trunc <4 x i64> %s to <4 x i32>
40 define <2 x i32> @test3(<8 x i32> %v) {
43 ; SSE2-NEXT: movaps %xmm1, %xmm0
48 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm0
49 ; AVX-NEXT: vzeroupper
51 %x = sext <8 x i32> %v to <8 x i64>
52 %s = shufflevector <8 x i64> %x, <8 x i64> undef, <2 x i32> <i32 4, i32 5>
53 %t = trunc <2 x i64> %s to <2 x i32>
57 define <2 x i32> @test4(<8 x i32> %v) {
64 ; AVX-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
65 ; AVX-NEXT: vzeroupper
67 %x = sext <8 x i32> %v to <8 x i64>
68 %s = shufflevector <8 x i64> %x, <8 x i64> undef, <2 x i32> <i32 0, i32 1>
69 %t = trunc <2 x i64> %s to <2 x i32>
73 define <2 x i32> @test5(<8 x i32> %v) {
76 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[3,3,2,2]
77 ; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
82 ; AVX2-NEXT: vpmovzxdq {{.*#+}} ymm1 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero
83 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm0
84 ; AVX2-NEXT: vpmovzxdq {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero
85 ; AVX2-NEXT: vpblendd {{.*#+}} ymm0 = ymm0[0,1,2,3,4,5],ymm1[6,7]
86 ; AVX2-NEXT: vpbroadcastq {{.*#+}} ymm1 = [6,6,6,6]
87 ; AVX2-NEXT: vpermd %ymm0, %ymm1, %ymm0
88 ; AVX2-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
89 ; AVX2-NEXT: vzeroupper
92 ; AVX512-LABEL: test5:
94 ; AVX512-NEXT: vpmovsxdq %ymm0, %zmm0
95 ; AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
96 ; AVX512-NEXT: vpextrq $1, %xmm1, %rax
97 ; AVX512-NEXT: vextracti32x4 $2, %zmm0, %xmm0
98 ; AVX512-NEXT: vmovq %xmm0, %rcx
99 ; AVX512-NEXT: vmovd %eax, %xmm0
100 ; AVX512-NEXT: vpinsrd $1, %ecx, %xmm0, %xmm0
101 ; AVX512-NEXT: vzeroupper
103 %x = sext <8 x i32> %v to <8 x i64>
104 %s = shufflevector <8 x i64> %x, <8 x i64> undef, <2 x i32> <i32 3, i32 4>
105 %t = trunc <2 x i64> %s to <2 x i32>
109 define <4 x i32> @test6(<8 x i32> %v) {
116 ; AVX-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
117 ; AVX-NEXT: vzeroupper
119 %x = zext <8 x i32> %v to <8 x i64>
120 %s = shufflevector <8 x i64> %x, <8 x i64> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
121 %t = trunc <4 x i64> %s to <4 x i32>
125 define <4 x i32> @test7(<8 x i32> %v) {
128 ; SSE2-NEXT: movaps %xmm1, %xmm0
133 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm0
134 ; AVX-NEXT: vzeroupper
136 %x = zext <8 x i32> %v to <8 x i64>
137 %s = shufflevector <8 x i64> %x, <8 x i64> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
138 %t = trunc <4 x i64> %s to <4 x i32>
142 define <2 x i32> @test8(<8 x i32> %v) {
145 ; SSE2-NEXT: movaps %xmm1, %xmm0
150 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm0
151 ; AVX-NEXT: vzeroupper
153 %x = zext <8 x i32> %v to <8 x i64>
154 %s = shufflevector <8 x i64> %x, <8 x i64> undef, <2 x i32> <i32 4, i32 5>
155 %t = trunc <2 x i64> %s to <2 x i32>
159 define <2 x i32> @test9(<8 x i32> %v) {
166 ; AVX-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
167 ; AVX-NEXT: vzeroupper
169 %x = zext <8 x i32> %v to <8 x i64>
170 %s = shufflevector <8 x i64> %x, <8 x i64> undef, <2 x i32> <i32 0, i32 1>
171 %t = trunc <2 x i64> %s to <2 x i32>
175 define <2 x i32> @test10(<8 x i32> %v) {
176 ; SSE2-LABEL: test10:
178 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[3,3,2,2]
179 ; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
182 ; AVX2-LABEL: test10:
184 ; AVX2-NEXT: vpmovzxdq {{.*#+}} ymm1 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero
185 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm0
186 ; AVX2-NEXT: vpmovzxdq {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero
187 ; AVX2-NEXT: vpblendd {{.*#+}} ymm0 = ymm0[0,1,2,3,4,5],ymm1[6,7]
188 ; AVX2-NEXT: vpbroadcastq {{.*#+}} ymm1 = [6,6,6,6]
189 ; AVX2-NEXT: vpermd %ymm0, %ymm1, %ymm0
190 ; AVX2-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
191 ; AVX2-NEXT: vzeroupper
194 ; AVX512-LABEL: test10:
196 ; AVX512-NEXT: vpmovzxdq {{.*#+}} zmm0 = ymm0[0],zero,ymm0[1],zero,ymm0[2],zero,ymm0[3],zero,ymm0[4],zero,ymm0[5],zero,ymm0[6],zero,ymm0[7],zero
197 ; AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
198 ; AVX512-NEXT: vpextrq $1, %xmm1, %rax
199 ; AVX512-NEXT: vextracti32x4 $2, %zmm0, %xmm0
200 ; AVX512-NEXT: vmovq %xmm0, %rcx
201 ; AVX512-NEXT: vmovd %eax, %xmm0
202 ; AVX512-NEXT: vpinsrd $1, %ecx, %xmm0, %xmm0
203 ; AVX512-NEXT: vzeroupper
205 %x = zext <8 x i32> %v to <8 x i64>
206 %s = shufflevector <8 x i64> %x, <8 x i64> undef, <2 x i32> <i32 3, i32 4>
207 %t = trunc <2 x i64> %s to <2 x i32>