blob: 9105197f67c035d00d2df5706fa1fccb5286cb78 [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 Carruthc1e8ebc2014-09-03 20:39:06 +00002; 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 +00003; 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 +00004
5target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
6target triple = "x86_64-unknown-unknown"
7
8define <4 x i32> @shuffle_v4i32_0001(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +00009; ALL-LABEL: @shuffle_v4i32_0001
10; ALL: pshufd {{.*}} # xmm0 = xmm0[0,0,0,1]
11; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +000012 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 0, i32 0, i32 1>
13 ret <4 x i32> %shuffle
14}
15define <4 x i32> @shuffle_v4i32_0020(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000016; ALL-LABEL: @shuffle_v4i32_0020
17; ALL: pshufd {{.*}} # xmm0 = xmm0[0,0,2,0]
18; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +000019 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 0, i32 2, i32 0>
20 ret <4 x i32> %shuffle
21}
Chandler Carruth27046752014-08-07 08:11:31 +000022define <4 x i32> @shuffle_v4i32_0112(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000023; ALL-LABEL: @shuffle_v4i32_0112
24; ALL: pshufd {{.*}} # xmm0 = xmm0[0,1,1,2]
25; ALL-NEXT: retq
Chandler Carruth27046752014-08-07 08:11:31 +000026 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 1, i32 2>
27 ret <4 x i32> %shuffle
28}
Chandler Carruth83860cf2014-06-27 11:23:44 +000029define <4 x i32> @shuffle_v4i32_0300(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000030; ALL-LABEL: @shuffle_v4i32_0300
31; ALL: pshufd {{.*}} # xmm0 = xmm0[0,3,0,0]
32; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +000033 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 3, i32 0, i32 0>
34 ret <4 x i32> %shuffle
35}
36define <4 x i32> @shuffle_v4i32_1000(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000037; ALL-LABEL: @shuffle_v4i32_1000
38; ALL: pshufd {{.*}} # xmm0 = xmm0[1,0,0,0]
39; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +000040 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 1, i32 0, i32 0, i32 0>
41 ret <4 x i32> %shuffle
42}
43define <4 x i32> @shuffle_v4i32_2200(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000044; ALL-LABEL: @shuffle_v4i32_2200
45; ALL: pshufd {{.*}} # xmm0 = xmm0[2,2,0,0]
46; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +000047 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 2, i32 2, i32 0, i32 0>
48 ret <4 x i32> %shuffle
49}
50define <4 x i32> @shuffle_v4i32_3330(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000051; ALL-LABEL: @shuffle_v4i32_3330
52; ALL: pshufd {{.*}} # xmm0 = xmm0[3,3,3,0]
53; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +000054 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 3, i32 3, i32 3, i32 0>
55 ret <4 x i32> %shuffle
56}
57define <4 x i32> @shuffle_v4i32_3210(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000058; ALL-LABEL: @shuffle_v4i32_3210
59; ALL: pshufd {{.*}} # xmm0 = xmm0[3,2,1,0]
60; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +000061 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
62 ret <4 x i32> %shuffle
63}
64
Chandler Carruth17fd8482014-08-15 03:54:49 +000065define <4 x i32> @shuffle_v4i32_2121(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000066; ALL-LABEL: @shuffle_v4i32_2121
67; ALL: pshufd {{.*}} # xmm0 = xmm0[2,1,2,1]
68; ALL-NEXT: retq
Chandler Carruth17fd8482014-08-15 03:54:49 +000069 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 2, i32 1, i32 2, i32 1>
70 ret <4 x i32> %shuffle
71}
72
Chandler Carruth83860cf2014-06-27 11:23:44 +000073define <4 x float> @shuffle_v4f32_0001(<4 x float> %a, <4 x float> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000074; ALL-LABEL: @shuffle_v4f32_0001
75; ALL: shufps {{.*}} # xmm0 = xmm0[0,0,0,1]
76; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +000077 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 0, i32 0, i32 1>
78 ret <4 x float> %shuffle
79}
80define <4 x float> @shuffle_v4f32_0020(<4 x float> %a, <4 x float> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000081; ALL-LABEL: @shuffle_v4f32_0020
82; ALL: shufps {{.*}} # xmm0 = xmm0[0,0,2,0]
83; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +000084 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 0, i32 2, i32 0>
85 ret <4 x float> %shuffle
86}
87define <4 x float> @shuffle_v4f32_0300(<4 x float> %a, <4 x float> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000088; ALL-LABEL: @shuffle_v4f32_0300
89; ALL: shufps {{.*}} # xmm0 = xmm0[0,3,0,0]
90; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +000091 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 3, i32 0, i32 0>
92 ret <4 x float> %shuffle
93}
94define <4 x float> @shuffle_v4f32_1000(<4 x float> %a, <4 x float> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +000095; ALL-LABEL: @shuffle_v4f32_1000
96; ALL: shufps {{.*}} # xmm0 = xmm0[1,0,0,0]
97; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +000098 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 1, i32 0, i32 0, i32 0>
99 ret <4 x float> %shuffle
100}
101define <4 x float> @shuffle_v4f32_2200(<4 x float> %a, <4 x float> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +0000102; ALL-LABEL: @shuffle_v4f32_2200
103; ALL: shufps {{.*}} # xmm0 = xmm0[2,2,0,0]
104; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +0000105 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 2, i32 2, i32 0, i32 0>
106 ret <4 x float> %shuffle
107}
108define <4 x float> @shuffle_v4f32_3330(<4 x float> %a, <4 x float> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +0000109; ALL-LABEL: @shuffle_v4f32_3330
110; ALL: shufps {{.*}} # xmm0 = xmm0[3,3,3,0]
111; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +0000112 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 3, i32 3, i32 3, i32 0>
113 ret <4 x float> %shuffle
114}
115define <4 x float> @shuffle_v4f32_3210(<4 x float> %a, <4 x float> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +0000116; ALL-LABEL: @shuffle_v4f32_3210
117; ALL: shufps {{.*}} # xmm0 = xmm0[3,2,1,0]
118; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +0000119 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
120 ret <4 x float> %shuffle
121}
122
123define <4 x i32> @shuffle_v4i32_0124(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthdad54002014-09-03 22:48:34 +0000124; SSE2-LABEL: @shuffle_v4i32_0124
125; SSE2: shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[2,0]
126; SSE2-NEXT: shufps {{.*}} # xmm0 = xmm0[0,1],xmm1[2,0]
127; SSE2-NEXT: retq
128;
129; SSE41-LABEL: @shuffle_v4i32_0124
130; SSE41: insertps {{.*}} # xmm0 = xmm0[0,1,2],xmm1[0]
131; SSE41-NEXT: retq
132;
133; AVX1-LABEL: @shuffle_v4i32_0124
134; AVX1: vinsertps {{.*}} # xmm0 = xmm0[0,1,2],xmm1[0]
135; AVX1-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +0000136 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 2, i32 4>
137 ret <4 x i32> %shuffle
138}
139define <4 x i32> @shuffle_v4i32_0142(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +0000140; ALL-LABEL: @shuffle_v4i32_0142
141; ALL: shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[2,0]
142; ALL-NEXT: shufps {{.*}} # xmm0 = xmm0[0,1],xmm1[0,2]
143; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +0000144 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 4, i32 2>
145 ret <4 x i32> %shuffle
146}
147define <4 x i32> @shuffle_v4i32_0412(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +0000148; SSE2-LABEL: @shuffle_v4i32_0412
149; SSE2: shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[0,0]
150; SSE2-NEXT: shufps {{.*}} # xmm1 = xmm1[2,0],xmm0[1,2]
151; SSE2-NEXT: movaps %xmm1, %xmm0
152; SSE2-NEXT: retq
153;
154; AVX1-LABEL: @shuffle_v4i32_0412
155; AVX1: vshufps {{.*}} # xmm1 = xmm1[0,0],xmm0[0,0]
156; AVX1-NEXT: vshufps {{.*}} # xmm0 = xmm1[2,0],xmm0[1,2]
157; AVX1-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +0000158 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 1, i32 2>
159 ret <4 x i32> %shuffle
160}
161define <4 x i32> @shuffle_v4i32_4012(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +0000162; SSE2-LABEL: @shuffle_v4i32_4012
163; SSE2: shufps {{.*}} # xmm1 = xmm1[0,0],xmm0[0,0]
164; SSE2-NEXT: shufps {{.*}} # xmm1 = xmm1[0,2],xmm0[1,2]
165; SSE2-NEXT: movaps %xmm1, %xmm0
166; SSE2-NEXT: retq
167;
168; AVX1-LABEL: @shuffle_v4i32_4012
169; AVX1: vshufps {{.*}} # xmm1 = xmm1[0,0],xmm0[0,0]
170; AVX1-NEXT: vshufps {{.*}} # xmm0 = xmm1[0,2],xmm0[1,2]
171; AVX1-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +0000172 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 0, i32 1, i32 2>
173 ret <4 x i32> %shuffle
174}
175define <4 x i32> @shuffle_v4i32_0145(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +0000176; ALL-LABEL: @shuffle_v4i32_0145
177; ALL: punpcklqdq {{.*}} # xmm0 = xmm0[0],xmm1[0]
178; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +0000179 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
180 ret <4 x i32> %shuffle
181}
182define <4 x i32> @shuffle_v4i32_0451(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +0000183; ALL-LABEL: @shuffle_v4i32_0451
184; ALL: shufps {{.*}} # xmm0 = xmm0[0,1],xmm1[0,1]
185; ALL-NEXT: shufps {{.*}} # xmm0 = xmm0[0,2,3,1]
186; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +0000187 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 5, i32 1>
188 ret <4 x i32> %shuffle
189}
190define <4 x i32> @shuffle_v4i32_4501(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +0000191; SSE2-LABEL: @shuffle_v4i32_4501
192; SSE2: punpcklqdq {{.*}} # xmm1 = xmm1[0],xmm0[0]
193; SSE2-NEXT: movdqa %xmm1, %xmm0
194; SSE2-NEXT: retq
195;
196; AVX1-LABEL: @shuffle_v4i32_4501
197; AVX1: punpcklqdq {{.*}} # xmm0 = xmm1[0],xmm0[0]
198; AVX1-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +0000199 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 5, i32 0, i32 1>
200 ret <4 x i32> %shuffle
201}
202define <4 x i32> @shuffle_v4i32_4015(<4 x i32> %a, <4 x i32> %b) {
Chandler Carruthbfc6b952014-09-03 19:39:10 +0000203; ALL-LABEL: @shuffle_v4i32_4015
204; ALL: shufps {{.*}} # xmm0 = xmm0[0,1],xmm1[0,1]
205; ALL-NEXT: shufps {{.*}} # xmm0 = xmm0[2,0,1,3]
206; ALL-NEXT: retq
Chandler Carruth83860cf2014-06-27 11:23:44 +0000207 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 0, i32 1, i32 5>
208 ret <4 x i32> %shuffle
209}
Chandler Carruthfc0db222014-09-04 01:13:48 +0000210
211define <4 x float> @shuffle_v4f32_4zzz(<4 x float> %a) {
212; SSE2-LABEL: @shuffle_v4f32_4zzz
213; SSE2: xorps %[[X:xmm[0-9]+]], %[[X]]
214; SSE2-NEXT: shufps {{.*}} # xmm0 = xmm0[0,0],[[X]][1,0]
215; SSE2-NEXT: shufps {{.*}} # xmm0 = xmm0[0,2],[[X]][2,3]
216; SSE2-NEXT: retq
217;
218; SSE41-LABEL: @shuffle_v4f32_4zzz
219; SSE41: insertps {{.*}} # xmm0 = xmm0[0],zero,zero,zero
220; SSE41-NEXT: retq
221;
222; AVX1-LABEL: @shuffle_v4f32_4zzz
223; AVX1: vinsertps {{.*}} # xmm0 = xmm0[0],zero,zero,zero
224; AVX1-NEXT: retq
225 %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 4, i32 1, i32 2, i32 3>
226 ret <4 x float> %shuffle
227}
228
229define <4 x float> @shuffle_v4f32_z4zz(<4 x float> %a) {
230; SSE2-LABEL: @shuffle_v4f32_z4zz
231; SSE2: xorps %[[X:xmm[0-9]+]], %[[X]]
232; SSE2-NEXT: shufps {{.*}} # xmm0 = xmm0[0,0],[[X]][2,0]
233; SSE2-NEXT: shufps {{.*}} # xmm0 = xmm0[2,0],[[X]][3,0]
234; SSE2-NEXT: retq
235;
236; SSE41-LABEL: @shuffle_v4f32_z4zz
237; SSE41: insertps {{.*}} # xmm0 = zero,xmm0[0],zero,zero
238; SSE41-NEXT: retq
239;
240; AVX1-LABEL: @shuffle_v4f32_z4zz
241; AVX1: vinsertps {{.*}} # xmm0 = zero,xmm0[0],zero,zero
242; AVX1-NEXT: retq
243 %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 2, i32 4, i32 3, i32 0>
244 ret <4 x float> %shuffle
245}
246
247define <4 x float> @shuffle_v4f32_zz4z(<4 x float> %a) {
248; SSE2-LABEL: @shuffle_v4f32_zz4z
249; SSE2: xorps %[[X:xmm[0-9]+]], %[[X]]
250; SSE2-NEXT: shufps {{.*}} # xmm0 = xmm0[0,0],[[X]][0,0]
251; SSE2-NEXT: shufps {{.*}} # [[X]] = [[X]][0,0],xmm0[0,2]
252; SSE2-NEXT: movaps %[[X]], %xmm0
253; SSE2-NEXT: retq
254;
255; SSE41-LABEL: @shuffle_v4f32_zz4z
256; SSE41: insertps {{.*}} # xmm0 = zero,zero,xmm0[0],zero
257; SSE41-NEXT: retq
258;
259; AVX1-LABEL: @shuffle_v4f32_zz4z
260; AVX1: vinsertps {{.*}} # xmm0 = zero,zero,xmm0[0],zero
261; AVX1-NEXT: retq
262 %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 0, i32 0, i32 4, i32 0>
263 ret <4 x float> %shuffle
264}
265
266define <4 x float> @shuffle_v4f32_zuu4(<4 x float> %a) {
267; SSE2-LABEL: @shuffle_v4f32_zuu4
268; SSE2: xorps %[[X:xmm[0-9]+]], %[[X]]
269; SSE2-NEXT: shufps {{.*}} # [[X]] = [[X]][0,1],xmm0[2,0]
270; SSE2-NEXT: movaps %[[X]], %xmm0
271; SSE2-NEXT: retq
272;
273; SSE41-LABEL: @shuffle_v4f32_zuu4
274; SSE41: insertps {{.*}} # xmm0 = zero,zero,zero,xmm0[0]
275; SSE41-NEXT: retq
276;
277; AVX1-LABEL: @shuffle_v4f32_zuu4
278; AVX1: vinsertps {{.*}} # xmm0 = zero,zero,zero,xmm0[0]
279; AVX1-NEXT: retq
280 %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 0, i32 undef, i32 undef, i32 4>
281 ret <4 x float> %shuffle
282}
283
284define <4 x float> @shuffle_v4f32_zzz7(<4 x float> %a) {
285; SSE2-LABEL: @shuffle_v4f32_zzz7
286; SSE2: xorps %[[X:xmm[0-9]+]], %[[X]]
287; SSE2-NEXT: shufps {{.*}} # xmm0 = xmm0[3,0],[[X]][2,0]
288; SSE2-NEXT: shufps {{.*}} # [[X]] = [[X]][0,1],xmm0[2,0]
289; SSE2-NEXT: movaps %[[X]], %xmm0
290; SSE2-NEXT: retq
291;
292; SSE41-LABEL: @shuffle_v4f32_zzz7
293; SSE41: insertps {{.*}} # xmm0 = zero,zero,zero,xmm0[3]
294; SSE41-NEXT: retq
295;
296; AVX1-LABEL: @shuffle_v4f32_zzz7
297; AVX1: vinsertps {{.*}} # xmm0 = zero,zero,zero,xmm0[3]
298; AVX1-NEXT: retq
299 %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
300 ret <4 x float> %shuffle
301}
302
303define <4 x float> @shuffle_v4f32_z6zz(<4 x float> %a) {
304; SSE2-LABEL: @shuffle_v4f32_z6zz
305; SSE2: xorps %[[X:xmm[0-9]+]], %[[X]]
306; SSE2-NEXT: shufps {{.*}} # xmm0 = xmm0[2,0],[[X]][0,0]
307; SSE2-NEXT: shufps {{.*}} # xmm0 = xmm0[2,0],[[X]][2,3]
308; SSE2-NEXT: retq
309;
310; SSE41-LABEL: @shuffle_v4f32_z6zz
311; SSE41: insertps {{.*}} # xmm0 = zero,xmm0[2],zero,zero
312; SSE41-NEXT: retq
313;
314; AVX1-LABEL: @shuffle_v4f32_z6zz
315; AVX1: vinsertps {{.*}} # xmm0 = zero,xmm0[2],zero,zero
316; AVX1-NEXT: retq
317 %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 0, i32 6, i32 2, i32 3>
318 ret <4 x float> %shuffle
319}
Chandler Carruth2e5134f2014-09-04 09:26:30 +0000320
321define <4 x i32> @shuffle_v4i32_4zzz(i32 %i) {
322; ALL-LABEL: @shuffle_v4i32_4zzz
323; ALL: movd {{.*}}, %xmm0
324; ALL-NEXT: retq
325 %a = insertelement <4 x i32> undef, i32 %i, i32 0
326 %shuffle = shufflevector <4 x i32> zeroinitializer, <4 x i32> %a, <4 x i32> <i32 4, i32 1, i32 2, i32 3>
327 ret <4 x i32> %shuffle
328}
329
330define <4 x i32> @shuffle_v4i32_z4zz(i32 %i) {
331; ALL-LABEL: @shuffle_v4i32_z4zz
332; ALL: movd {{.*}}, %xmm0
333; ALL-NEXT: pshufd {{.*}} # xmm0 = xmm0[1,0,1,1]
334; ALL-NEXT: retq
335 %a = insertelement <4 x i32> undef, i32 %i, i32 0
336 %shuffle = shufflevector <4 x i32> zeroinitializer, <4 x i32> %a, <4 x i32> <i32 2, i32 4, i32 3, i32 0>
337 ret <4 x i32> %shuffle
338}
339
340define <4 x i32> @shuffle_v4i32_zz4z(i32 %i) {
341; ALL-LABEL: @shuffle_v4i32_zz4z
342; ALL: movd {{.*}}, %xmm0
343; ALL-NEXT: pshufd {{.*}} # xmm0 = xmm0[1,1,0,1]
344; ALL-NEXT: retq
345 %a = insertelement <4 x i32> undef, i32 %i, i32 0
346 %shuffle = shufflevector <4 x i32> zeroinitializer, <4 x i32> %a, <4 x i32> <i32 0, i32 0, i32 4, i32 0>
347 ret <4 x i32> %shuffle
348}
349
350define <4 x i32> @shuffle_v4i32_zuu4(i32 %i) {
351; ALL-LABEL: @shuffle_v4i32_zuu4
352; ALL: movd {{.*}}, %xmm0
353; ALL-NEXT: pshufd {{.*}} # xmm0 = xmm0[1,1,1,0]
354; ALL-NEXT: retq
355 %a = insertelement <4 x i32> undef, i32 %i, i32 0
356 %shuffle = shufflevector <4 x i32> zeroinitializer, <4 x i32> %a, <4 x i32> <i32 0, i32 undef, i32 undef, i32 4>
357 ret <4 x i32> %shuffle
358}
359
360define <4 x i32> @shuffle_v4i32_z6zz(i32 %i) {
361; ALL-LABEL: @shuffle_v4i32_z6zz
362; ALL: movd {{.*}}, %xmm0
363; ALL-NEXT: pshufd {{.*}} # xmm0 = xmm0[1,0,1,1]
364; ALL-NEXT: retq
365 %a = insertelement <4 x i32> undef, i32 %i, i32 2
366 %shuffle = shufflevector <4 x i32> zeroinitializer, <4 x i32> %a, <4 x i32> <i32 0, i32 6, i32 2, i32 3>
367 ret <4 x i32> %shuffle
368}