blob: 21d74928ebf479187768730468be3b871aa95c04 [file] [log] [blame]
Chandler Carruthbfc6b952014-09-03 19:39:10 +00001; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -x86-experimental-vector-shuffle-lowering | FileCheck %s --check-prefix=ALL --check-prefix=SSE2
Chandler Carruth00b1e0f2014-09-15 11:40:20 +00002; 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
Chandler Carruthe0d77ef2014-09-18 04:38:32 +00003; 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
Chandler Carruthc1e8ebc2014-09-03 20:39:06 +00004; 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
Chandler Carruthbfc6b952014-09-03 19:39:10 +00005; 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
Chandler Carruth83860cf2014-06-27 11:23:44 +00006
7target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
8target triple = "x86_64-unknown-unknown"
9
10define <4 x i32> @shuffle_v4i32_0001(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000011; ALL-LABEL: @shuffle_v4i32_0001
12; ALL: pshufd {{.*}} # xmm0 = xmm0[0,0,0,1]
13; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +000014 %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}
17define <4 x i32> @shuffle_v4i32_0020(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000018; ALL-LABEL: @shuffle_v4i32_0020
19; ALL: pshufd {{.*}} # xmm0 = xmm0[0,0,2,0]
20; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +000021 %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}
Chandler Carruth27046752014-08-07 08:11:31 +000024define <4 x i32> @shuffle_v4i32_0112(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000025; ALL-LABEL: @shuffle_v4i32_0112
26; ALL: pshufd {{.*}} # xmm0 = xmm0[0,1,1,2]
27; ALL-NEXT: retq
Chandler Carruth27046752014-08-07 08:11:31 +000028 %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}
Chandler Carruth83860cf2014-06-27 11:23:44 +000031define <4 x i32> @shuffle_v4i32_0300(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000032; ALL-LABEL: @shuffle_v4i32_0300
33; ALL: pshufd {{.*}} # xmm0 = xmm0[0,3,0,0]
34; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +000035 %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}
38define <4 x i32> @shuffle_v4i32_1000(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000039; ALL-LABEL: @shuffle_v4i32_1000
40; ALL: pshufd {{.*}} # xmm0 = xmm0[1,0,0,0]
41; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +000042 %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}
45define <4 x i32> @shuffle_v4i32_2200(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000046; ALL-LABEL: @shuffle_v4i32_2200
47; ALL: pshufd {{.*}} # xmm0 = xmm0[2,2,0,0]
48; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +000049 %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}
52define <4 x i32> @shuffle_v4i32_3330(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000053; ALL-LABEL: @shuffle_v4i32_3330
54; ALL: pshufd {{.*}} # xmm0 = xmm0[3,3,3,0]
55; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +000056 %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}
59define <4 x i32> @shuffle_v4i32_3210(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000060; ALL-LABEL: @shuffle_v4i32_3210
61; ALL: pshufd {{.*}} # xmm0 = xmm0[3,2,1,0]
62; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +000063 %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
Chandler Carruth17fd8482014-08-15 03:54:49 +000067define <4 x i32> @shuffle_v4i32_2121(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000068; ALL-LABEL: @shuffle_v4i32_2121
69; ALL: pshufd {{.*}} # xmm0 = xmm0[2,1,2,1]
70; ALL-NEXT: retq
Chandler Carruth17fd8482014-08-15 03:54:49 +000071 %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
Chandler Carruth83860cf2014-06-27 11:23:44 +000075define <4 x float> @shuffle_v4f32_0001(<4 x float> %a, <4 x float> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000076; ALL-LABEL: @shuffle_v4f32_0001
77; ALL: shufps {{.*}} # xmm0 = xmm0[0,0,0,1]
78; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +000079 %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}
82define <4 x float> @shuffle_v4f32_0020(<4 x float> %a, <4 x float> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000083; ALL-LABEL: @shuffle_v4f32_0020
84; ALL: shufps {{.*}} # xmm0 = xmm0[0,0,2,0]
85; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +000086 %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}
89define <4 x float> @shuffle_v4f32_0300(<4 x float> %a, <4 x float> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000090; ALL-LABEL: @shuffle_v4f32_0300
91; ALL: shufps {{.*}} # xmm0 = xmm0[0,3,0,0]
92; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +000093 %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}
96define <4 x float> @shuffle_v4f32_1000(<4 x float> %a, <4 x float> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000097; ALL-LABEL: @shuffle_v4f32_1000
98; ALL: shufps {{.*}} # xmm0 = xmm0[1,0,0,0]
99; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +0000100 %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}
103define <4 x float> @shuffle_v4f32_2200(<4 x float> %a, <4 x float> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +0000104; ALL-LABEL: @shuffle_v4f32_2200
105; ALL: shufps {{.*}} # xmm0 = xmm0[2,2,0,0]
106; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +0000107 %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}
110define <4 x float> @shuffle_v4f32_3330(<4 x float> %a, <4 x float> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +0000111; ALL-LABEL: @shuffle_v4f32_3330
112; ALL: shufps {{.*}} # xmm0 = xmm0[3,3,3,0]
113; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +0000114 %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}
117define <4 x float> @shuffle_v4f32_3210(<4 x float> %a, <4 x float> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +0000118; ALL-LABEL: @shuffle_v4f32_3210
119; ALL: shufps {{.*}} # xmm0 = xmm0[3,2,1,0]
120; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +0000121 %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}
Chandler Carruth12d4a702014-09-15 11:26:25 +0000124define <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}
131define <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}
Chandler Carruth41a25dd2014-09-15 11:15:23 +0000138define <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;
Chandler Carruth00b1e0f2014-09-15 11:40:20 +0000143; SSE3-LABEL: @shuffle_v4f32_0022
144; SSE3: movsldup {{.*}} # xmm0 = xmm0[0,0,2,2]
145; SSE3-NEXT: retq
146;
Chandler Carruthe0d77ef2014-09-18 04:38:32 +0000147; SSSE3-LABEL: @shuffle_v4f32_0022
148; SSSE3: movsldup {{.*}} # xmm0 = xmm0[0,0,2,2]
149; SSSE3-NEXT: retq
150;
Chandler Carruth41a25dd2014-09-15 11:15:23 +0000151; 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}
161define <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;
Chandler Carruth00b1e0f2014-09-15 11:40:20 +0000166; SSE3-LABEL: @shuffle_v4f32_1133
167; SSE3: movshdup {{.*}} # xmm0 = xmm0[1,1,3,3]
168; SSE3-NEXT: retq
169;
Chandler Carruthe0d77ef2014-09-18 04:38:32 +0000170; SSSE3-LABEL: @shuffle_v4f32_1133
171; SSSE3: movshdup {{.*}} # xmm0 = xmm0[1,1,3,3]
172; SSSE3-NEXT: retq
173;
Chandler Carruth41a25dd2014-09-15 11:15:23 +0000174; 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}
Chandler Carruth83860cf2014-06-27 11:23:44 +0000184
185define <4 x i32> @shuffle_v4i32_0124(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthdad54002014-09-03 22:48:34 +0000186; 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;
Chandler Carruth00b1e0f2014-09-15 11:40:20 +0000191; 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;
Chandler Carruthe0d77ef2014-09-18 04:38:32 +0000196; 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;
Chandler Carruthdad54002014-09-03 22:48:34 +0000201; 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
Chandler Carruth83860cf2014-06-27 11:23:44 +0000208 %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}
211define <4 x i32> @shuffle_v4i32_0142(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +0000212; 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
Chandler Carruth83860cf2014-06-27 11:23:44 +0000216 %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}
219define <4 x i32> @shuffle_v4i32_0412(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +0000220; 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;
Chandler Carruth00b1e0f2014-09-15 11:40:20 +0000226; 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;
Chandler Carruthe0d77ef2014-09-18 04:38:32 +0000232; 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;
Chandler Carruth00b1e0f2014-09-15 11:40:20 +0000238; 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;
Chandler Carruthbfc6b952014-09-03 19:39:10 +0000244; 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
Chandler Carruth83860cf2014-06-27 11:23:44 +0000248 %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}
251define <4 x i32> @shuffle_v4i32_4012(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +0000252; 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;
Chandler Carruth00b1e0f2014-09-15 11:40:20 +0000258; 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;
Chandler Carruthe0d77ef2014-09-18 04:38:32 +0000264; 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;
Chandler Carruth00b1e0f2014-09-15 11:40:20 +0000270; 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;
Chandler Carruthbfc6b952014-09-03 19:39:10 +0000276; 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
Chandler Carruth83860cf2014-06-27 11:23:44 +0000280 %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}
283define <4 x i32> @shuffle_v4i32_0145(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +0000284; ALL-LABEL: @shuffle_v4i32_0145
285; ALL: punpcklqdq {{.*}} # xmm0 = xmm0[0],xmm1[0]
286; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +0000287 %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}
290define <4 x i32> @shuffle_v4i32_0451(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +0000291; 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
Chandler Carruth83860cf2014-06-27 11:23:44 +0000295 %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}
298define <4 x i32> @shuffle_v4i32_4501(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +0000299; SSE2-LABEL: @shuffle_v4i32_4501
300; SSE2: punpcklqdq {{.*}} # xmm1 = xmm1[0],xmm0[0]
301; SSE2-NEXT: movdqa %xmm1, %xmm0
302; SSE2-NEXT: retq
303;
Chandler Carruth00b1e0f2014-09-15 11:40:20 +0000304; SSE3-LABEL: @shuffle_v4i32_4501
305; SSE3: punpcklqdq {{.*}} # xmm1 = xmm1[0],xmm0[0]
306; SSE3-NEXT: movdqa %xmm1, %xmm0
307; SSE3-NEXT: retq
308;
Chandler Carruthe0d77ef2014-09-18 04:38:32 +0000309; SSSE3-LABEL: @shuffle_v4i32_4501
310; SSSE3: punpcklqdq {{.*}} # xmm1 = xmm1[0],xmm0[0]
311; SSSE3-NEXT: movdqa %xmm1, %xmm0
312; SSSE3-NEXT: retq
313;
Chandler Carruth00b1e0f2014-09-15 11:40:20 +0000314; SSE41-LABEL: @shuffle_v4i32_4501
315; SSE41: punpcklqdq {{.*}} # xmm1 = xmm1[0],xmm0[0]
316; SSE41-NEXT: movdqa %xmm1, %xmm0
317; SSE41-NEXT: retq
318;
Chandler Carruthbfc6b952014-09-03 19:39:10 +0000319; AVX1-LABEL: @shuffle_v4i32_4501
320; AVX1: punpcklqdq {{.*}} # xmm0 = xmm1[0],xmm0[0]
321; AVX1-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +0000322 %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}
325define <4 x i32> @shuffle_v4i32_4015(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +0000326; 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
Chandler Carruth83860cf2014-06-27 11:23:44 +0000330 %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}
Chandler Carruthfc0db222014-09-04 01:13:48 +0000333
334define <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;
Chandler Carruth00b1e0f2014-09-15 11:40:20 +0000341; 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;
Chandler Carruthe0d77ef2014-09-18 04:38:32 +0000347; 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;
Chandler Carruthfc0db222014-09-04 01:13:48 +0000353; SSE41-LABEL: @shuffle_v4f32_4zzz
Chandler Carruth0a987902014-09-14 23:43:33 +0000354; SSE41: xorps %[[X:xmm[0-9]+]], %[[X]]
355; SSE41-NEXT: blendps {{.*}} # [[X]] = xmm0[0],[[X]][1,2,3]
356; SSE41-NEXT: movaps %[[X]], %xmm0
Chandler Carruthfc0db222014-09-04 01:13:48 +0000357; SSE41-NEXT: retq
358;
359; AVX1-LABEL: @shuffle_v4f32_4zzz
Chandler Carruth0a987902014-09-14 23:43:33 +0000360; AVX1: vxorps %[[X:xmm[0-9]+]], %[[X]]
361; AVX1-NEXT: vblendps {{.*}} # xmm0 = xmm0[0],[[X]][1,2,3]
Chandler Carruthfc0db222014-09-04 01:13:48 +0000362; 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
367define <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;
Chandler Carruth00b1e0f2014-09-15 11:40:20 +0000374; 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;
Chandler Carruthe0d77ef2014-09-18 04:38:32 +0000380; 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;
Chandler Carruthfc0db222014-09-04 01:13:48 +0000386; 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
397define <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;
Chandler Carruth00b1e0f2014-09-15 11:40:20 +0000405; 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;
Chandler Carruthe0d77ef2014-09-18 04:38:32 +0000412; 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;
Chandler Carruthfc0db222014-09-04 01:13:48 +0000419; 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
430define <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;
Chandler Carruth00b1e0f2014-09-15 11:40:20 +0000437; 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;
Chandler Carruthe0d77ef2014-09-18 04:38:32 +0000443; 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;
Chandler Carruthfc0db222014-09-04 01:13:48 +0000449; 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
460define <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;
Chandler Carruth00b1e0f2014-09-15 11:40:20 +0000468; 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;
Chandler Carruthe0d77ef2014-09-18 04:38:32 +0000475; 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;
Chandler Carruthfc0db222014-09-04 01:13:48 +0000482; SSE41-LABEL: @shuffle_v4f32_zzz7
Chandler Carruth0a987902014-09-14 23:43:33 +0000483; SSE41: xorps %[[X:xmm[0-9]+]], %[[X]]
484; SSE41-NEXT: blendps {{.*}} # [[X]] = [[X]][0,1,2],xmm0[3]
485; SSE41-NEXT: movaps %[[X]], %xmm0
Chandler Carruthfc0db222014-09-04 01:13:48 +0000486; SSE41-NEXT: retq
487;
488; AVX1-LABEL: @shuffle_v4f32_zzz7
Chandler Carruth0a987902014-09-14 23:43:33 +0000489; AVX1: vxorps %[[X:xmm[0-9]+]], %[[X]]
490; AVX1-NEXT: vblendps {{.*}} # xmm0 = [[X]][0,1,2],xmm0[3]
Chandler Carruthfc0db222014-09-04 01:13:48 +0000491; 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
496define <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;
Chandler Carruth00b1e0f2014-09-15 11:40:20 +0000503; 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;
Chandler Carruthe0d77ef2014-09-18 04:38:32 +0000509; 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;
Chandler Carruthfc0db222014-09-04 01:13:48 +0000515; 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}
Chandler Carruth2e5134f2014-09-04 09:26:30 +0000525
526define <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
535define <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
545define <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
555define <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
565define <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}
Chandler Carruth9057fca2014-09-18 09:00:25 +0000574
575define <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
608define <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
639define <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
672define <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
705define <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
736define <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}
Chandler Carruth2e275142014-09-19 08:37:44 +0000768
769define <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
778define <4 x i32> @shuffle_v4i32_0z1z(<4 x i32> %a) {
779; SSE2-LABEL: @shuffle_v4i32_0z1z
780; SSE2: # BB#0:
781; SSE2-NEXT: xorps %[[X:xmm[0-9]+]], %[[X]]
782; SSE2-NEXT: shufps {{.*}} # xmm0 = xmm0[0,1],[[X]][1,3]
783; SSE2-NEXT: shufps {{.*}} # xmm0 = xmm0[0,2,1,3]
784; SSE2-NEXT: retq
785;
786; SSE3-LABEL: @shuffle_v4i32_0z1z
787; SSE3: # BB#0:
788; SSE3-NEXT: xorps %[[X:xmm[0-9]+]], %[[X]]
789; SSE3-NEXT: shufps {{.*}} # xmm0 = xmm0[0,1],[[X]][1,3]
790; SSE3-NEXT: shufps {{.*}} # xmm0 = xmm0[0,2,1,3]
791; SSE3-NEXT: retq
792;
793; SSSE3-LABEL: @shuffle_v4i32_0z1z
794; SSSE3: # BB#0:
795; SSSE3-NEXT: xorps %[[X:xmm[0-9]+]], %[[X]]
796; SSSE3-NEXT: shufps {{.*}} # xmm0 = xmm0[0,1],[[X]][1,3]
797; SSSE3-NEXT: shufps {{.*}} # xmm0 = xmm0[0,2,1,3]
798; SSSE3-NEXT: retq
799;
800; SSE41-LABEL: @shuffle_v4i32_0z1z
801; SSE41: # BB#0:
802; SSE41-NEXT: pmovzxdq %xmm0, %xmm0
803; SSE41-NEXT: retq
804;
805; AVX1-LABEL: @shuffle_v4i32_0z1z
806; AVX1: # BB#0:
807; AVX1-NEXT: vpmovzxdq %xmm0, %xmm0
808; AVX1-NEXT: retq
809 %shuffle = shufflevector <4 x i32> %a, <4 x i32> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 1, i32 7>
810 ret <4 x i32> %shuffle
811}