[x86] Fully generalize the zext lowering in the new vector shuffle
[oota-llvm.git] / test / CodeGen / X86 / vector-shuffle-128-v4.ll
1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -x86-experimental-vector-shuffle-lowering | FileCheck %s --check-prefix=ALL --check-prefix=SSE2
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mattr=+sse3 -x86-experimental-vector-shuffle-lowering | FileCheck %s --check-prefix=ALL --check-prefix=SSE3
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mattr=+ssse3 -x86-experimental-vector-shuffle-lowering | FileCheck %s --check-prefix=ALL --check-prefix=SSSE3
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mattr=+sse4.1 -x86-experimental-vector-shuffle-lowering | FileCheck %s --check-prefix=ALL --check-prefix=SSE41
5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mattr=+avx -x86-experimental-vector-shuffle-lowering | FileCheck %s --check-prefix=ALL --check-prefix=AVX1
6
7 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
8 target triple = "x86_64-unknown-unknown"
9
10 define <4 x i32> @shuffle_v4i32_0001(<4 x i32> %a, <4 x i32> %b) {
11 ; ALL-LABEL: @shuffle_v4i32_0001
12 ; ALL:         pshufd {{.*}} # xmm0 = xmm0[0,0,0,1]
13 ; ALL-NEXT:    retq
14   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 0, i32 0, i32 1>
15   ret <4 x i32> %shuffle
16 }
17 define <4 x i32> @shuffle_v4i32_0020(<4 x i32> %a, <4 x i32> %b) {
18 ; ALL-LABEL: @shuffle_v4i32_0020
19 ; ALL:         pshufd {{.*}} # xmm0 = xmm0[0,0,2,0]
20 ; ALL-NEXT:    retq
21   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 0, i32 2, i32 0>
22   ret <4 x i32> %shuffle
23 }
24 define <4 x i32> @shuffle_v4i32_0112(<4 x i32> %a, <4 x i32> %b) {
25 ; ALL-LABEL: @shuffle_v4i32_0112
26 ; ALL:         pshufd {{.*}} # xmm0 = xmm0[0,1,1,2]
27 ; ALL-NEXT:    retq
28   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 1, i32 2>
29   ret <4 x i32> %shuffle
30 }
31 define <4 x i32> @shuffle_v4i32_0300(<4 x i32> %a, <4 x i32> %b) {
32 ; ALL-LABEL: @shuffle_v4i32_0300
33 ; ALL:         pshufd {{.*}} # xmm0 = xmm0[0,3,0,0]
34 ; ALL-NEXT:    retq
35   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 3, i32 0, i32 0>
36   ret <4 x i32> %shuffle
37 }
38 define <4 x i32> @shuffle_v4i32_1000(<4 x i32> %a, <4 x i32> %b) {
39 ; ALL-LABEL: @shuffle_v4i32_1000
40 ; ALL:         pshufd {{.*}} # xmm0 = xmm0[1,0,0,0]
41 ; ALL-NEXT:    retq
42   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 1, i32 0, i32 0, i32 0>
43   ret <4 x i32> %shuffle
44 }
45 define <4 x i32> @shuffle_v4i32_2200(<4 x i32> %a, <4 x i32> %b) {
46 ; ALL-LABEL: @shuffle_v4i32_2200
47 ; ALL:         pshufd {{.*}} # xmm0 = xmm0[2,2,0,0]
48 ; ALL-NEXT:    retq
49   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 2, i32 2, i32 0, i32 0>
50   ret <4 x i32> %shuffle
51 }
52 define <4 x i32> @shuffle_v4i32_3330(<4 x i32> %a, <4 x i32> %b) {
53 ; ALL-LABEL: @shuffle_v4i32_3330
54 ; ALL:         pshufd {{.*}} # xmm0 = xmm0[3,3,3,0]
55 ; ALL-NEXT:    retq
56   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 3, i32 3, i32 3, i32 0>
57   ret <4 x i32> %shuffle
58 }
59 define <4 x i32> @shuffle_v4i32_3210(<4 x i32> %a, <4 x i32> %b) {
60 ; ALL-LABEL: @shuffle_v4i32_3210
61 ; ALL:         pshufd {{.*}} # xmm0 = xmm0[3,2,1,0]
62 ; ALL-NEXT:    retq
63   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
64   ret <4 x i32> %shuffle
65 }
66
67 define <4 x i32> @shuffle_v4i32_2121(<4 x i32> %a, <4 x i32> %b) {
68 ; ALL-LABEL: @shuffle_v4i32_2121
69 ; ALL:         pshufd {{.*}} # xmm0 = xmm0[2,1,2,1]
70 ; ALL-NEXT:    retq
71   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 2, i32 1, i32 2, i32 1>
72   ret <4 x i32> %shuffle
73 }
74
75 define <4 x float> @shuffle_v4f32_0001(<4 x float> %a, <4 x float> %b) {
76 ; ALL-LABEL: @shuffle_v4f32_0001
77 ; ALL:         shufps {{.*}} # xmm0 = xmm0[0,0,0,1]
78 ; ALL-NEXT:    retq
79   %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 0, i32 0, i32 1>
80   ret <4 x float> %shuffle
81 }
82 define <4 x float> @shuffle_v4f32_0020(<4 x float> %a, <4 x float> %b) {
83 ; ALL-LABEL: @shuffle_v4f32_0020
84 ; ALL:         shufps {{.*}} # xmm0 = xmm0[0,0,2,0]
85 ; ALL-NEXT:    retq
86   %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 0, i32 2, i32 0>
87   ret <4 x float> %shuffle
88 }
89 define <4 x float> @shuffle_v4f32_0300(<4 x float> %a, <4 x float> %b) {
90 ; ALL-LABEL: @shuffle_v4f32_0300
91 ; ALL:         shufps {{.*}} # xmm0 = xmm0[0,3,0,0]
92 ; ALL-NEXT:    retq
93   %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 3, i32 0, i32 0>
94   ret <4 x float> %shuffle
95 }
96 define <4 x float> @shuffle_v4f32_1000(<4 x float> %a, <4 x float> %b) {
97 ; ALL-LABEL: @shuffle_v4f32_1000
98 ; ALL:         shufps {{.*}} # xmm0 = xmm0[1,0,0,0]
99 ; ALL-NEXT:    retq
100   %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 1, i32 0, i32 0, i32 0>
101   ret <4 x float> %shuffle
102 }
103 define <4 x float> @shuffle_v4f32_2200(<4 x float> %a, <4 x float> %b) {
104 ; ALL-LABEL: @shuffle_v4f32_2200
105 ; ALL:         shufps {{.*}} # xmm0 = xmm0[2,2,0,0]
106 ; ALL-NEXT:    retq
107   %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 2, i32 2, i32 0, i32 0>
108   ret <4 x float> %shuffle
109 }
110 define <4 x float> @shuffle_v4f32_3330(<4 x float> %a, <4 x float> %b) {
111 ; ALL-LABEL: @shuffle_v4f32_3330
112 ; ALL:         shufps {{.*}} # xmm0 = xmm0[3,3,3,0]
113 ; ALL-NEXT:    retq
114   %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 3, i32 3, i32 3, i32 0>
115   ret <4 x float> %shuffle
116 }
117 define <4 x float> @shuffle_v4f32_3210(<4 x float> %a, <4 x float> %b) {
118 ; ALL-LABEL: @shuffle_v4f32_3210
119 ; ALL:         shufps {{.*}} # xmm0 = xmm0[3,2,1,0]
120 ; ALL-NEXT:    retq
121   %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
122   ret <4 x float> %shuffle
123 }
124 define <4 x float> @shuffle_v4f32_0011(<4 x float> %a, <4 x float> %b) {
125 ; ALL-LABEL: @shuffle_v4f32_0011
126 ; ALL:         unpcklps {{.*}} # xmm0 = xmm0[0,0,1,1]
127 ; ALL-NEXT:    retq
128   %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 0, i32 1, i32 1>
129   ret <4 x float> %shuffle
130 }
131 define <4 x float> @shuffle_v4f32_2233(<4 x float> %a, <4 x float> %b) {
132 ; ALL-LABEL: @shuffle_v4f32_2233
133 ; ALL:         unpckhps {{.*}} # xmm0 = xmm0[2,2,3,3]
134 ; ALL-NEXT:    retq
135   %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 2, i32 2, i32 3, i32 3>
136   ret <4 x float> %shuffle
137 }
138 define <4 x float> @shuffle_v4f32_0022(<4 x float> %a, <4 x float> %b) {
139 ; SSE2-LABEL: @shuffle_v4f32_0022
140 ; SSE2:         shufps {{.*}} # xmm0 = xmm0[0,0,2,2]
141 ; SSE2-NEXT:    retq
142 ;
143 ; SSE3-LABEL: @shuffle_v4f32_0022
144 ; SSE3:         movsldup {{.*}} # xmm0 = xmm0[0,0,2,2]
145 ; SSE3-NEXT:    retq
146 ;
147 ; SSSE3-LABEL: @shuffle_v4f32_0022
148 ; SSSE3:         movsldup {{.*}} # xmm0 = xmm0[0,0,2,2]
149 ; SSSE3-NEXT:    retq
150 ;
151 ; SSE41-LABEL: @shuffle_v4f32_0022
152 ; SSE41:         movsldup {{.*}} # xmm0 = xmm0[0,0,2,2]
153 ; SSE41-NEXT:    retq
154 ;
155 ; AVX1-LABEL: @shuffle_v4f32_0022
156 ; AVX1:         vmovsldup {{.*}} # xmm0 = xmm0[0,0,2,2]
157 ; AVX1-NEXT:    retq
158   %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 0, i32 2, i32 2>
159   ret <4 x float> %shuffle
160 }
161 define <4 x float> @shuffle_v4f32_1133(<4 x float> %a, <4 x float> %b) {
162 ; SSE2-LABEL: @shuffle_v4f32_1133
163 ; SSE2:         shufps {{.*}} # xmm0 = xmm0[1,1,3,3]
164 ; SSE2-NEXT:    retq
165 ;
166 ; SSE3-LABEL: @shuffle_v4f32_1133
167 ; SSE3:         movshdup {{.*}} # xmm0 = xmm0[1,1,3,3]
168 ; SSE3-NEXT:    retq
169 ;
170 ; SSSE3-LABEL: @shuffle_v4f32_1133
171 ; SSSE3:         movshdup {{.*}} # xmm0 = xmm0[1,1,3,3]
172 ; SSSE3-NEXT:    retq
173 ;
174 ; SSE41-LABEL: @shuffle_v4f32_1133
175 ; SSE41:         movshdup {{.*}} # xmm0 = xmm0[1,1,3,3]
176 ; SSE41-NEXT:    retq
177 ;
178 ; AVX1-LABEL: @shuffle_v4f32_1133
179 ; AVX1:         vmovshdup {{.*}} # xmm0 = xmm0[1,1,3,3]
180 ; AVX1-NEXT:    retq
181   %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 1, i32 1, i32 3, i32 3>
182   ret <4 x float> %shuffle
183 }
184
185 define <4 x i32> @shuffle_v4i32_0124(<4 x i32> %a, <4 x i32> %b) {
186 ; SSE2-LABEL: @shuffle_v4i32_0124
187 ; SSE2:         shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[2,0]
188 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,1],xmm1[2,0]
189 ; SSE2-NEXT:    retq
190 ;
191 ; SSE3-LABEL: @shuffle_v4i32_0124
192 ; SSE3:         shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[2,0]
193 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,1],xmm1[2,0]
194 ; SSE3-NEXT:    retq
195 ;
196 ; SSSE3-LABEL: @shuffle_v4i32_0124
197 ; SSSE3:         shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[2,0]
198 ; SSSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,1],xmm1[2,0]
199 ; SSSE3-NEXT:    retq
200 ;
201 ; SSE41-LABEL: @shuffle_v4i32_0124
202 ; SSE41:         insertps {{.*}} # xmm0 = xmm0[0,1,2],xmm1[0]
203 ; SSE41-NEXT:    retq
204 ;
205 ; AVX1-LABEL: @shuffle_v4i32_0124
206 ; AVX1:         vinsertps {{.*}} # xmm0 = xmm0[0,1,2],xmm1[0]
207 ; AVX1-NEXT:    retq
208   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 2, i32 4>
209   ret <4 x i32> %shuffle
210 }
211 define <4 x i32> @shuffle_v4i32_0142(<4 x i32> %a, <4 x i32> %b) {
212 ; ALL-LABEL: @shuffle_v4i32_0142
213 ; ALL:         shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[2,0]
214 ; ALL-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,1],xmm1[0,2]
215 ; ALL-NEXT:    retq
216   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 4, i32 2>
217   ret <4 x i32> %shuffle
218 }
219 define <4 x i32> @shuffle_v4i32_0412(<4 x i32> %a, <4 x i32> %b) {
220 ; SSE2-LABEL: @shuffle_v4i32_0412
221 ; SSE2:         shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[0,0]
222 ; SSE2-NEXT:    shufps {{.*}} # xmm1 = xmm1[2,0],xmm0[1,2]
223 ; SSE2-NEXT:    movaps %xmm1, %xmm0
224 ; SSE2-NEXT:    retq
225 ;
226 ; SSE3-LABEL: @shuffle_v4i32_0412
227 ; SSE3:         shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[0,0]
228 ; SSE3-NEXT:    shufps {{.*}} # xmm1 = xmm1[2,0],xmm0[1,2]
229 ; SSE3-NEXT:    movaps %xmm1, %xmm0
230 ; SSE3-NEXT:    retq
231 ;
232 ; SSSE3-LABEL: @shuffle_v4i32_0412
233 ; SSSE3:         shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[0,0]
234 ; SSSE3-NEXT:    shufps {{.*}} # xmm1 = xmm1[2,0],xmm0[1,2]
235 ; SSSE3-NEXT:    movaps %xmm1, %xmm0
236 ; SSSE3-NEXT:    retq
237 ;
238 ; SSE41-LABEL: @shuffle_v4i32_0412
239 ; SSE41:         shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[0,0]
240 ; SSE41-NEXT:    shufps {{.*}} # xmm1 = xmm1[2,0],xmm0[1,2]
241 ; SSE41-NEXT:    movaps %xmm1, %xmm0
242 ; SSE41-NEXT:    retq
243 ;
244 ; AVX1-LABEL: @shuffle_v4i32_0412
245 ; AVX1:         vshufps {{.*}} # xmm1 = xmm1[0,0],xmm0[0,0]
246 ; AVX1-NEXT:    vshufps {{.*}} # xmm0 = xmm1[2,0],xmm0[1,2]
247 ; AVX1-NEXT:    retq
248   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 1, i32 2>
249   ret <4 x i32> %shuffle
250 }
251 define <4 x i32> @shuffle_v4i32_4012(<4 x i32> %a, <4 x i32> %b) {
252 ; SSE2-LABEL: @shuffle_v4i32_4012
253 ; SSE2:         shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[0,0]
254 ; SSE2-NEXT:    shufps {{.*}} # xmm1 = xmm1[0,2],xmm0[1,2]
255 ; SSE2-NEXT:    movaps %xmm1, %xmm0
256 ; SSE2-NEXT:    retq
257 ;
258 ; SSE3-LABEL: @shuffle_v4i32_4012
259 ; SSE3:         shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[0,0]
260 ; SSE3-NEXT:    shufps {{.*}} # xmm1 = xmm1[0,2],xmm0[1,2]
261 ; SSE3-NEXT:    movaps %xmm1, %xmm0
262 ; SSE3-NEXT:    retq
263 ;
264 ; SSSE3-LABEL: @shuffle_v4i32_4012
265 ; SSSE3:         shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[0,0]
266 ; SSSE3-NEXT:    shufps {{.*}} # xmm1 = xmm1[0,2],xmm0[1,2]
267 ; SSSE3-NEXT:    movaps %xmm1, %xmm0
268 ; SSSE3-NEXT:    retq
269 ;
270 ; SSE41-LABEL: @shuffle_v4i32_4012
271 ; SSE41:         shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[0,0]
272 ; SSE41-NEXT:    shufps {{.*}} # xmm1 = xmm1[0,2],xmm0[1,2]
273 ; SSE41-NEXT:    movaps %xmm1, %xmm0
274 ; SSE41-NEXT:    retq
275 ;
276 ; AVX1-LABEL: @shuffle_v4i32_4012
277 ; AVX1:         vshufps {{.*}} # xmm1 = xmm1[0,0],xmm0[0,0]
278 ; AVX1-NEXT:    vshufps {{.*}} # xmm0 = xmm1[0,2],xmm0[1,2]
279 ; AVX1-NEXT:    retq
280   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 0, i32 1, i32 2>
281   ret <4 x i32> %shuffle
282 }
283 define <4 x i32> @shuffle_v4i32_0145(<4 x i32> %a, <4 x i32> %b) {
284 ; ALL-LABEL: @shuffle_v4i32_0145
285 ; ALL:         punpcklqdq {{.*}} # xmm0 = xmm0[0],xmm1[0]
286 ; ALL-NEXT:    retq
287   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
288   ret <4 x i32> %shuffle
289 }
290 define <4 x i32> @shuffle_v4i32_0451(<4 x i32> %a, <4 x i32> %b) {
291 ; ALL-LABEL: @shuffle_v4i32_0451
292 ; ALL:         shufps {{.*}} # xmm0 = xmm0[0,1],xmm1[0,1]
293 ; ALL-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,2,3,1]
294 ; ALL-NEXT:    retq
295   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 5, i32 1>
296   ret <4 x i32> %shuffle
297 }
298 define <4 x i32> @shuffle_v4i32_4501(<4 x i32> %a, <4 x i32> %b) {
299 ; SSE2-LABEL: @shuffle_v4i32_4501
300 ; SSE2:         punpcklqdq {{.*}} # xmm1 = xmm1[0],xmm0[0]
301 ; SSE2-NEXT:    movdqa %xmm1, %xmm0
302 ; SSE2-NEXT:    retq
303 ;
304 ; SSE3-LABEL: @shuffle_v4i32_4501
305 ; SSE3:         punpcklqdq {{.*}} # xmm1 = xmm1[0],xmm0[0]
306 ; SSE3-NEXT:    movdqa %xmm1, %xmm0
307 ; SSE3-NEXT:    retq
308 ;
309 ; SSSE3-LABEL: @shuffle_v4i32_4501
310 ; SSSE3:         punpcklqdq {{.*}} # xmm1 = xmm1[0],xmm0[0]
311 ; SSSE3-NEXT:    movdqa %xmm1, %xmm0
312 ; SSSE3-NEXT:    retq
313 ;
314 ; SSE41-LABEL: @shuffle_v4i32_4501
315 ; SSE41:         punpcklqdq {{.*}} # xmm1 = xmm1[0],xmm0[0]
316 ; SSE41-NEXT:    movdqa %xmm1, %xmm0
317 ; SSE41-NEXT:    retq
318 ;
319 ; AVX1-LABEL: @shuffle_v4i32_4501
320 ; AVX1:         punpcklqdq {{.*}} # xmm0 = xmm1[0],xmm0[0]
321 ; AVX1-NEXT:    retq
322   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 5, i32 0, i32 1>
323   ret <4 x i32> %shuffle
324 }
325 define <4 x i32> @shuffle_v4i32_4015(<4 x i32> %a, <4 x i32> %b) {
326 ; ALL-LABEL: @shuffle_v4i32_4015
327 ; ALL:         shufps {{.*}} # xmm0 = xmm0[0,1],xmm1[0,1]
328 ; ALL-NEXT:    shufps {{.*}} # xmm0 = xmm0[2,0,1,3]
329 ; ALL-NEXT:    retq
330   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 0, i32 1, i32 5>
331   ret <4 x i32> %shuffle
332 }
333
334 define <4 x float> @shuffle_v4f32_4zzz(<4 x float> %a) {
335 ; SSE2-LABEL: @shuffle_v4f32_4zzz
336 ; SSE2:         xorps %[[X:xmm[0-9]+]], %[[X]]
337 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,0],[[X]][1,0]
338 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,2],[[X]][2,3]
339 ; SSE2-NEXT:    retq
340 ;
341 ; SSE3-LABEL: @shuffle_v4f32_4zzz
342 ; SSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
343 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,0],[[X]][1,0]
344 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,2],[[X]][2,3]
345 ; SSE3-NEXT:    retq
346 ;
347 ; SSSE3-LABEL: @shuffle_v4f32_4zzz
348 ; SSSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
349 ; SSSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,0],[[X]][1,0]
350 ; SSSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,2],[[X]][2,3]
351 ; SSSE3-NEXT:    retq
352 ;
353 ; SSE41-LABEL: @shuffle_v4f32_4zzz
354 ; SSE41:         xorps %[[X:xmm[0-9]+]], %[[X]]
355 ; SSE41-NEXT:    blendps {{.*}} # [[X]] = xmm0[0],[[X]][1,2,3]
356 ; SSE41-NEXT:    movaps %[[X]], %xmm0
357 ; SSE41-NEXT:    retq
358 ;
359 ; AVX1-LABEL: @shuffle_v4f32_4zzz
360 ; AVX1:         vxorps %[[X:xmm[0-9]+]], %[[X]]
361 ; AVX1-NEXT:    vblendps {{.*}} # xmm0 = xmm0[0],[[X]][1,2,3]
362 ; AVX1-NEXT:    retq
363   %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 4, i32 1, i32 2, i32 3>
364   ret <4 x float> %shuffle
365 }
366
367 define <4 x float> @shuffle_v4f32_z4zz(<4 x float> %a) {
368 ; SSE2-LABEL: @shuffle_v4f32_z4zz
369 ; SSE2:         xorps %[[X:xmm[0-9]+]], %[[X]]
370 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,0],[[X]][2,0]
371 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[2,0],[[X]][3,0]
372 ; SSE2-NEXT:    retq
373 ;
374 ; SSE3-LABEL: @shuffle_v4f32_z4zz
375 ; SSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
376 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,0],[[X]][2,0]
377 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[2,0],[[X]][3,0]
378 ; SSE3-NEXT:    retq
379 ;
380 ; SSSE3-LABEL: @shuffle_v4f32_z4zz
381 ; SSSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
382 ; SSSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,0],[[X]][2,0]
383 ; SSSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[2,0],[[X]][3,0]
384 ; SSSE3-NEXT:    retq
385 ;
386 ; SSE41-LABEL: @shuffle_v4f32_z4zz
387 ; SSE41:         insertps {{.*}} # xmm0 = zero,xmm0[0],zero,zero
388 ; SSE41-NEXT:    retq
389 ;
390 ; AVX1-LABEL: @shuffle_v4f32_z4zz
391 ; AVX1:         vinsertps {{.*}} # xmm0 = zero,xmm0[0],zero,zero
392 ; AVX1-NEXT:    retq
393   %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 2, i32 4, i32 3, i32 0>
394   ret <4 x float> %shuffle
395 }
396
397 define <4 x float> @shuffle_v4f32_zz4z(<4 x float> %a) {
398 ; SSE2-LABEL: @shuffle_v4f32_zz4z
399 ; SSE2:         xorps %[[X:xmm[0-9]+]], %[[X]]
400 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,0],[[X]][0,0]
401 ; SSE2-NEXT:    shufps {{.*}} # [[X]] = [[X]][0,0],xmm0[0,2]
402 ; SSE2-NEXT:    movaps %[[X]], %xmm0
403 ; SSE2-NEXT:    retq
404 ;
405 ; SSE3-LABEL: @shuffle_v4f32_zz4z
406 ; SSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
407 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,0],[[X]][0,0]
408 ; SSE3-NEXT:    shufps {{.*}} # [[X]] = [[X]][0,0],xmm0[0,2]
409 ; SSE3-NEXT:    movaps %[[X]], %xmm0
410 ; SSE3-NEXT:    retq
411 ;
412 ; SSSE3-LABEL: @shuffle_v4f32_zz4z
413 ; SSSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
414 ; SSSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,0],[[X]][0,0]
415 ; SSSE3-NEXT:    shufps {{.*}} # [[X]] = [[X]][0,0],xmm0[0,2]
416 ; SSSE3-NEXT:    movaps %[[X]], %xmm0
417 ; SSSE3-NEXT:    retq
418 ;
419 ; SSE41-LABEL: @shuffle_v4f32_zz4z
420 ; SSE41:         insertps {{.*}} # xmm0 = zero,zero,xmm0[0],zero
421 ; SSE41-NEXT:    retq
422 ;
423 ; AVX1-LABEL: @shuffle_v4f32_zz4z
424 ; AVX1:         vinsertps {{.*}} # xmm0 = zero,zero,xmm0[0],zero
425 ; AVX1-NEXT:    retq
426   %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 0, i32 0, i32 4, i32 0>
427   ret <4 x float> %shuffle
428 }
429
430 define <4 x float> @shuffle_v4f32_zuu4(<4 x float> %a) {
431 ; SSE2-LABEL: @shuffle_v4f32_zuu4
432 ; SSE2:         xorps %[[X:xmm[0-9]+]], %[[X]]
433 ; SSE2-NEXT:    shufps {{.*}} # [[X]] = [[X]][0,1],xmm0[2,0]
434 ; SSE2-NEXT:    movaps %[[X]], %xmm0
435 ; SSE2-NEXT:    retq
436 ;
437 ; SSE3-LABEL: @shuffle_v4f32_zuu4
438 ; SSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
439 ; SSE3-NEXT:    shufps {{.*}} # [[X]] = [[X]][0,1],xmm0[2,0]
440 ; SSE3-NEXT:    movaps %[[X]], %xmm0
441 ; SSE3-NEXT:    retq
442 ;
443 ; SSSE3-LABEL: @shuffle_v4f32_zuu4
444 ; SSSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
445 ; SSSE3-NEXT:    shufps {{.*}} # [[X]] = [[X]][0,1],xmm0[2,0]
446 ; SSSE3-NEXT:    movaps %[[X]], %xmm0
447 ; SSSE3-NEXT:    retq
448 ;
449 ; SSE41-LABEL: @shuffle_v4f32_zuu4
450 ; SSE41:         insertps {{.*}} # xmm0 = zero,zero,zero,xmm0[0]
451 ; SSE41-NEXT:    retq
452 ;
453 ; AVX1-LABEL: @shuffle_v4f32_zuu4
454 ; AVX1:         vinsertps {{.*}} # xmm0 = zero,zero,zero,xmm0[0]
455 ; AVX1-NEXT:    retq
456   %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 0, i32 undef, i32 undef, i32 4>
457   ret <4 x float> %shuffle
458 }
459
460 define <4 x float> @shuffle_v4f32_zzz7(<4 x float> %a) {
461 ; SSE2-LABEL: @shuffle_v4f32_zzz7
462 ; SSE2:         xorps %[[X:xmm[0-9]+]], %[[X]]
463 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[3,0],[[X]][2,0]
464 ; SSE2-NEXT:    shufps {{.*}} # [[X]] = [[X]][0,1],xmm0[2,0]
465 ; SSE2-NEXT:    movaps %[[X]], %xmm0
466 ; SSE2-NEXT:    retq
467 ;
468 ; SSE3-LABEL: @shuffle_v4f32_zzz7
469 ; SSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
470 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[3,0],[[X]][2,0]
471 ; SSE3-NEXT:    shufps {{.*}} # [[X]] = [[X]][0,1],xmm0[2,0]
472 ; SSE3-NEXT:    movaps %[[X]], %xmm0
473 ; SSE3-NEXT:    retq
474 ;
475 ; SSSE3-LABEL: @shuffle_v4f32_zzz7
476 ; SSSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
477 ; SSSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[3,0],[[X]][2,0]
478 ; SSSE3-NEXT:    shufps {{.*}} # [[X]] = [[X]][0,1],xmm0[2,0]
479 ; SSSE3-NEXT:    movaps %[[X]], %xmm0
480 ; SSSE3-NEXT:    retq
481 ;
482 ; SSE41-LABEL: @shuffle_v4f32_zzz7
483 ; SSE41:         xorps %[[X:xmm[0-9]+]], %[[X]]
484 ; SSE41-NEXT:    blendps {{.*}} # [[X]] = [[X]][0,1,2],xmm0[3]
485 ; SSE41-NEXT:    movaps %[[X]], %xmm0
486 ; SSE41-NEXT:    retq
487 ;
488 ; AVX1-LABEL: @shuffle_v4f32_zzz7
489 ; AVX1:         vxorps %[[X:xmm[0-9]+]], %[[X]]
490 ; AVX1-NEXT:    vblendps {{.*}} # xmm0 = [[X]][0,1,2],xmm0[3]
491 ; AVX1-NEXT:    retq
492   %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
493   ret <4 x float> %shuffle
494 }
495
496 define <4 x float> @shuffle_v4f32_z6zz(<4 x float> %a) {
497 ; SSE2-LABEL: @shuffle_v4f32_z6zz
498 ; SSE2:         xorps %[[X:xmm[0-9]+]], %[[X]]
499 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[2,0],[[X]][0,0]
500 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[2,0],[[X]][2,3]
501 ; SSE2-NEXT:    retq
502 ;
503 ; SSE3-LABEL: @shuffle_v4f32_z6zz
504 ; SSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
505 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[2,0],[[X]][0,0]
506 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[2,0],[[X]][2,3]
507 ; SSE3-NEXT:    retq
508 ;
509 ; SSSE3-LABEL: @shuffle_v4f32_z6zz
510 ; SSSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
511 ; SSSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[2,0],[[X]][0,0]
512 ; SSSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[2,0],[[X]][2,3]
513 ; SSSE3-NEXT:    retq
514 ;
515 ; SSE41-LABEL: @shuffle_v4f32_z6zz
516 ; SSE41:         insertps {{.*}} # xmm0 = zero,xmm0[2],zero,zero
517 ; SSE41-NEXT:    retq
518 ;
519 ; AVX1-LABEL: @shuffle_v4f32_z6zz
520 ; AVX1:         vinsertps {{.*}} # xmm0 = zero,xmm0[2],zero,zero
521 ; AVX1-NEXT:    retq
522   %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 0, i32 6, i32 2, i32 3>
523   ret <4 x float> %shuffle
524 }
525
526 define <4 x i32> @shuffle_v4i32_4zzz(i32 %i) {
527 ; ALL-LABEL: @shuffle_v4i32_4zzz
528 ; ALL:         movd {{.*}}, %xmm0
529 ; ALL-NEXT:    retq
530   %a = insertelement <4 x i32> undef, i32 %i, i32 0
531   %shuffle = shufflevector <4 x i32> zeroinitializer, <4 x i32> %a, <4 x i32> <i32 4, i32 1, i32 2, i32 3>
532   ret <4 x i32> %shuffle
533 }
534
535 define <4 x i32> @shuffle_v4i32_z4zz(i32 %i) {
536 ; ALL-LABEL: @shuffle_v4i32_z4zz
537 ; ALL:         movd {{.*}}, %xmm0
538 ; ALL-NEXT:    pshufd {{.*}} # xmm0 = xmm0[1,0,1,1]
539 ; ALL-NEXT:    retq
540   %a = insertelement <4 x i32> undef, i32 %i, i32 0
541   %shuffle = shufflevector <4 x i32> zeroinitializer, <4 x i32> %a, <4 x i32> <i32 2, i32 4, i32 3, i32 0>
542   ret <4 x i32> %shuffle
543 }
544
545 define <4 x i32> @shuffle_v4i32_zz4z(i32 %i) {
546 ; ALL-LABEL: @shuffle_v4i32_zz4z
547 ; ALL:         movd {{.*}}, %xmm0
548 ; ALL-NEXT:    pshufd {{.*}} # xmm0 = xmm0[1,1,0,1]
549 ; ALL-NEXT:    retq
550   %a = insertelement <4 x i32> undef, i32 %i, i32 0
551   %shuffle = shufflevector <4 x i32> zeroinitializer, <4 x i32> %a, <4 x i32> <i32 0, i32 0, i32 4, i32 0>
552   ret <4 x i32> %shuffle
553 }
554
555 define <4 x i32> @shuffle_v4i32_zuu4(i32 %i) {
556 ; ALL-LABEL: @shuffle_v4i32_zuu4
557 ; ALL:         movd {{.*}}, %xmm0
558 ; ALL-NEXT:    pshufd {{.*}} # xmm0 = xmm0[1,1,1,0]
559 ; ALL-NEXT:    retq
560   %a = insertelement <4 x i32> undef, i32 %i, i32 0
561   %shuffle = shufflevector <4 x i32> zeroinitializer, <4 x i32> %a, <4 x i32> <i32 0, i32 undef, i32 undef, i32 4>
562   ret <4 x i32> %shuffle
563 }
564
565 define <4 x i32> @shuffle_v4i32_z6zz(i32 %i) {
566 ; ALL-LABEL: @shuffle_v4i32_z6zz
567 ; ALL:         movd {{.*}}, %xmm0
568 ; ALL-NEXT:    pshufd {{.*}} # xmm0 = xmm0[1,0,1,1]
569 ; ALL-NEXT:    retq
570   %a = insertelement <4 x i32> undef, i32 %i, i32 2
571   %shuffle = shufflevector <4 x i32> zeroinitializer, <4 x i32> %a, <4 x i32> <i32 0, i32 6, i32 2, i32 3>
572   ret <4 x i32> %shuffle
573 }
574
575 define <4 x i32> @shuffle_v4i32_7012(<4 x i32> %a, <4 x i32> %b) {
576 ; SSE2-LABEL: @shuffle_v4i32_7012
577 ; SSE2:       # BB#0:
578 ; SSE2-NEXT:    shufps {{.*}} # xmm1 = xmm1[3,0],xmm0[0,0]
579 ; SSE2-NEXT:    shufps {{.*}} # xmm1 = xmm1[0,2],xmm0[1,2]
580 ; SSE2-NEXT:    movaps %xmm1, %xmm0
581 ; SSE2-NEXT:    retq
582 ;
583 ; SSE3-LABEL: @shuffle_v4i32_7012
584 ; SSE3:       # BB#0:
585 ; SSE3-NEXT:    shufps {{.*}} # xmm1 = xmm1[3,0],xmm0[0,0]
586 ; SSE3-NEXT:    shufps {{.*}} # xmm1 = xmm1[0,2],xmm0[1,2]
587 ; SSE3-NEXT:    movaps %xmm1, %xmm0
588 ; SSE3-NEXT:    retq
589 ;
590 ; SSSE3-LABEL: @shuffle_v4i32_7012
591 ; SSSE3:       # BB#0:
592 ; SSSE3-NEXT:    palignr $12, {{.*}} # xmm0 = xmm1[12,13,14,15],xmm0[0,1,2,3,4,5,6,7,8,9,10,11]
593 ; SSSE3-NEXT:    retq
594 ;
595 ; SSE41-LABEL: @shuffle_v4i32_7012
596 ; SSE41:       # BB#0:
597 ; SSE41-NEXT:    palignr $12, {{.*}} # xmm0 = xmm1[12,13,14,15],xmm0[0,1,2,3,4,5,6,7,8,9,10,11]
598 ; SSE41-NEXT:    retq
599 ;
600 ; AVX1-LABEL: @shuffle_v4i32_7012
601 ; AVX1:       # BB#0:
602 ; AVX1-NEXT:    vpalignr $12, {{.*}} # xmm0 = xmm1[12,13,14,15],xmm0[0,1,2,3,4,5,6,7,8,9,10,11]
603 ; AVX1-NEXT:    retq
604   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 7, i32 0, i32 1, i32 2>
605   ret <4 x i32> %shuffle
606 }
607
608 define <4 x i32> @shuffle_v4i32_6701(<4 x i32> %a, <4 x i32> %b) {
609 ; SSE2-LABEL: @shuffle_v4i32_6701
610 ; SSE2:       # BB#0:
611 ; SSE2-NEXT:    shufpd {{.*}} # xmm1 = xmm1[1],xmm0[0]
612 ; SSE2-NEXT:    movapd %xmm1, %xmm0
613 ; SSE2-NEXT:    retq
614 ;
615 ; SSE3-LABEL: @shuffle_v4i32_6701
616 ; SSE3:       # BB#0:
617 ; SSE3-NEXT:    shufpd {{.*}} # xmm1 = xmm1[1],xmm0[0]
618 ; SSE3-NEXT:    movapd %xmm1, %xmm0
619 ; SSE3-NEXT:    retq
620 ;
621 ; SSSE3-LABEL: @shuffle_v4i32_6701
622 ; SSSE3:       # BB#0:
623 ; SSSE3-NEXT:    palignr $8, {{.*}} # xmm0 = xmm1[8,9,10,11,12,13,14,15],xmm0[0,1,2,3,4,5,6,7]
624 ; SSSE3-NEXT:    retq
625 ;
626 ; SSE41-LABEL: @shuffle_v4i32_6701
627 ; SSE41:       # BB#0:
628 ; SSE41-NEXT:    palignr $8, {{.*}} # xmm0 = xmm1[8,9,10,11,12,13,14,15],xmm0[0,1,2,3,4,5,6,7]
629 ; SSE41-NEXT:    retq
630 ;
631 ; AVX1-LABEL: @shuffle_v4i32_6701
632 ; AVX1:       # BB#0:
633 ; AVX1-NEXT:    vpalignr $8, {{.*}} # xmm0 = xmm1[8,9,10,11,12,13,14,15],xmm0[0,1,2,3,4,5,6,7]
634 ; AVX1-NEXT:    retq
635   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 6, i32 7, i32 0, i32 1>
636   ret <4 x i32> %shuffle
637 }
638
639 define <4 x i32> @shuffle_v4i32_5670(<4 x i32> %a, <4 x i32> %b) {
640 ; SSE2-LABEL: @shuffle_v4i32_5670
641 ; SSE2:       # BB#0:
642 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,0],xmm1[3,0]
643 ; SSE2-NEXT:    shufps {{.*}} # xmm1 = xmm1[1,2],xmm0[2,0]
644 ; SSE2-NEXT:    movaps %xmm1, %xmm0
645 ; SSE2-NEXT:    retq
646 ;
647 ; SSE3-LABEL: @shuffle_v4i32_5670
648 ; SSE3:       # BB#0:
649 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,0],xmm1[3,0]
650 ; SSE3-NEXT:    shufps {{.*}} # xmm1 = xmm1[1,2],xmm0[2,0]
651 ; SSE3-NEXT:    movaps %xmm1, %xmm0
652 ; SSE3-NEXT:    retq
653 ;
654 ; SSSE3-LABEL: @shuffle_v4i32_5670
655 ; SSSE3:       # BB#0:
656 ; SSSE3-NEXT:    palignr $4, {{.*}} # xmm0 = xmm1[4,5,6,7,8,9,10,11,12,13,14,15],xmm0[0,1,2,3]
657 ; SSSE3-NEXT:    retq
658 ;
659 ; SSE41-LABEL: @shuffle_v4i32_5670
660 ; SSE41:       # BB#0:
661 ; SSE41-NEXT:    palignr $4, {{.*}} # xmm0 = xmm1[4,5,6,7,8,9,10,11,12,13,14,15],xmm0[0,1,2,3]
662 ; SSE41-NEXT:    retq
663 ;
664 ; AVX1-LABEL: @shuffle_v4i32_5670
665 ; AVX1:       # BB#0:
666 ; AVX1-NEXT:    vpalignr $4, {{.*}} # xmm0 = xmm1[4,5,6,7,8,9,10,11,12,13,14,15],xmm0[0,1,2,3]
667 ; AVX1-NEXT:    retq
668   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 5, i32 6, i32 7, i32 0>
669   ret <4 x i32> %shuffle
670 }
671
672 define <4 x i32> @shuffle_v4i32_1234(<4 x i32> %a, <4 x i32> %b) {
673 ; SSE2-LABEL: @shuffle_v4i32_1234
674 ; SSE2:       # BB#0:
675 ; SSE2-NEXT:    shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[3,0]
676 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[1,2],xmm1[2,0]
677 ; SSE2-NEXT:    retq
678 ;
679 ; SSE3-LABEL: @shuffle_v4i32_1234
680 ; SSE3:       # BB#0:
681 ; SSE3-NEXT:    shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[3,0]
682 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[1,2],xmm1[2,0]
683 ; SSE3-NEXT:    retq
684 ;
685 ; SSSE3-LABEL: @shuffle_v4i32_1234
686 ; SSSE3:       # BB#0:
687 ; SSSE3-NEXT:    palignr $4, {{.*}} # xmm1 = xmm0[4,5,6,7,8,9,10,11,12,13,14,15],xmm1[0,1,2,3]
688 ; SSSE3-NEXT:    movdqa %xmm1, %xmm0
689 ; SSSE3-NEXT:    retq
690 ;
691 ; SSE41-LABEL: @shuffle_v4i32_1234
692 ; SSE41:       # BB#0:
693 ; SSE41-NEXT:    palignr $4, {{.*}} # xmm1 = xmm0[4,5,6,7,8,9,10,11,12,13,14,15],xmm1[0,1,2,3]
694 ; SSE41-NEXT:    movdqa %xmm1, %xmm0
695 ; SSE41-NEXT:    retq
696 ;
697 ; AVX1-LABEL: @shuffle_v4i32_1234
698 ; AVX1:       # BB#0:
699 ; AVX1-NEXT:    vpalignr $4, {{.*}} # xmm0 = xmm0[4,5,6,7,8,9,10,11,12,13,14,15],xmm1[0,1,2,3]
700 ; AVX1-NEXT:    retq
701   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 1, i32 2, i32 3, i32 4>
702   ret <4 x i32> %shuffle
703 }
704
705 define <4 x i32> @shuffle_v4i32_2345(<4 x i32> %a, <4 x i32> %b) {
706 ; SSE2-LABEL: @shuffle_v4i32_2345
707 ; SSE2:       # BB#0:
708 ; SSE2-NEXT:    shufpd {{.*}} # xmm0 = xmm0[1],xmm1[0]
709 ; SSE2-NEXT:    retq
710 ;
711 ; SSE3-LABEL: @shuffle_v4i32_2345
712 ; SSE3:       # BB#0:
713 ; SSE3-NEXT:    shufpd {{.*}} # xmm0 = xmm0[1],xmm1[0]
714 ; SSE3-NEXT:    retq
715 ;
716 ; SSSE3-LABEL: @shuffle_v4i32_2345
717 ; SSSE3:       # BB#0:
718 ; SSSE3-NEXT:    palignr $8, {{.*}} # xmm1 = xmm0[8,9,10,11,12,13,14,15],xmm1[0,1,2,3,4,5,6,7]
719 ; SSSE3-NEXT:    movdqa %xmm1, %xmm0
720 ; SSSE3-NEXT:    retq
721 ;
722 ; SSE41-LABEL: @shuffle_v4i32_2345
723 ; SSE41:       # BB#0:
724 ; SSE41-NEXT:    palignr $8, {{.*}} # xmm1 = xmm0[8,9,10,11,12,13,14,15],xmm1[0,1,2,3,4,5,6,7]
725 ; SSE41-NEXT:    movdqa %xmm1, %xmm0
726 ; SSE41-NEXT:    retq
727 ;
728 ; AVX1-LABEL: @shuffle_v4i32_2345
729 ; AVX1:       # BB#0:
730 ; AVX1-NEXT:    vpalignr $8, {{.*}} # xmm0 = xmm0[8,9,10,11,12,13,14,15],xmm1[0,1,2,3,4,5,6,7]
731 ; AVX1-NEXT:    retq
732   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 2, i32 3, i32 4, i32 5>
733   ret <4 x i32> %shuffle
734 }
735
736 define <4 x i32> @shuffle_v4i32_3456(<4 x i32> %a, <4 x i32> %b) {
737 ; SSE2-LABEL: @shuffle_v4i32_3456
738 ; SSE2:       # BB#0:
739 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[3,0],xmm1[0,0]
740 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,2],xmm1[1,2]
741 ; SSE2-NEXT:    retq
742 ;
743 ; SSE3-LABEL: @shuffle_v4i32_3456
744 ; SSE3:       # BB#0:
745 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[3,0],xmm1[0,0]
746 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,2],xmm1[1,2]
747 ; SSE3-NEXT:    retq
748 ;
749 ; SSSE3-LABEL: @shuffle_v4i32_3456
750 ; SSSE3:       # BB#0:
751 ; SSSE3-NEXT:    palignr $12, {{.*}} # xmm1 = xmm0[12,13,14,15],xmm1[0,1,2,3,4,5,6,7,8,9,10,11]
752 ; SSSE3-NEXT:    movdqa %xmm1, %xmm0
753 ; SSSE3-NEXT:    retq
754 ;
755 ; SSE41-LABEL: @shuffle_v4i32_3456
756 ; SSE41:       # BB#0:
757 ; SSE41-NEXT:    palignr $12, {{.*}} # xmm1 = xmm0[12,13,14,15],xmm1[0,1,2,3,4,5,6,7,8,9,10,11]
758 ; SSE41-NEXT:    movdqa %xmm1, %xmm0
759 ; SSE41-NEXT:    retq
760 ;
761 ; AVX1-LABEL: @shuffle_v4i32_3456
762 ; AVX1:       # BB#0:
763 ; AVX1-NEXT:    vpalignr $12, {{.*}} # xmm0 = xmm0[12,13,14,15],xmm1[0,1,2,3,4,5,6,7,8,9,10,11]
764 ; AVX1-NEXT:    retq
765   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
766   ret <4 x i32> %shuffle
767 }
768
769 define <4 x i32> @shuffle_v4i32_0u1u(<4 x i32> %a, <4 x i32> %b) {
770 ; ALL-LABEL: @shuffle_v4i32_0u1u
771 ; ALL:       # BB#0:
772 ; ALL-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,0,1,1]
773 ; ALL-NEXT:    retq
774   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 undef, i32 1, i32 undef>
775   ret <4 x i32> %shuffle
776 }
777
778 define <4 x i32> @shuffle_v4i32_0z1z(<4 x i32> %a) {
779 ; SSE2-LABEL: @shuffle_v4i32_0z1z
780 ; SSE2:       # BB#0:
781 ; SSE2-NEXT:    pxor %[[X:xmm[0-9]+]], %[[X]]
782 ; SSE2-NEXT:    punpckldq {{.*}} # xmm0 = xmm0[0],[[X]][0],xmm0[1],[[X]][1]
783 ; SSE2-NEXT:    retq
784 ;
785 ; SSE3-LABEL: @shuffle_v4i32_0z1z
786 ; SSE3:       # BB#0:
787 ; SSE3-NEXT:    pxor %[[X:xmm[0-9]+]], %[[X]]
788 ; SSE3-NEXT:    punpckldq {{.*}} # xmm0 = xmm0[0],[[X]][0],xmm0[1],[[X]][1]
789 ; SSE3-NEXT:    retq
790 ;
791 ; SSSE3-LABEL: @shuffle_v4i32_0z1z
792 ; SSSE3:       # BB#0:
793 ; SSSE3-NEXT:    pxor %[[X:xmm[0-9]+]], %[[X]]
794 ; SSSE3-NEXT:    punpckldq {{.*}} # xmm0 = xmm0[0],[[X]][0],xmm0[1],[[X]][1]
795 ; SSSE3-NEXT:    retq
796 ;
797 ; SSE41-LABEL: @shuffle_v4i32_0z1z
798 ; SSE41:       # BB#0:
799 ; SSE41-NEXT:    pmovzxdq %xmm0, %xmm0
800 ; SSE41-NEXT:    retq
801 ;
802 ; AVX1-LABEL: @shuffle_v4i32_0z1z
803 ; AVX1:       # BB#0:
804 ; AVX1-NEXT:    vpmovzxdq %xmm0, %xmm0
805 ; AVX1-NEXT:    retq
806   %shuffle = shufflevector <4 x i32> %a, <4 x i32> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 1, i32 7>
807   ret <4 x i32> %shuffle
808 }