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
7 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
8 target triple = "x86_64-unknown-unknown"
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]
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
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]
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
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]
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
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]
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
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]
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
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]
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
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]
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
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]
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
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]
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
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]
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
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]
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
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]
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
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]
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
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]
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
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]
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
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]
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
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]
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
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]
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
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]
143 ; SSE3-LABEL: @shuffle_v4f32_0022
144 ; SSE3: movsldup {{.*}} # xmm0 = xmm0[0,0,2,2]
147 ; SSSE3-LABEL: @shuffle_v4f32_0022
148 ; SSSE3: movsldup {{.*}} # xmm0 = xmm0[0,0,2,2]
151 ; SSE41-LABEL: @shuffle_v4f32_0022
152 ; SSE41: movsldup {{.*}} # xmm0 = xmm0[0,0,2,2]
155 ; AVX1-LABEL: @shuffle_v4f32_0022
156 ; AVX1: vmovsldup {{.*}} # xmm0 = xmm0[0,0,2,2]
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
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]
166 ; SSE3-LABEL: @shuffle_v4f32_1133
167 ; SSE3: movshdup {{.*}} # xmm0 = xmm0[1,1,3,3]
170 ; SSSE3-LABEL: @shuffle_v4f32_1133
171 ; SSSE3: movshdup {{.*}} # xmm0 = xmm0[1,1,3,3]
174 ; SSE41-LABEL: @shuffle_v4f32_1133
175 ; SSE41: movshdup {{.*}} # xmm0 = xmm0[1,1,3,3]
178 ; AVX1-LABEL: @shuffle_v4f32_1133
179 ; AVX1: vmovshdup {{.*}} # xmm0 = xmm0[1,1,3,3]
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
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]
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]
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]
201 ; SSE41-LABEL: @shuffle_v4i32_0124
202 ; SSE41: insertps {{.*}} # xmm0 = xmm0[0,1,2],xmm1[0]
205 ; AVX1-LABEL: @shuffle_v4i32_0124
206 ; AVX1: vinsertps {{.*}} # xmm0 = xmm0[0,1,2],xmm1[0]
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
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]
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
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
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
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
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
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]
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
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
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
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
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
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]
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
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]
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
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]
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
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
304 ; SSE3-LABEL: @shuffle_v4i32_4501
305 ; SSE3: punpcklqdq {{.*}} # xmm1 = xmm1[0],xmm0[0]
306 ; SSE3-NEXT: movdqa %xmm1, %xmm0
309 ; SSSE3-LABEL: @shuffle_v4i32_4501
310 ; SSSE3: punpcklqdq {{.*}} # xmm1 = xmm1[0],xmm0[0]
311 ; SSSE3-NEXT: movdqa %xmm1, %xmm0
314 ; SSE41-LABEL: @shuffle_v4i32_4501
315 ; SSE41: punpcklqdq {{.*}} # xmm1 = xmm1[0],xmm0[0]
316 ; SSE41-NEXT: movdqa %xmm1, %xmm0
319 ; AVX1-LABEL: @shuffle_v4i32_4501
320 ; AVX1: punpcklqdq {{.*}} # xmm0 = xmm1[0],xmm0[0]
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
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]
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
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]
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]
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]
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
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]
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
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]
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]
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]
386 ; SSE41-LABEL: @shuffle_v4f32_z4zz
387 ; SSE41: insertps {{.*}} # xmm0 = zero,xmm0[0],zero,zero
390 ; AVX1-LABEL: @shuffle_v4f32_z4zz
391 ; AVX1: vinsertps {{.*}} # xmm0 = zero,xmm0[0],zero,zero
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
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
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
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
419 ; SSE41-LABEL: @shuffle_v4f32_zz4z
420 ; SSE41: insertps {{.*}} # xmm0 = zero,zero,xmm0[0],zero
423 ; AVX1-LABEL: @shuffle_v4f32_zz4z
424 ; AVX1: vinsertps {{.*}} # xmm0 = zero,zero,xmm0[0],zero
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
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
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
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
449 ; SSE41-LABEL: @shuffle_v4f32_zuu4
450 ; SSE41: insertps {{.*}} # xmm0 = zero,zero,zero,xmm0[0]
453 ; AVX1-LABEL: @shuffle_v4f32_zuu4
454 ; AVX1: vinsertps {{.*}} # xmm0 = zero,zero,zero,xmm0[0]
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
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
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
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
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
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]
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
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]
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]
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]
515 ; SSE41-LABEL: @shuffle_v4f32_z6zz
516 ; SSE41: insertps {{.*}} # xmm0 = zero,xmm0[2],zero,zero
519 ; AVX1-LABEL: @shuffle_v4f32_z6zz
520 ; AVX1: vinsertps {{.*}} # xmm0 = zero,xmm0[2],zero,zero
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
526 define <4 x i32> @shuffle_v4i32_4zzz(i32 %i) {
527 ; ALL-LABEL: @shuffle_v4i32_4zzz
528 ; ALL: movd {{.*}}, %xmm0
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
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]
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
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]
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
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]
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
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]
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
575 define <4 x i32> @shuffle_v4i32_7012(<4 x i32> %a, <4 x i32> %b) {
576 ; SSE2-LABEL: @shuffle_v4i32_7012
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
583 ; SSE3-LABEL: @shuffle_v4i32_7012
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
590 ; SSSE3-LABEL: @shuffle_v4i32_7012
592 ; SSSE3-NEXT: palignr $12, {{.*}} # xmm0 = xmm1[12,13,14,15],xmm0[0,1,2,3,4,5,6,7,8,9,10,11]
595 ; SSE41-LABEL: @shuffle_v4i32_7012
597 ; SSE41-NEXT: palignr $12, {{.*}} # xmm0 = xmm1[12,13,14,15],xmm0[0,1,2,3,4,5,6,7,8,9,10,11]
600 ; AVX1-LABEL: @shuffle_v4i32_7012
602 ; AVX1-NEXT: vpalignr $12, {{.*}} # xmm0 = xmm1[12,13,14,15],xmm0[0,1,2,3,4,5,6,7,8,9,10,11]
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
608 define <4 x i32> @shuffle_v4i32_6701(<4 x i32> %a, <4 x i32> %b) {
609 ; SSE2-LABEL: @shuffle_v4i32_6701
611 ; SSE2-NEXT: shufpd {{.*}} # xmm1 = xmm1[1],xmm0[0]
612 ; SSE2-NEXT: movapd %xmm1, %xmm0
615 ; SSE3-LABEL: @shuffle_v4i32_6701
617 ; SSE3-NEXT: shufpd {{.*}} # xmm1 = xmm1[1],xmm0[0]
618 ; SSE3-NEXT: movapd %xmm1, %xmm0
621 ; SSSE3-LABEL: @shuffle_v4i32_6701
623 ; SSSE3-NEXT: palignr $8, {{.*}} # xmm0 = xmm1[8,9,10,11,12,13,14,15],xmm0[0,1,2,3,4,5,6,7]
626 ; SSE41-LABEL: @shuffle_v4i32_6701
628 ; SSE41-NEXT: palignr $8, {{.*}} # xmm0 = xmm1[8,9,10,11,12,13,14,15],xmm0[0,1,2,3,4,5,6,7]
631 ; AVX1-LABEL: @shuffle_v4i32_6701
633 ; AVX1-NEXT: vpalignr $8, {{.*}} # xmm0 = xmm1[8,9,10,11,12,13,14,15],xmm0[0,1,2,3,4,5,6,7]
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
639 define <4 x i32> @shuffle_v4i32_5670(<4 x i32> %a, <4 x i32> %b) {
640 ; SSE2-LABEL: @shuffle_v4i32_5670
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
647 ; SSE3-LABEL: @shuffle_v4i32_5670
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
654 ; SSSE3-LABEL: @shuffle_v4i32_5670
656 ; SSSE3-NEXT: palignr $4, {{.*}} # xmm0 = xmm1[4,5,6,7,8,9,10,11,12,13,14,15],xmm0[0,1,2,3]
659 ; SSE41-LABEL: @shuffle_v4i32_5670
661 ; SSE41-NEXT: palignr $4, {{.*}} # xmm0 = xmm1[4,5,6,7,8,9,10,11,12,13,14,15],xmm0[0,1,2,3]
664 ; AVX1-LABEL: @shuffle_v4i32_5670
666 ; AVX1-NEXT: vpalignr $4, {{.*}} # xmm0 = xmm1[4,5,6,7,8,9,10,11,12,13,14,15],xmm0[0,1,2,3]
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
672 define <4 x i32> @shuffle_v4i32_1234(<4 x i32> %a, <4 x i32> %b) {
673 ; SSE2-LABEL: @shuffle_v4i32_1234
675 ; SSE2-NEXT: shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[3,0]
676 ; SSE2-NEXT: shufps {{.*}} # xmm0 = xmm0[1,2],xmm1[2,0]
679 ; SSE3-LABEL: @shuffle_v4i32_1234
681 ; SSE3-NEXT: shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[3,0]
682 ; SSE3-NEXT: shufps {{.*}} # xmm0 = xmm0[1,2],xmm1[2,0]
685 ; SSSE3-LABEL: @shuffle_v4i32_1234
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
691 ; SSE41-LABEL: @shuffle_v4i32_1234
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
697 ; AVX1-LABEL: @shuffle_v4i32_1234
699 ; AVX1-NEXT: vpalignr $4, {{.*}} # xmm0 = xmm0[4,5,6,7,8,9,10,11,12,13,14,15],xmm1[0,1,2,3]
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
705 define <4 x i32> @shuffle_v4i32_2345(<4 x i32> %a, <4 x i32> %b) {
706 ; SSE2-LABEL: @shuffle_v4i32_2345
708 ; SSE2-NEXT: shufpd {{.*}} # xmm0 = xmm0[1],xmm1[0]
711 ; SSE3-LABEL: @shuffle_v4i32_2345
713 ; SSE3-NEXT: shufpd {{.*}} # xmm0 = xmm0[1],xmm1[0]
716 ; SSSE3-LABEL: @shuffle_v4i32_2345
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
722 ; SSE41-LABEL: @shuffle_v4i32_2345
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
728 ; AVX1-LABEL: @shuffle_v4i32_2345
730 ; AVX1-NEXT: vpalignr $8, {{.*}} # xmm0 = xmm0[8,9,10,11,12,13,14,15],xmm1[0,1,2,3,4,5,6,7]
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
736 define <4 x i32> @shuffle_v4i32_3456(<4 x i32> %a, <4 x i32> %b) {
737 ; SSE2-LABEL: @shuffle_v4i32_3456
739 ; SSE2-NEXT: shufps {{.*}} # xmm0 = xmm0[3,0],xmm1[0,0]
740 ; SSE2-NEXT: shufps {{.*}} # xmm0 = xmm0[0,2],xmm1[1,2]
743 ; SSE3-LABEL: @shuffle_v4i32_3456
745 ; SSE3-NEXT: shufps {{.*}} # xmm0 = xmm0[3,0],xmm1[0,0]
746 ; SSE3-NEXT: shufps {{.*}} # xmm0 = xmm0[0,2],xmm1[1,2]
749 ; SSSE3-LABEL: @shuffle_v4i32_3456
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
755 ; SSE41-LABEL: @shuffle_v4i32_3456
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
761 ; AVX1-LABEL: @shuffle_v4i32_3456
763 ; AVX1-NEXT: vpalignr $12, {{.*}} # xmm0 = xmm0[12,13,14,15],xmm1[0,1,2,3,4,5,6,7,8,9,10,11]
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
769 define <4 x i32> @shuffle_v4i32_0u1u(<4 x i32> %a, <4 x i32> %b) {
770 ; ALL-LABEL: @shuffle_v4i32_0u1u
772 ; ALL-NEXT: pshufd {{.*}} # xmm0 = xmm0[0,0,1,1]
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
778 define <4 x i32> @shuffle_v4i32_0z1z(<4 x i32> %a) {
779 ; SSE2-LABEL: @shuffle_v4i32_0z1z
781 ; SSE2-NEXT: pxor %[[X:xmm[0-9]+]], %[[X]]
782 ; SSE2-NEXT: punpckldq {{.*}} # xmm0 = xmm0[0],[[X]][0],xmm0[1],[[X]][1]
785 ; SSE3-LABEL: @shuffle_v4i32_0z1z
787 ; SSE3-NEXT: pxor %[[X:xmm[0-9]+]], %[[X]]
788 ; SSE3-NEXT: punpckldq {{.*}} # xmm0 = xmm0[0],[[X]][0],xmm0[1],[[X]][1]
791 ; SSSE3-LABEL: @shuffle_v4i32_0z1z
793 ; SSSE3-NEXT: pxor %[[X:xmm[0-9]+]], %[[X]]
794 ; SSSE3-NEXT: punpckldq {{.*}} # xmm0 = xmm0[0],[[X]][0],xmm0[1],[[X]][1]
797 ; SSE41-LABEL: @shuffle_v4i32_0z1z
799 ; SSE41-NEXT: pmovzxdq %xmm0, %xmm0
802 ; AVX1-LABEL: @shuffle_v4i32_0z1z
804 ; AVX1-NEXT: vpmovzxdq %xmm0, %xmm0
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