[x86] Start moving to a fancier check syntax to reduce the need for
[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=SSE --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=SSE --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=SSE --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=SSE --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=AVX --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 ; AVX-LABEL: @shuffle_v4f32_0022
156 ; AVX:         vmovsldup {{.*}} # xmm0 = xmm0[0,0,2,2]
157 ; AVX-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 ; AVX-LABEL: @shuffle_v4f32_1133
179 ; AVX:         vmovshdup {{.*}} # xmm0 = xmm0[1,1,3,3]
180 ; AVX-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 ; AVX-LABEL: @shuffle_v4i32_0124
206 ; AVX:         vinsertps {{.*}} # xmm0 = xmm0[0,1,2],xmm1[0]
207 ; AVX-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 ; SSE-LABEL: @shuffle_v4i32_0412
221 ; SSE:         shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[0,0]
222 ; SSE-NEXT:    shufps {{.*}} # xmm1 = xmm1[2,0],xmm0[1,2]
223 ; SSE-NEXT:    movaps %xmm1, %xmm0
224 ; SSE-NEXT:    retq
225 ;
226 ; AVX-LABEL: @shuffle_v4i32_0412
227 ; AVX:         vshufps {{.*}} # xmm1 = xmm1[0,0],xmm0[0,0]
228 ; AVX-NEXT:    vshufps {{.*}} # xmm0 = xmm1[2,0],xmm0[1,2]
229 ; AVX-NEXT:    retq
230   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 1, i32 2>
231   ret <4 x i32> %shuffle
232 }
233 define <4 x i32> @shuffle_v4i32_4012(<4 x i32> %a, <4 x i32> %b) {
234 ; SSE-LABEL: @shuffle_v4i32_4012
235 ; SSE:         shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[0,0]
236 ; SSE-NEXT:    shufps {{.*}} # xmm1 = xmm1[0,2],xmm0[1,2]
237 ; SSE-NEXT:    movaps %xmm1, %xmm0
238 ; SSE-NEXT:    retq
239 ;
240 ; AVX-LABEL: @shuffle_v4i32_4012
241 ; AVX:         vshufps {{.*}} # xmm1 = xmm1[0,0],xmm0[0,0]
242 ; AVX-NEXT:    vshufps {{.*}} # xmm0 = xmm1[0,2],xmm0[1,2]
243 ; AVX-NEXT:    retq
244   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 0, i32 1, i32 2>
245   ret <4 x i32> %shuffle
246 }
247 define <4 x i32> @shuffle_v4i32_0145(<4 x i32> %a, <4 x i32> %b) {
248 ; ALL-LABEL: @shuffle_v4i32_0145
249 ; ALL:         punpcklqdq {{.*}} # xmm0 = xmm0[0],xmm1[0]
250 ; ALL-NEXT:    retq
251   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
252   ret <4 x i32> %shuffle
253 }
254 define <4 x i32> @shuffle_v4i32_0451(<4 x i32> %a, <4 x i32> %b) {
255 ; ALL-LABEL: @shuffle_v4i32_0451
256 ; ALL:         shufps {{.*}} # xmm0 = xmm0[0,1],xmm1[0,1]
257 ; ALL-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,2,3,1]
258 ; ALL-NEXT:    retq
259   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 5, i32 1>
260   ret <4 x i32> %shuffle
261 }
262 define <4 x i32> @shuffle_v4i32_4501(<4 x i32> %a, <4 x i32> %b) {
263 ; SSE-LABEL: @shuffle_v4i32_4501
264 ; SSE:         punpcklqdq {{.*}} # xmm1 = xmm1[0],xmm0[0]
265 ; SSE-NEXT:    movdqa %xmm1, %xmm0
266 ; SSE-NEXT:    retq
267 ;
268 ; AVX-LABEL: @shuffle_v4i32_4501
269 ; AVX:         punpcklqdq {{.*}} # xmm0 = xmm1[0],xmm0[0]
270 ; AVX-NEXT:    retq
271   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 5, i32 0, i32 1>
272   ret <4 x i32> %shuffle
273 }
274 define <4 x i32> @shuffle_v4i32_4015(<4 x i32> %a, <4 x i32> %b) {
275 ; ALL-LABEL: @shuffle_v4i32_4015
276 ; ALL:         shufps {{.*}} # xmm0 = xmm0[0,1],xmm1[0,1]
277 ; ALL-NEXT:    shufps {{.*}} # xmm0 = xmm0[2,0,1,3]
278 ; ALL-NEXT:    retq
279   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 0, i32 1, i32 5>
280   ret <4 x i32> %shuffle
281 }
282
283 define <4 x float> @shuffle_v4f32_4zzz(<4 x float> %a) {
284 ; SSE2-LABEL: @shuffle_v4f32_4zzz
285 ; SSE2:         xorps %[[X:xmm[0-9]+]], %[[X]]
286 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,0],[[X]][1,0]
287 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,2],[[X]][2,3]
288 ; SSE2-NEXT:    retq
289 ;
290 ; SSE3-LABEL: @shuffle_v4f32_4zzz
291 ; SSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
292 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,0],[[X]][1,0]
293 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,2],[[X]][2,3]
294 ; SSE3-NEXT:    retq
295 ;
296 ; SSSE3-LABEL: @shuffle_v4f32_4zzz
297 ; SSSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
298 ; SSSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,0],[[X]][1,0]
299 ; SSSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,2],[[X]][2,3]
300 ; SSSE3-NEXT:    retq
301 ;
302 ; SSE41-LABEL: @shuffle_v4f32_4zzz
303 ; SSE41:         xorps %[[X:xmm[0-9]+]], %[[X]]
304 ; SSE41-NEXT:    blendps {{.*}} # [[X]] = xmm0[0],[[X]][1,2,3]
305 ; SSE41-NEXT:    movaps %[[X]], %xmm0
306 ; SSE41-NEXT:    retq
307 ;
308 ; AVX-LABEL: @shuffle_v4f32_4zzz
309 ; AVX:         vxorps %[[X:xmm[0-9]+]], %[[X]]
310 ; AVX-NEXT:    vblendps {{.*}} # xmm0 = xmm0[0],[[X]][1,2,3]
311 ; AVX-NEXT:    retq
312   %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 4, i32 1, i32 2, i32 3>
313   ret <4 x float> %shuffle
314 }
315
316 define <4 x float> @shuffle_v4f32_z4zz(<4 x float> %a) {
317 ; SSE2-LABEL: @shuffle_v4f32_z4zz
318 ; SSE2:         xorps %[[X:xmm[0-9]+]], %[[X]]
319 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,0],[[X]][2,0]
320 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[2,0],[[X]][3,0]
321 ; SSE2-NEXT:    retq
322 ;
323 ; SSE3-LABEL: @shuffle_v4f32_z4zz
324 ; SSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
325 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,0],[[X]][2,0]
326 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[2,0],[[X]][3,0]
327 ; SSE3-NEXT:    retq
328 ;
329 ; SSSE3-LABEL: @shuffle_v4f32_z4zz
330 ; SSSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
331 ; SSSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,0],[[X]][2,0]
332 ; SSSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[2,0],[[X]][3,0]
333 ; SSSE3-NEXT:    retq
334 ;
335 ; SSE41-LABEL: @shuffle_v4f32_z4zz
336 ; SSE41:         insertps {{.*}} # xmm0 = zero,xmm0[0],zero,zero
337 ; SSE41-NEXT:    retq
338 ;
339 ; AVX-LABEL: @shuffle_v4f32_z4zz
340 ; AVX:         vinsertps {{.*}} # xmm0 = zero,xmm0[0],zero,zero
341 ; AVX-NEXT:    retq
342   %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 2, i32 4, i32 3, i32 0>
343   ret <4 x float> %shuffle
344 }
345
346 define <4 x float> @shuffle_v4f32_zz4z(<4 x float> %a) {
347 ; SSE2-LABEL: @shuffle_v4f32_zz4z
348 ; SSE2:         xorps %[[X:xmm[0-9]+]], %[[X]]
349 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,0],[[X]][0,0]
350 ; SSE2-NEXT:    shufps {{.*}} # [[X]] = [[X]][0,0],xmm0[0,2]
351 ; SSE2-NEXT:    movaps %[[X]], %xmm0
352 ; SSE2-NEXT:    retq
353 ;
354 ; SSE3-LABEL: @shuffle_v4f32_zz4z
355 ; SSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
356 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,0],[[X]][0,0]
357 ; SSE3-NEXT:    shufps {{.*}} # [[X]] = [[X]][0,0],xmm0[0,2]
358 ; SSE3-NEXT:    movaps %[[X]], %xmm0
359 ; SSE3-NEXT:    retq
360 ;
361 ; SSSE3-LABEL: @shuffle_v4f32_zz4z
362 ; SSSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
363 ; SSSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,0],[[X]][0,0]
364 ; SSSE3-NEXT:    shufps {{.*}} # [[X]] = [[X]][0,0],xmm0[0,2]
365 ; SSSE3-NEXT:    movaps %[[X]], %xmm0
366 ; SSSE3-NEXT:    retq
367 ;
368 ; SSE41-LABEL: @shuffle_v4f32_zz4z
369 ; SSE41:         insertps {{.*}} # xmm0 = zero,zero,xmm0[0],zero
370 ; SSE41-NEXT:    retq
371 ;
372 ; AVX-LABEL: @shuffle_v4f32_zz4z
373 ; AVX:         vinsertps {{.*}} # xmm0 = zero,zero,xmm0[0],zero
374 ; AVX-NEXT:    retq
375   %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 0, i32 0, i32 4, i32 0>
376   ret <4 x float> %shuffle
377 }
378
379 define <4 x float> @shuffle_v4f32_zuu4(<4 x float> %a) {
380 ; SSE2-LABEL: @shuffle_v4f32_zuu4
381 ; SSE2:         xorps %[[X:xmm[0-9]+]], %[[X]]
382 ; SSE2-NEXT:    shufps {{.*}} # [[X]] = [[X]][0,1],xmm0[2,0]
383 ; SSE2-NEXT:    movaps %[[X]], %xmm0
384 ; SSE2-NEXT:    retq
385 ;
386 ; SSE3-LABEL: @shuffle_v4f32_zuu4
387 ; SSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
388 ; SSE3-NEXT:    shufps {{.*}} # [[X]] = [[X]][0,1],xmm0[2,0]
389 ; SSE3-NEXT:    movaps %[[X]], %xmm0
390 ; SSE3-NEXT:    retq
391 ;
392 ; SSSE3-LABEL: @shuffle_v4f32_zuu4
393 ; SSSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
394 ; SSSE3-NEXT:    shufps {{.*}} # [[X]] = [[X]][0,1],xmm0[2,0]
395 ; SSSE3-NEXT:    movaps %[[X]], %xmm0
396 ; SSSE3-NEXT:    retq
397 ;
398 ; SSE41-LABEL: @shuffle_v4f32_zuu4
399 ; SSE41:         insertps {{.*}} # xmm0 = zero,zero,zero,xmm0[0]
400 ; SSE41-NEXT:    retq
401 ;
402 ; AVX-LABEL: @shuffle_v4f32_zuu4
403 ; AVX:         vinsertps {{.*}} # xmm0 = zero,zero,zero,xmm0[0]
404 ; AVX-NEXT:    retq
405   %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 0, i32 undef, i32 undef, i32 4>
406   ret <4 x float> %shuffle
407 }
408
409 define <4 x float> @shuffle_v4f32_zzz7(<4 x float> %a) {
410 ; SSE2-LABEL: @shuffle_v4f32_zzz7
411 ; SSE2:         xorps %[[X:xmm[0-9]+]], %[[X]]
412 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[3,0],[[X]][2,0]
413 ; SSE2-NEXT:    shufps {{.*}} # [[X]] = [[X]][0,1],xmm0[2,0]
414 ; SSE2-NEXT:    movaps %[[X]], %xmm0
415 ; SSE2-NEXT:    retq
416 ;
417 ; SSE3-LABEL: @shuffle_v4f32_zzz7
418 ; SSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
419 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[3,0],[[X]][2,0]
420 ; SSE3-NEXT:    shufps {{.*}} # [[X]] = [[X]][0,1],xmm0[2,0]
421 ; SSE3-NEXT:    movaps %[[X]], %xmm0
422 ; SSE3-NEXT:    retq
423 ;
424 ; SSSE3-LABEL: @shuffle_v4f32_zzz7
425 ; SSSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
426 ; SSSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[3,0],[[X]][2,0]
427 ; SSSE3-NEXT:    shufps {{.*}} # [[X]] = [[X]][0,1],xmm0[2,0]
428 ; SSSE3-NEXT:    movaps %[[X]], %xmm0
429 ; SSSE3-NEXT:    retq
430 ;
431 ; SSE41-LABEL: @shuffle_v4f32_zzz7
432 ; SSE41:         xorps %[[X:xmm[0-9]+]], %[[X]]
433 ; SSE41-NEXT:    blendps {{.*}} # [[X]] = [[X]][0,1,2],xmm0[3]
434 ; SSE41-NEXT:    movaps %[[X]], %xmm0
435 ; SSE41-NEXT:    retq
436 ;
437 ; AVX-LABEL: @shuffle_v4f32_zzz7
438 ; AVX:         vxorps %[[X:xmm[0-9]+]], %[[X]]
439 ; AVX-NEXT:    vblendps {{.*}} # xmm0 = [[X]][0,1,2],xmm0[3]
440 ; AVX-NEXT:    retq
441   %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
442   ret <4 x float> %shuffle
443 }
444
445 define <4 x float> @shuffle_v4f32_z6zz(<4 x float> %a) {
446 ; SSE2-LABEL: @shuffle_v4f32_z6zz
447 ; SSE2:         xorps %[[X:xmm[0-9]+]], %[[X]]
448 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[2,0],[[X]][0,0]
449 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[2,0],[[X]][2,3]
450 ; SSE2-NEXT:    retq
451 ;
452 ; SSE3-LABEL: @shuffle_v4f32_z6zz
453 ; SSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
454 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[2,0],[[X]][0,0]
455 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[2,0],[[X]][2,3]
456 ; SSE3-NEXT:    retq
457 ;
458 ; SSSE3-LABEL: @shuffle_v4f32_z6zz
459 ; SSSE3:         xorps %[[X:xmm[0-9]+]], %[[X]]
460 ; SSSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[2,0],[[X]][0,0]
461 ; SSSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[2,0],[[X]][2,3]
462 ; SSSE3-NEXT:    retq
463 ;
464 ; SSE41-LABEL: @shuffle_v4f32_z6zz
465 ; SSE41:         insertps {{.*}} # xmm0 = zero,xmm0[2],zero,zero
466 ; SSE41-NEXT:    retq
467 ;
468 ; AVX-LABEL: @shuffle_v4f32_z6zz
469 ; AVX:         vinsertps {{.*}} # xmm0 = zero,xmm0[2],zero,zero
470 ; AVX-NEXT:    retq
471   %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 0, i32 6, i32 2, i32 3>
472   ret <4 x float> %shuffle
473 }
474
475 define <4 x i32> @shuffle_v4i32_4zzz(i32 %i) {
476 ; ALL-LABEL: @shuffle_v4i32_4zzz
477 ; ALL:         movd {{.*}}, %xmm0
478 ; ALL-NEXT:    retq
479   %a = insertelement <4 x i32> undef, i32 %i, i32 0
480   %shuffle = shufflevector <4 x i32> zeroinitializer, <4 x i32> %a, <4 x i32> <i32 4, i32 1, i32 2, i32 3>
481   ret <4 x i32> %shuffle
482 }
483
484 define <4 x i32> @shuffle_v4i32_z4zz(i32 %i) {
485 ; ALL-LABEL: @shuffle_v4i32_z4zz
486 ; ALL:         movd {{.*}}, %xmm0
487 ; ALL-NEXT:    pshufd {{.*}} # xmm0 = xmm0[1,0,1,1]
488 ; ALL-NEXT:    retq
489   %a = insertelement <4 x i32> undef, i32 %i, i32 0
490   %shuffle = shufflevector <4 x i32> zeroinitializer, <4 x i32> %a, <4 x i32> <i32 2, i32 4, i32 3, i32 0>
491   ret <4 x i32> %shuffle
492 }
493
494 define <4 x i32> @shuffle_v4i32_zz4z(i32 %i) {
495 ; ALL-LABEL: @shuffle_v4i32_zz4z
496 ; ALL:         movd {{.*}}, %xmm0
497 ; ALL-NEXT:    pshufd {{.*}} # xmm0 = xmm0[1,1,0,1]
498 ; ALL-NEXT:    retq
499   %a = insertelement <4 x i32> undef, i32 %i, i32 0
500   %shuffle = shufflevector <4 x i32> zeroinitializer, <4 x i32> %a, <4 x i32> <i32 0, i32 0, i32 4, i32 0>
501   ret <4 x i32> %shuffle
502 }
503
504 define <4 x i32> @shuffle_v4i32_zuu4(i32 %i) {
505 ; ALL-LABEL: @shuffle_v4i32_zuu4
506 ; ALL:         movd {{.*}}, %xmm0
507 ; ALL-NEXT:    pshufd {{.*}} # xmm0 = xmm0[1,1,1,0]
508 ; ALL-NEXT:    retq
509   %a = insertelement <4 x i32> undef, i32 %i, i32 0
510   %shuffle = shufflevector <4 x i32> zeroinitializer, <4 x i32> %a, <4 x i32> <i32 0, i32 undef, i32 undef, i32 4>
511   ret <4 x i32> %shuffle
512 }
513
514 define <4 x i32> @shuffle_v4i32_z6zz(i32 %i) {
515 ; ALL-LABEL: @shuffle_v4i32_z6zz
516 ; ALL:         movd {{.*}}, %xmm0
517 ; ALL-NEXT:    pshufd {{.*}} # xmm0 = xmm0[1,0,1,1]
518 ; ALL-NEXT:    retq
519   %a = insertelement <4 x i32> undef, i32 %i, i32 2
520   %shuffle = shufflevector <4 x i32> zeroinitializer, <4 x i32> %a, <4 x i32> <i32 0, i32 6, i32 2, i32 3>
521   ret <4 x i32> %shuffle
522 }
523
524 define <4 x i32> @shuffle_v4i32_7012(<4 x i32> %a, <4 x i32> %b) {
525 ; SSE2-LABEL: @shuffle_v4i32_7012
526 ; SSE2:       # BB#0:
527 ; SSE2-NEXT:    shufps {{.*}} # xmm1 = xmm1[3,0],xmm0[0,0]
528 ; SSE2-NEXT:    shufps {{.*}} # xmm1 = xmm1[0,2],xmm0[1,2]
529 ; SSE2-NEXT:    movaps %xmm1, %xmm0
530 ; SSE2-NEXT:    retq
531 ;
532 ; SSE3-LABEL: @shuffle_v4i32_7012
533 ; SSE3:       # BB#0:
534 ; SSE3-NEXT:    shufps {{.*}} # xmm1 = xmm1[3,0],xmm0[0,0]
535 ; SSE3-NEXT:    shufps {{.*}} # xmm1 = xmm1[0,2],xmm0[1,2]
536 ; SSE3-NEXT:    movaps %xmm1, %xmm0
537 ; SSE3-NEXT:    retq
538 ;
539 ; SSSE3-LABEL: @shuffle_v4i32_7012
540 ; SSSE3:       # BB#0:
541 ; SSSE3-NEXT:    palignr $12, {{.*}} # xmm0 = xmm1[12,13,14,15],xmm0[0,1,2,3,4,5,6,7,8,9,10,11]
542 ; SSSE3-NEXT:    retq
543 ;
544 ; SSE41-LABEL: @shuffle_v4i32_7012
545 ; SSE41:       # BB#0:
546 ; SSE41-NEXT:    palignr $12, {{.*}} # xmm0 = xmm1[12,13,14,15],xmm0[0,1,2,3,4,5,6,7,8,9,10,11]
547 ; SSE41-NEXT:    retq
548 ;
549 ; AVX-LABEL: @shuffle_v4i32_7012
550 ; AVX:       # BB#0:
551 ; AVX-NEXT:    vpalignr $12, {{.*}} # xmm0 = xmm1[12,13,14,15],xmm0[0,1,2,3,4,5,6,7,8,9,10,11]
552 ; AVX-NEXT:    retq
553   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 7, i32 0, i32 1, i32 2>
554   ret <4 x i32> %shuffle
555 }
556
557 define <4 x i32> @shuffle_v4i32_6701(<4 x i32> %a, <4 x i32> %b) {
558 ; SSE2-LABEL: @shuffle_v4i32_6701
559 ; SSE2:       # BB#0:
560 ; SSE2-NEXT:    shufpd {{.*}} # xmm1 = xmm1[1],xmm0[0]
561 ; SSE2-NEXT:    movapd %xmm1, %xmm0
562 ; SSE2-NEXT:    retq
563 ;
564 ; SSE3-LABEL: @shuffle_v4i32_6701
565 ; SSE3:       # BB#0:
566 ; SSE3-NEXT:    shufpd {{.*}} # xmm1 = xmm1[1],xmm0[0]
567 ; SSE3-NEXT:    movapd %xmm1, %xmm0
568 ; SSE3-NEXT:    retq
569 ;
570 ; SSSE3-LABEL: @shuffle_v4i32_6701
571 ; SSSE3:       # BB#0:
572 ; SSSE3-NEXT:    palignr $8, {{.*}} # xmm0 = xmm1[8,9,10,11,12,13,14,15],xmm0[0,1,2,3,4,5,6,7]
573 ; SSSE3-NEXT:    retq
574 ;
575 ; SSE41-LABEL: @shuffle_v4i32_6701
576 ; SSE41:       # BB#0:
577 ; SSE41-NEXT:    palignr $8, {{.*}} # xmm0 = xmm1[8,9,10,11,12,13,14,15],xmm0[0,1,2,3,4,5,6,7]
578 ; SSE41-NEXT:    retq
579 ;
580 ; AVX-LABEL: @shuffle_v4i32_6701
581 ; AVX:       # BB#0:
582 ; AVX-NEXT:    vpalignr $8, {{.*}} # xmm0 = xmm1[8,9,10,11,12,13,14,15],xmm0[0,1,2,3,4,5,6,7]
583 ; AVX-NEXT:    retq
584   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 6, i32 7, i32 0, i32 1>
585   ret <4 x i32> %shuffle
586 }
587
588 define <4 x i32> @shuffle_v4i32_5670(<4 x i32> %a, <4 x i32> %b) {
589 ; SSE2-LABEL: @shuffle_v4i32_5670
590 ; SSE2:       # BB#0:
591 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,0],xmm1[3,0]
592 ; SSE2-NEXT:    shufps {{.*}} # xmm1 = xmm1[1,2],xmm0[2,0]
593 ; SSE2-NEXT:    movaps %xmm1, %xmm0
594 ; SSE2-NEXT:    retq
595 ;
596 ; SSE3-LABEL: @shuffle_v4i32_5670
597 ; SSE3:       # BB#0:
598 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,0],xmm1[3,0]
599 ; SSE3-NEXT:    shufps {{.*}} # xmm1 = xmm1[1,2],xmm0[2,0]
600 ; SSE3-NEXT:    movaps %xmm1, %xmm0
601 ; SSE3-NEXT:    retq
602 ;
603 ; SSSE3-LABEL: @shuffle_v4i32_5670
604 ; SSSE3:       # BB#0:
605 ; SSSE3-NEXT:    palignr $4, {{.*}} # xmm0 = xmm1[4,5,6,7,8,9,10,11,12,13,14,15],xmm0[0,1,2,3]
606 ; SSSE3-NEXT:    retq
607 ;
608 ; SSE41-LABEL: @shuffle_v4i32_5670
609 ; SSE41:       # BB#0:
610 ; SSE41-NEXT:    palignr $4, {{.*}} # xmm0 = xmm1[4,5,6,7,8,9,10,11,12,13,14,15],xmm0[0,1,2,3]
611 ; SSE41-NEXT:    retq
612 ;
613 ; AVX-LABEL: @shuffle_v4i32_5670
614 ; AVX:       # BB#0:
615 ; AVX-NEXT:    vpalignr $4, {{.*}} # xmm0 = xmm1[4,5,6,7,8,9,10,11,12,13,14,15],xmm0[0,1,2,3]
616 ; AVX-NEXT:    retq
617   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 5, i32 6, i32 7, i32 0>
618   ret <4 x i32> %shuffle
619 }
620
621 define <4 x i32> @shuffle_v4i32_1234(<4 x i32> %a, <4 x i32> %b) {
622 ; SSE2-LABEL: @shuffle_v4i32_1234
623 ; SSE2:       # BB#0:
624 ; SSE2-NEXT:    shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[3,0]
625 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[1,2],xmm1[2,0]
626 ; SSE2-NEXT:    retq
627 ;
628 ; SSE3-LABEL: @shuffle_v4i32_1234
629 ; SSE3:       # BB#0:
630 ; SSE3-NEXT:    shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[3,0]
631 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[1,2],xmm1[2,0]
632 ; SSE3-NEXT:    retq
633 ;
634 ; SSSE3-LABEL: @shuffle_v4i32_1234
635 ; SSSE3:       # BB#0:
636 ; SSSE3-NEXT:    palignr $4, {{.*}} # xmm1 = xmm0[4,5,6,7,8,9,10,11,12,13,14,15],xmm1[0,1,2,3]
637 ; SSSE3-NEXT:    movdqa %xmm1, %xmm0
638 ; SSSE3-NEXT:    retq
639 ;
640 ; SSE41-LABEL: @shuffle_v4i32_1234
641 ; SSE41:       # BB#0:
642 ; SSE41-NEXT:    palignr $4, {{.*}} # xmm1 = xmm0[4,5,6,7,8,9,10,11,12,13,14,15],xmm1[0,1,2,3]
643 ; SSE41-NEXT:    movdqa %xmm1, %xmm0
644 ; SSE41-NEXT:    retq
645 ;
646 ; AVX-LABEL: @shuffle_v4i32_1234
647 ; AVX:       # BB#0:
648 ; AVX-NEXT:    vpalignr $4, {{.*}} # xmm0 = xmm0[4,5,6,7,8,9,10,11,12,13,14,15],xmm1[0,1,2,3]
649 ; AVX-NEXT:    retq
650   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 1, i32 2, i32 3, i32 4>
651   ret <4 x i32> %shuffle
652 }
653
654 define <4 x i32> @shuffle_v4i32_2345(<4 x i32> %a, <4 x i32> %b) {
655 ; SSE2-LABEL: @shuffle_v4i32_2345
656 ; SSE2:       # BB#0:
657 ; SSE2-NEXT:    shufpd {{.*}} # xmm0 = xmm0[1],xmm1[0]
658 ; SSE2-NEXT:    retq
659 ;
660 ; SSE3-LABEL: @shuffle_v4i32_2345
661 ; SSE3:       # BB#0:
662 ; SSE3-NEXT:    shufpd {{.*}} # xmm0 = xmm0[1],xmm1[0]
663 ; SSE3-NEXT:    retq
664 ;
665 ; SSSE3-LABEL: @shuffle_v4i32_2345
666 ; SSSE3:       # BB#0:
667 ; SSSE3-NEXT:    palignr $8, {{.*}} # xmm1 = xmm0[8,9,10,11,12,13,14,15],xmm1[0,1,2,3,4,5,6,7]
668 ; SSSE3-NEXT:    movdqa %xmm1, %xmm0
669 ; SSSE3-NEXT:    retq
670 ;
671 ; SSE41-LABEL: @shuffle_v4i32_2345
672 ; SSE41:       # BB#0:
673 ; SSE41-NEXT:    palignr $8, {{.*}} # xmm1 = xmm0[8,9,10,11,12,13,14,15],xmm1[0,1,2,3,4,5,6,7]
674 ; SSE41-NEXT:    movdqa %xmm1, %xmm0
675 ; SSE41-NEXT:    retq
676 ;
677 ; AVX-LABEL: @shuffle_v4i32_2345
678 ; AVX:       # BB#0:
679 ; AVX-NEXT:    vpalignr $8, {{.*}} # xmm0 = xmm0[8,9,10,11,12,13,14,15],xmm1[0,1,2,3,4,5,6,7]
680 ; AVX-NEXT:    retq
681   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 2, i32 3, i32 4, i32 5>
682   ret <4 x i32> %shuffle
683 }
684
685 define <4 x i32> @shuffle_v4i32_3456(<4 x i32> %a, <4 x i32> %b) {
686 ; SSE2-LABEL: @shuffle_v4i32_3456
687 ; SSE2:       # BB#0:
688 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[3,0],xmm1[0,0]
689 ; SSE2-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,2],xmm1[1,2]
690 ; SSE2-NEXT:    retq
691 ;
692 ; SSE3-LABEL: @shuffle_v4i32_3456
693 ; SSE3:       # BB#0:
694 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[3,0],xmm1[0,0]
695 ; SSE3-NEXT:    shufps {{.*}} # xmm0 = xmm0[0,2],xmm1[1,2]
696 ; SSE3-NEXT:    retq
697 ;
698 ; SSSE3-LABEL: @shuffle_v4i32_3456
699 ; SSSE3:       # BB#0:
700 ; SSSE3-NEXT:    palignr $12, {{.*}} # xmm1 = xmm0[12,13,14,15],xmm1[0,1,2,3,4,5,6,7,8,9,10,11]
701 ; SSSE3-NEXT:    movdqa %xmm1, %xmm0
702 ; SSSE3-NEXT:    retq
703 ;
704 ; SSE41-LABEL: @shuffle_v4i32_3456
705 ; SSE41:       # BB#0:
706 ; SSE41-NEXT:    palignr $12, {{.*}} # xmm1 = xmm0[12,13,14,15],xmm1[0,1,2,3,4,5,6,7,8,9,10,11]
707 ; SSE41-NEXT:    movdqa %xmm1, %xmm0
708 ; SSE41-NEXT:    retq
709 ;
710 ; AVX-LABEL: @shuffle_v4i32_3456
711 ; AVX:       # BB#0:
712 ; AVX-NEXT:    vpalignr $12, {{.*}} # xmm0 = xmm0[12,13,14,15],xmm1[0,1,2,3,4,5,6,7,8,9,10,11]
713 ; AVX-NEXT:    retq
714   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
715   ret <4 x i32> %shuffle
716 }
717
718 define <4 x i32> @shuffle_v4i32_0u1u(<4 x i32> %a, <4 x i32> %b) {
719 ; ALL-LABEL: @shuffle_v4i32_0u1u
720 ; ALL:       # BB#0:
721 ; ALL-NEXT:    pshufd {{.*}} # xmm0 = xmm0[0,0,1,1]
722 ; ALL-NEXT:    retq
723   %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 undef, i32 1, i32 undef>
724   ret <4 x i32> %shuffle
725 }
726
727 define <4 x i32> @shuffle_v4i32_0z1z(<4 x i32> %a) {
728 ; SSE2-LABEL: @shuffle_v4i32_0z1z
729 ; SSE2:       # BB#0:
730 ; SSE2-NEXT:    pxor %[[X:xmm[0-9]+]], %[[X]]
731 ; SSE2-NEXT:    punpckldq {{.*}} # xmm0 = xmm0[0],[[X]][0],xmm0[1],[[X]][1]
732 ; SSE2-NEXT:    retq
733 ;
734 ; SSE3-LABEL: @shuffle_v4i32_0z1z
735 ; SSE3:       # BB#0:
736 ; SSE3-NEXT:    pxor %[[X:xmm[0-9]+]], %[[X]]
737 ; SSE3-NEXT:    punpckldq {{.*}} # xmm0 = xmm0[0],[[X]][0],xmm0[1],[[X]][1]
738 ; SSE3-NEXT:    retq
739 ;
740 ; SSSE3-LABEL: @shuffle_v4i32_0z1z
741 ; SSSE3:       # BB#0:
742 ; SSSE3-NEXT:    pxor %[[X:xmm[0-9]+]], %[[X]]
743 ; SSSE3-NEXT:    punpckldq {{.*}} # xmm0 = xmm0[0],[[X]][0],xmm0[1],[[X]][1]
744 ; SSSE3-NEXT:    retq
745 ;
746 ; SSE41-LABEL: @shuffle_v4i32_0z1z
747 ; SSE41:       # BB#0:
748 ; SSE41-NEXT:    pmovzxdq %xmm0, %xmm0
749 ; SSE41-NEXT:    retq
750 ;
751 ; AVX-LABEL: @shuffle_v4i32_0z1z
752 ; AVX:       # BB#0:
753 ; AVX-NEXT:    vpmovzxdq %xmm0, %xmm0
754 ; AVX-NEXT:    retq
755   %shuffle = shufflevector <4 x i32> %a, <4 x i32> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 1, i32 7>
756   ret <4 x i32> %shuffle
757 }
758
759 define <4 x i32> @insert_reg_and_zero_v4i32(i32 %a) {
760 ; ALL-LABEL: @insert_reg_and_zero_v4i32
761 ; ALL:       # BB#0:
762 ; ALL-NEXT:    movd %edi, %xmm0
763 ; ALL-NEXT:    retq
764   %v = insertelement <4 x i32> undef, i32 %a, i32 0
765   %shuffle = shufflevector <4 x i32> %v, <4 x i32> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
766   ret <4 x i32> %shuffle
767 }
768
769 define <4 x i32> @insert_mem_and_zero_v4i32(i32* %ptr) {
770 ; ALL-LABEL: @insert_mem_and_zero_v4i32
771 ; ALL:       # BB#0:
772 ; ALL-NEXT:    movd (%rdi), %xmm0
773 ; ALL-NEXT:    retq
774   %a = load i32* %ptr
775   %v = insertelement <4 x i32> undef, i32 %a, i32 0
776   %shuffle = shufflevector <4 x i32> %v, <4 x i32> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
777   ret <4 x i32> %shuffle
778 }
779
780 define <4 x float> @insert_reg_and_zero_v4f32(float %a) {
781 ; SSE-LABEL: @insert_reg_and_zero_v4f32
782 ; SSE:       # BB#0:
783 ; SSE-NEXT:    xorps %[[X:xmm[0-9]+]], %[[X]]
784 ; SSE-NEXT:    movss %xmm0, %[[X]]
785 ; SSE-NEXT:    movaps %[[X]], %xmm0
786 ; SSE-NEXT:    retq
787 ;
788 ; AVX-LABEL: @insert_reg_and_zero_v4f32
789 ; AVX:       # BB#0:
790 ; AVX-NEXT:    vxorps %[[X:xmm[0-9]+]], %[[X]], %[[X]]
791 ; AVX-NEXT:    vmovss %xmm0, %[[X]], %xmm0
792 ; AVX-NEXT:    retq
793   %v = insertelement <4 x float> undef, float %a, i32 0
794   %shuffle = shufflevector <4 x float> %v, <4 x float> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
795   ret <4 x float> %shuffle
796 }
797
798 define <4 x float> @insert_mem_and_zero_v4f32(float* %ptr) {
799 ; ALL-LABEL: @insert_mem_and_zero_v4f32
800 ; ALL:       # BB#0:
801 ; ALL-NEXT:    movss (%rdi), %xmm0
802 ; ALL-NEXT:    retq
803   %a = load float* %ptr
804   %v = insertelement <4 x float> undef, float %a, i32 0
805   %shuffle = shufflevector <4 x float> %v, <4 x float> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
806   ret <4 x float> %shuffle
807 }