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
5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512bw | FileCheck %s --check-prefixes=AVX,AVX512
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,3,3]
77 ; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
82 ; AVX2-NEXT: vmovaps {{.*#+}} xmm1 = [3,4,4,4]
83 ; AVX2-NEXT: vpermps %ymm0, %ymm1, %ymm0
84 ; AVX2-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
85 ; AVX2-NEXT: vzeroupper
88 ; AVX512-LABEL: test5:
90 ; AVX512-NEXT: vpmovsxdq %ymm0, %zmm0
91 ; AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
92 ; AVX512-NEXT: vpextrq $1, %xmm1, %rax
93 ; AVX512-NEXT: vextracti32x4 $2, %zmm0, %xmm0
94 ; AVX512-NEXT: vmovq %xmm0, %rcx
95 ; AVX512-NEXT: vmovd %eax, %xmm0
96 ; AVX512-NEXT: vpinsrd $1, %ecx, %xmm0, %xmm0
97 ; AVX512-NEXT: vzeroupper
99 %x = sext <8 x i32> %v to <8 x i64>
100 %s = shufflevector <8 x i64> %x, <8 x i64> undef, <2 x i32> <i32 3, i32 4>
101 %t = trunc <2 x i64> %s to <2 x i32>
105 define <4 x i32> @test6(<8 x i32> %v) {
112 ; AVX-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
113 ; AVX-NEXT: vzeroupper
115 %x = zext <8 x i32> %v to <8 x i64>
116 %s = shufflevector <8 x i64> %x, <8 x i64> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
117 %t = trunc <4 x i64> %s to <4 x i32>
121 define <4 x i32> @test7(<8 x i32> %v) {
124 ; SSE2-NEXT: movaps %xmm1, %xmm0
129 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm0
130 ; AVX-NEXT: vzeroupper
132 %x = zext <8 x i32> %v to <8 x i64>
133 %s = shufflevector <8 x i64> %x, <8 x i64> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
134 %t = trunc <4 x i64> %s to <4 x i32>
138 define <2 x i32> @test8(<8 x i32> %v) {
141 ; SSE2-NEXT: movaps %xmm1, %xmm0
146 ; AVX-NEXT: vextractf128 $1, %ymm0, %xmm0
147 ; AVX-NEXT: vzeroupper
149 %x = zext <8 x i32> %v to <8 x i64>
150 %s = shufflevector <8 x i64> %x, <8 x i64> undef, <2 x i32> <i32 4, i32 5>
151 %t = trunc <2 x i64> %s to <2 x i32>
155 define <2 x i32> @test9(<8 x i32> %v) {
162 ; AVX-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
163 ; AVX-NEXT: vzeroupper
165 %x = zext <8 x i32> %v to <8 x i64>
166 %s = shufflevector <8 x i64> %x, <8 x i64> undef, <2 x i32> <i32 0, i32 1>
167 %t = trunc <2 x i64> %s to <2 x i32>
171 define <2 x i32> @test10(<8 x i32> %v) {
172 ; SSE2-LABEL: test10:
174 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[3,3,3,3]
175 ; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
178 ; AVX2-LABEL: test10:
180 ; AVX2-NEXT: vmovaps {{.*#+}} xmm1 = [3,4,4,4]
181 ; AVX2-NEXT: vpermps %ymm0, %ymm1, %ymm0
182 ; AVX2-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
183 ; AVX2-NEXT: vzeroupper
186 ; AVX512-LABEL: test10:
188 ; 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
189 ; AVX512-NEXT: vextracti128 $1, %ymm0, %xmm1
190 ; AVX512-NEXT: vpextrq $1, %xmm1, %rax
191 ; AVX512-NEXT: vextracti32x4 $2, %zmm0, %xmm0
192 ; AVX512-NEXT: vmovq %xmm0, %rcx
193 ; AVX512-NEXT: vmovd %eax, %xmm0
194 ; AVX512-NEXT: vpinsrd $1, %ecx, %xmm0, %xmm0
195 ; AVX512-NEXT: vzeroupper
197 %x = zext <8 x i32> %v to <8 x i64>
198 %s = shufflevector <8 x i64> %x, <8 x i64> undef, <2 x i32> <i32 3, i32 4>
199 %t = trunc <2 x i64> %s to <2 x i32>