d9a69c73893d13253153ca6ce3666c836deaeffd
[oota-llvm.git] / test / CodeGen / X86 / vector-shuffle-512-v8.ll
1 ; RUN: llc < %s -mcpu=x86-64 -mattr=+avx512f -x86-experimental-vector-shuffle-lowering | FileCheck %s --check-prefix=ALL --check-prefix=AVX512 --check-prefix=AVX512F
2 ; RUN: llc < %s -mcpu=x86-64 -mattr=+avx512bw -x86-experimental-vector-shuffle-lowering | FileCheck %s --check-prefix=ALL --check-prefix=AVX512 --check-prefix=AVX512BW
3
4 target triple = "x86_64-unknown-unknown"
5
6 define <8 x double> @shuffle_v8f64_00000000(<8 x double> %a, <8 x double> %b) {
7 ; ALL-LABEL: shuffle_v8f64_00000000:
8 ; ALL:       # BB#0:
9 ; ALL-NEXT:    vbroadcastsd %xmm0, %ymm0
10 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm0, %zmm0
11 ; ALL-NEXT:    retq
12   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
13   ret <8 x double> %shuffle
14 }
15
16 define <8 x double> @shuffle_v8f64_00000010(<8 x double> %a, <8 x double> %b) {
17 ; ALL-LABEL: shuffle_v8f64_00000010:
18 ; ALL:       # BB#0:
19 ; ALL-NEXT:    vbroadcastsd %xmm0, %ymm1
20 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[0,0,1,0]
21 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
22 ; ALL-NEXT:    retq
23   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0>
24   ret <8 x double> %shuffle
25 }
26
27 define <8 x double> @shuffle_v8f64_00000200(<8 x double> %a, <8 x double> %b) {
28 ; ALL-LABEL: shuffle_v8f64_00000200:
29 ; ALL:       # BB#0:
30 ; ALL-NEXT:    vbroadcastsd %xmm0, %ymm1
31 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[0,2,0,0]
32 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
33 ; ALL-NEXT:    retq
34   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 2, i32 0, i32 0>
35   ret <8 x double> %shuffle
36 }
37
38 define <8 x double> @shuffle_v8f64_00003000(<8 x double> %a, <8 x double> %b) {
39 ; ALL-LABEL: shuffle_v8f64_00003000:
40 ; ALL:       # BB#0:
41 ; ALL-NEXT:    vbroadcastsd %xmm0, %ymm1
42 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[3,0,0,0]
43 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
44 ; ALL-NEXT:    retq
45   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 3, i32 0, i32 0, i32 0>
46   ret <8 x double> %shuffle
47 }
48
49 define <8 x double> @shuffle_v8f64_00040000(<8 x double> %a, <8 x double> %b) {
50 ; ALL-LABEL: shuffle_v8f64_00040000:
51 ; ALL:       # BB#0:
52 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm1
53 ; ALL-NEXT:    vbroadcastsd %xmm1, %ymm1
54 ; ALL-NEXT:    vbroadcastsd %xmm0, %ymm0
55 ; ALL-NEXT:    vblendpd {{.*#+}} ymm1 = ymm0[0,1,2],ymm1[3]
56 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
57 ; ALL-NEXT:    retq
58   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 0, i32 0, i32 4, i32 0, i32 0, i32 0, i32 0>
59   ret <8 x double> %shuffle
60 }
61
62 define <8 x double> @shuffle_v8f64_00500000(<8 x double> %a, <8 x double> %b) {
63 ; ALL-LABEL: shuffle_v8f64_00500000:
64 ; ALL:       # BB#0:
65 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm1
66 ; ALL-NEXT:    vpermpd {{.*#+}} ymm1 = ymm1[0,1,1,3]
67 ; ALL-NEXT:    vbroadcastsd %xmm0, %ymm0
68 ; ALL-NEXT:    vblendpd {{.*#+}} ymm1 = ymm0[0,1],ymm1[2],ymm0[3]
69 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
70 ; ALL-NEXT:    retq
71   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 0, i32 5, i32 0, i32 0, i32 0, i32 0, i32 0>
72   ret <8 x double> %shuffle
73 }
74
75 define <8 x double> @shuffle_v8f64_06000000(<8 x double> %a, <8 x double> %b) {
76 ; ALL-LABEL: shuffle_v8f64_06000000:
77 ; ALL:       # BB#0:
78 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm1
79 ; ALL-NEXT:    vpermpd {{.*#+}} ymm1 = ymm1[0,2,2,3]
80 ; ALL-NEXT:    vbroadcastsd %xmm0, %ymm0
81 ; ALL-NEXT:    vblendpd {{.*#+}} ymm1 = ymm0[0],ymm1[1],ymm0[2,3]
82 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
83 ; ALL-NEXT:    retq
84   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 6, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
85   ret <8 x double> %shuffle
86 }
87
88 define <8 x double> @shuffle_v8f64_70000000(<8 x double> %a, <8 x double> %b) {
89 ; ALL-LABEL: shuffle_v8f64_70000000:
90 ; ALL:       # BB#0:
91 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm1
92 ; ALL-NEXT:    vpermpd {{.*#+}} ymm1 = ymm1[3,1,2,3]
93 ; ALL-NEXT:    vbroadcastsd %xmm0, %ymm0
94 ; ALL-NEXT:    vblendpd {{.*#+}} ymm1 = ymm1[0],ymm0[1,2,3]
95 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
96 ; ALL-NEXT:    retq
97   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 7, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
98   ret <8 x double> %shuffle
99 }
100
101 define <8 x double> @shuffle_v8f64_01014545(<8 x double> %a, <8 x double> %b) {
102 ; ALL-LABEL: shuffle_v8f64_01014545:
103 ; ALL:       # BB#0:
104 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm1
105 ; ALL-NEXT:    vinsertf128 $1, %xmm1, %ymm1, %ymm1
106 ; ALL-NEXT:    vinsertf128 $1, %xmm0, %ymm0, %ymm0
107 ; ALL-NEXT:    vinsertf64x4 $1, %ymm1, %zmm0, %zmm0
108 ; ALL-NEXT:    retq
109   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 1, i32 0, i32 1, i32 4, i32 5, i32 4, i32 5>
110   ret <8 x double> %shuffle
111 }
112
113 define <8 x double> @shuffle_v8f64_00112233(<8 x double> %a, <8 x double> %b) {
114 ; ALL-LABEL: shuffle_v8f64_00112233:
115 ; ALL:       # BB#0:
116 ; ALL-NEXT:    vpermpd {{.*#+}} ymm1 = ymm0[0,0,1,1]
117 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[2,2,3,3]
118 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
119 ; ALL-NEXT:    retq
120   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 0, i32 1, i32 1, i32 2, i32 2, i32 3, i32 3>
121   ret <8 x double> %shuffle
122 }
123
124 define <8 x double> @shuffle_v8f64_00001111(<8 x double> %a, <8 x double> %b) {
125 ; ALL-LABEL: shuffle_v8f64_00001111:
126 ; ALL:       # BB#0:
127 ; ALL-NEXT:    vbroadcastsd %xmm0, %ymm1
128 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[1,1,1,1]
129 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
130 ; ALL-NEXT:    retq
131   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1>
132   ret <8 x double> %shuffle
133 }
134
135 define <8 x double> @shuffle_v8f64_81a3c5e7(<8 x double> %a, <8 x double> %b) {
136 ; ALL-LABEL: shuffle_v8f64_81a3c5e7:
137 ; ALL:       # BB#0:
138 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm2
139 ; ALL-NEXT:    vextractf64x4 $1, %zmm1, %ymm3
140 ; ALL-NEXT:    vblendpd {{.*#+}} ymm2 = ymm3[0],ymm2[1],ymm3[2],ymm2[3]
141 ; ALL-NEXT:    vblendpd {{.*#+}} ymm0 = ymm1[0],ymm0[1],ymm1[2],ymm0[3]
142 ; ALL-NEXT:    vinsertf64x4 $1, %ymm2, %zmm0, %zmm0
143 ; ALL-NEXT:    retq
144   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 8, i32 1, i32 10, i32 3, i32 12, i32 5, i32 14, i32 7>
145   ret <8 x double> %shuffle
146 }
147
148 define <8 x double> @shuffle_v8f64_08080808(<8 x double> %a, <8 x double> %b) {
149 ; ALL-LABEL: shuffle_v8f64_08080808:
150 ; ALL:       # BB#0:
151 ; ALL-NEXT:    vinsertf128 $1, %xmm0, %ymm0, %ymm0
152 ; ALL-NEXT:    vbroadcastsd %xmm1, %ymm1
153 ; ALL-NEXT:    vblendpd {{.*#+}} ymm0 = ymm0[0],ymm1[1],ymm0[2],ymm1[3]
154 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm0, %zmm0
155 ; ALL-NEXT:    retq
156   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 8, i32 0, i32 8, i32 0, i32 8, i32 0, i32 8>
157   ret <8 x double> %shuffle
158 }
159
160 define <8 x double> @shuffle_v8f64_08084c4c(<8 x double> %a, <8 x double> %b) {
161 ; ALL-LABEL: shuffle_v8f64_08084c4c:
162 ; ALL:       # BB#0:
163 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm2
164 ; ALL-NEXT:    vinsertf128 $1, %xmm2, %ymm2, %ymm2
165 ; ALL-NEXT:    vextractf64x4 $1, %zmm1, %ymm3
166 ; ALL-NEXT:    vbroadcastsd %xmm3, %ymm3
167 ; ALL-NEXT:    vblendpd {{.*#+}} ymm2 = ymm2[0],ymm3[1],ymm2[2],ymm3[3]
168 ; ALL-NEXT:    vinsertf128 $1, %xmm0, %ymm0, %ymm0
169 ; ALL-NEXT:    vbroadcastsd %xmm1, %ymm1
170 ; ALL-NEXT:    vblendpd {{.*#+}} ymm0 = ymm0[0],ymm1[1],ymm0[2],ymm1[3]
171 ; ALL-NEXT:    vinsertf64x4 $1, %ymm2, %zmm0, %zmm0
172 ; ALL-NEXT:    retq
173   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 8, i32 0, i32 8, i32 4, i32 12, i32 4, i32 12>
174   ret <8 x double> %shuffle
175 }
176
177 define <8 x double> @shuffle_v8f64_8823cc67(<8 x double> %a, <8 x double> %b) {
178 ; ALL-LABEL: shuffle_v8f64_8823cc67:
179 ; ALL:       # BB#0:
180 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm2
181 ; ALL-NEXT:    vextractf64x4 $1, %zmm1, %ymm3
182 ; ALL-NEXT:    vbroadcastsd %xmm3, %ymm3
183 ; ALL-NEXT:    vblendpd {{.*#+}} ymm2 = ymm3[0,1],ymm2[2,3]
184 ; ALL-NEXT:    vbroadcastsd %xmm1, %ymm1
185 ; ALL-NEXT:    vblendpd {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3]
186 ; ALL-NEXT:    vinsertf64x4 $1, %ymm2, %zmm0, %zmm0
187 ; ALL-NEXT:    retq
188   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 8, i32 8, i32 2, i32 3, i32 12, i32 12, i32 6, i32 7>
189   ret <8 x double> %shuffle
190 }
191
192 define <8 x double> @shuffle_v8f64_9832dc76(<8 x double> %a, <8 x double> %b) {
193 ; ALL-LABEL: shuffle_v8f64_9832dc76:
194 ; ALL:       # BB#0:
195 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm2
196 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm2 = ymm2[0,0,3,2]
197 ; ALL-NEXT:    vextractf64x4 $1, %zmm1, %ymm3
198 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm3 = ymm3[1,0,2,2]
199 ; ALL-NEXT:    vblendpd {{.*#+}} ymm2 = ymm3[0,1],ymm2[2,3]
200 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm0 = ymm0[0,0,3,2]
201 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm1 = ymm1[1,0,2,2]
202 ; ALL-NEXT:    vblendpd {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3]
203 ; ALL-NEXT:    vinsertf64x4 $1, %ymm2, %zmm0, %zmm0
204 ; ALL-NEXT:    retq
205   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 9, i32 8, i32 3, i32 2, i32 13, i32 12, i32 7, i32 6>
206   ret <8 x double> %shuffle
207 }
208
209 define <8 x double> @shuffle_v8f64_9810dc54(<8 x double> %a, <8 x double> %b) {
210 ; ALL-LABEL: shuffle_v8f64_9810dc54:
211 ; ALL:       # BB#0:
212 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm2
213 ; ALL-NEXT:    vpermpd {{.*#+}} ymm2 = ymm2[0,1,1,0]
214 ; ALL-NEXT:    vextractf64x4 $1, %zmm1, %ymm3
215 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm3 = ymm3[1,0,2,2]
216 ; ALL-NEXT:    vblendpd {{.*#+}} ymm2 = ymm3[0,1],ymm2[2,3]
217 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[0,1,1,0]
218 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm1 = ymm1[1,0,2,2]
219 ; ALL-NEXT:    vblendpd {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3]
220 ; ALL-NEXT:    vinsertf64x4 $1, %ymm2, %zmm0, %zmm0
221 ; ALL-NEXT:    retq
222   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 9, i32 8, i32 1, i32 0, i32 13, i32 12, i32 5, i32 4>
223   ret <8 x double> %shuffle
224 }
225
226 define <8 x double> @shuffle_v8f64_08194c5d(<8 x double> %a, <8 x double> %b) {
227 ; ALL-LABEL: shuffle_v8f64_08194c5d:
228 ; ALL:       # BB#0:
229 ; ALL-NEXT:    vextractf64x4 $1, %zmm1, %ymm2
230 ; ALL-NEXT:    vpermpd {{.*#+}} ymm2 = ymm2[0,0,2,1]
231 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm3
232 ; ALL-NEXT:    vpermpd {{.*#+}} ymm3 = ymm3[0,1,1,3]
233 ; ALL-NEXT:    vblendpd {{.*#+}} ymm2 = ymm3[0],ymm2[1],ymm3[2],ymm2[3]
234 ; ALL-NEXT:    vpermpd {{.*#+}} ymm1 = ymm1[0,0,2,1]
235 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[0,1,1,3]
236 ; ALL-NEXT:    vblendpd {{.*#+}} ymm0 = ymm0[0],ymm1[1],ymm0[2],ymm1[3]
237 ; ALL-NEXT:    vinsertf64x4 $1, %ymm2, %zmm0, %zmm0
238 ; ALL-NEXT:    retq
239   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 8, i32 1, i32 9, i32 4, i32 12, i32 5, i32 13>
240   ret <8 x double> %shuffle
241 }
242
243 define <8 x double> @shuffle_v8f64_2a3b6e7f(<8 x double> %a, <8 x double> %b) {
244 ; ALL-LABEL: shuffle_v8f64_2a3b6e7f:
245 ; ALL:       # BB#0:
246 ; ALL-NEXT:    vextractf64x4 $1, %zmm1, %ymm2
247 ; ALL-NEXT:    vpermpd {{.*#+}} ymm2 = ymm2[0,2,2,3]
248 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm3
249 ; ALL-NEXT:    vpermpd {{.*#+}} ymm3 = ymm3[2,1,3,3]
250 ; ALL-NEXT:    vblendpd {{.*#+}} ymm2 = ymm3[0],ymm2[1],ymm3[2],ymm2[3]
251 ; ALL-NEXT:    vpermpd {{.*#+}} ymm1 = ymm1[0,2,2,3]
252 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[2,1,3,3]
253 ; ALL-NEXT:    vblendpd {{.*#+}} ymm0 = ymm0[0],ymm1[1],ymm0[2],ymm1[3]
254 ; ALL-NEXT:    vinsertf64x4 $1, %ymm2, %zmm0, %zmm0
255 ; ALL-NEXT:    retq
256   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 2, i32 10, i32 3, i32 11, i32 6, i32 14, i32 7, i32 15>
257   ret <8 x double> %shuffle
258 }
259
260 define <8 x double> @shuffle_v8f64_08192a3b(<8 x double> %a, <8 x double> %b) {
261 ; ALL-LABEL: shuffle_v8f64_08192a3b:
262 ; ALL:       # BB#0:
263 ; ALL-NEXT:    vpermpd {{.*#+}} ymm2 = ymm1[0,2,2,3]
264 ; ALL-NEXT:    vpermpd {{.*#+}} ymm3 = ymm0[2,1,3,3]
265 ; ALL-NEXT:    vblendpd {{.*#+}} ymm2 = ymm3[0],ymm2[1],ymm3[2],ymm2[3]
266 ; ALL-NEXT:    vpermpd {{.*#+}} ymm1 = ymm1[0,0,2,1]
267 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[0,1,1,3]
268 ; ALL-NEXT:    vblendpd {{.*#+}} ymm0 = ymm0[0],ymm1[1],ymm0[2],ymm1[3]
269 ; ALL-NEXT:    vinsertf64x4 $1, %ymm2, %zmm0, %zmm0
270 ; ALL-NEXT:    retq
271   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11>
272   ret <8 x double> %shuffle
273 }
274
275 define <8 x double> @shuffle_v8f64_08991abb(<8 x double> %a, <8 x double> %b) {
276 ; ALL-LABEL: shuffle_v8f64_08991abb:
277 ; ALL:       # BB#0:
278 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm2 = ymm0[1,0,2,2]
279 ; ALL-NEXT:    vpermpd {{.*#+}} ymm3 = ymm1[0,2,3,3]
280 ; ALL-NEXT:    vblendpd {{.*#+}} ymm2 = ymm2[0],ymm3[1,2,3]
281 ; ALL-NEXT:    vpermpd {{.*#+}} ymm1 = ymm1[0,0,1,1]
282 ; ALL-NEXT:    vblendpd {{.*#+}} ymm0 = ymm0[0],ymm1[1,2,3]
283 ; ALL-NEXT:    vinsertf64x4 $1, %ymm2, %zmm0, %zmm0
284 ; ALL-NEXT:    retq
285   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 8, i32 9, i32 9, i32 1, i32 10, i32 11, i32 11>
286   ret <8 x double> %shuffle
287 }
288
289 define <8 x double> @shuffle_v8f64_091b2d3f(<8 x double> %a, <8 x double> %b) {
290 ; ALL-LABEL: shuffle_v8f64_091b2d3f:
291 ; ALL:       # BB#0:
292 ; ALL-NEXT:    vextractf64x4 $1, %zmm1, %ymm2
293 ; ALL-NEXT:    vpermpd {{.*#+}} ymm3 = ymm0[2,1,3,3]
294 ; ALL-NEXT:    vblendpd {{.*#+}} ymm2 = ymm3[0],ymm2[1],ymm3[2],ymm2[3]
295 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[0,1,1,3]
296 ; ALL-NEXT:    vblendpd {{.*#+}} ymm0 = ymm0[0],ymm1[1],ymm0[2],ymm1[3]
297 ; ALL-NEXT:    vinsertf64x4 $1, %ymm2, %zmm0, %zmm0
298 ; ALL-NEXT:    retq
299   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 9, i32 1, i32 11, i32 2, i32 13, i32 3, i32 15>
300   ret <8 x double> %shuffle
301 }
302
303 define <8 x double> @shuffle_v8f64_09ab1def(<8 x double> %a, <8 x double> %b) {
304 ; ALL-LABEL: shuffle_v8f64_09ab1def:
305 ; ALL:       # BB#0:
306 ; ALL-NEXT:    vextractf64x4 $1, %zmm1, %ymm2
307 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm3 = ymm0[1,0,2,2]
308 ; ALL-NEXT:    vblendpd {{.*#+}} ymm2 = ymm3[0],ymm2[1,2,3]
309 ; ALL-NEXT:    vblendpd {{.*#+}} ymm0 = ymm0[0],ymm1[1,2,3]
310 ; ALL-NEXT:    vinsertf64x4 $1, %ymm2, %zmm0, %zmm0
311 ; ALL-NEXT:    retq
312   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 9, i32 10, i32 11, i32 1, i32 13, i32 14, i32 15>
313   ret <8 x double> %shuffle
314 }
315
316 define <8 x double> @shuffle_v8f64_00014445(<8 x double> %a, <8 x double> %b) {
317 ; ALL-LABEL: shuffle_v8f64_00014445:
318 ; ALL:       # BB#0:
319 ; ALL-NEXT:    vpermpd {{.*#+}} ymm1 = ymm0[0,0,0,1]
320 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
321 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[0,0,0,1]
322 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
323 ; ALL-NEXT:    retq
324   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 0, i32 0, i32 1, i32 4, i32 4, i32 4, i32 5>
325   ret <8 x double> %shuffle
326 }
327
328 define <8 x double> @shuffle_v8f64_00204464(<8 x double> %a, <8 x double> %b) {
329 ; ALL-LABEL: shuffle_v8f64_00204464:
330 ; ALL:       # BB#0:
331 ; ALL-NEXT:    vpermpd {{.*#+}} ymm1 = ymm0[0,0,2,0]
332 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
333 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[0,0,2,0]
334 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
335 ; ALL-NEXT:    retq
336   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 0, i32 2, i32 0, i32 4, i32 4, i32 6, i32 4>
337   ret <8 x double> %shuffle
338 }
339
340 define <8 x double> @shuffle_v8f64_03004744(<8 x double> %a, <8 x double> %b) {
341 ; ALL-LABEL: shuffle_v8f64_03004744:
342 ; ALL:       # BB#0:
343 ; ALL-NEXT:    vpermpd {{.*#+}} ymm1 = ymm0[0,3,0,0]
344 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
345 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[0,3,0,0]
346 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
347 ; ALL-NEXT:    retq
348   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 3, i32 0, i32 0, i32 4, i32 7, i32 4, i32 4>
349   ret <8 x double> %shuffle
350 }
351
352 define <8 x double> @shuffle_v8f64_10005444(<8 x double> %a, <8 x double> %b) {
353 ; ALL-LABEL: shuffle_v8f64_10005444:
354 ; ALL:       # BB#0:
355 ; ALL-NEXT:    vpermpd {{.*#+}} ymm1 = ymm0[1,0,0,0]
356 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
357 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[1,0,0,0]
358 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
359 ; ALL-NEXT:    retq
360   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 1, i32 0, i32 0, i32 0, i32 5, i32 4, i32 4, i32 4>
361   ret <8 x double> %shuffle
362 }
363
364 define <8 x double> @shuffle_v8f64_22006644(<8 x double> %a, <8 x double> %b) {
365 ; ALL-LABEL: shuffle_v8f64_22006644:
366 ; ALL:       # BB#0:
367 ; ALL-NEXT:    vpermpd {{.*#+}} ymm1 = ymm0[2,2,0,0]
368 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
369 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[2,2,0,0]
370 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
371 ; ALL-NEXT:    retq
372   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 2, i32 2, i32 0, i32 0, i32 6, i32 6, i32 4, i32 4>
373   ret <8 x double> %shuffle
374 }
375
376 define <8 x double> @shuffle_v8f64_33307774(<8 x double> %a, <8 x double> %b) {
377 ; ALL-LABEL: shuffle_v8f64_33307774:
378 ; ALL:       # BB#0:
379 ; ALL-NEXT:    vpermpd {{.*#+}} ymm1 = ymm0[3,3,3,0]
380 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
381 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[3,3,3,0]
382 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
383 ; ALL-NEXT:    retq
384   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 3, i32 3, i32 3, i32 0, i32 7, i32 7, i32 7, i32 4>
385   ret <8 x double> %shuffle
386 }
387
388 define <8 x double> @shuffle_v8f64_32107654(<8 x double> %a, <8 x double> %b) {
389 ; ALL-LABEL: shuffle_v8f64_32107654:
390 ; ALL:       # BB#0:
391 ; ALL-NEXT:    vpermpd {{.*#+}} ymm1 = ymm0[3,2,1,0]
392 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
393 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[3,2,1,0]
394 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
395 ; ALL-NEXT:    retq
396   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 7, i32 6, i32 5, i32 4>
397   ret <8 x double> %shuffle
398 }
399
400 define <8 x double> @shuffle_v8f64_00234467(<8 x double> %a, <8 x double> %b) {
401 ; ALL-LABEL: shuffle_v8f64_00234467:
402 ; ALL:       # BB#0:
403 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm1 = ymm0[0,0,2,3]
404 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
405 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm0 = ymm0[0,0,2,3]
406 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
407 ; ALL-NEXT:    retq
408   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 0, i32 2, i32 3, i32 4, i32 4, i32 6, i32 7>
409   ret <8 x double> %shuffle
410 }
411
412 define <8 x double> @shuffle_v8f64_00224466(<8 x double> %a, <8 x double> %b) {
413 ; ALL-LABEL: shuffle_v8f64_00224466:
414 ; ALL:       # BB#0:
415 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm1 = ymm0[0,0,2,2]
416 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
417 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm0 = ymm0[0,0,2,2]
418 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
419 ; ALL-NEXT:    retq
420   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 0, i32 2, i32 2, i32 4, i32 4, i32 6, i32 6>
421   ret <8 x double> %shuffle
422 }
423
424 define <8 x double> @shuffle_v8f64_10325476(<8 x double> %a, <8 x double> %b) {
425 ; ALL-LABEL: shuffle_v8f64_10325476:
426 ; ALL:       # BB#0:
427 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm1 = ymm0[1,0,3,2]
428 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
429 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
430 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
431 ; ALL-NEXT:    retq
432   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 1, i32 0, i32 3, i32 2, i32 5, i32 4, i32 7, i32 6>
433   ret <8 x double> %shuffle
434 }
435
436 define <8 x double> @shuffle_v8f64_11335577(<8 x double> %a, <8 x double> %b) {
437 ; ALL-LABEL: shuffle_v8f64_11335577:
438 ; ALL:       # BB#0:
439 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm1 = ymm0[1,1,3,3]
440 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
441 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm0 = ymm0[1,1,3,3]
442 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
443 ; ALL-NEXT:    retq
444   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 1, i32 1, i32 3, i32 3, i32 5, i32 5, i32 7, i32 7>
445   ret <8 x double> %shuffle
446 }
447
448 define <8 x double> @shuffle_v8f64_10235467(<8 x double> %a, <8 x double> %b) {
449 ; ALL-LABEL: shuffle_v8f64_10235467:
450 ; ALL:       # BB#0:
451 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm1 = ymm0[1,0,2,3]
452 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
453 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm0 = ymm0[1,0,2,3]
454 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
455 ; ALL-NEXT:    retq
456   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 1, i32 0, i32 2, i32 3, i32 5, i32 4, i32 6, i32 7>
457   ret <8 x double> %shuffle
458 }
459
460 define <8 x double> @shuffle_v8f64_10225466(<8 x double> %a, <8 x double> %b) {
461 ; ALL-LABEL: shuffle_v8f64_10225466:
462 ; ALL:       # BB#0:
463 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm1 = ymm0[1,0,2,2]
464 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
465 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm0 = ymm0[1,0,2,2]
466 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
467 ; ALL-NEXT:    retq
468   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 1, i32 0, i32 2, i32 2, i32 5, i32 4, i32 6, i32 6>
469   ret <8 x double> %shuffle
470 }
471
472 define <8 x double> @shuffle_v8f64_00015444(<8 x double> %a, <8 x double> %b) {
473 ; ALL-LABEL: shuffle_v8f64_00015444:
474 ; ALL:       # BB#0:
475 ; ALL-NEXT:    vpermpd {{.*#+}} ymm1 = ymm0[0,0,0,1]
476 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
477 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[1,0,0,0]
478 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
479 ; ALL-NEXT:    retq
480   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 0, i32 0, i32 1, i32 5, i32 4, i32 4, i32 4>
481   ret <8 x double> %shuffle
482 }
483
484 define <8 x double> @shuffle_v8f64_00204644(<8 x double> %a, <8 x double> %b) {
485 ; ALL-LABEL: shuffle_v8f64_00204644:
486 ; ALL:       # BB#0:
487 ; ALL-NEXT:    vpermpd {{.*#+}} ymm1 = ymm0[0,0,2,0]
488 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
489 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[0,2,0,0]
490 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
491 ; ALL-NEXT:    retq
492   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 0, i32 2, i32 0, i32 4, i32 6, i32 4, i32 4>
493   ret <8 x double> %shuffle
494 }
495
496 define <8 x double> @shuffle_v8f64_03004474(<8 x double> %a, <8 x double> %b) {
497 ; ALL-LABEL: shuffle_v8f64_03004474:
498 ; ALL:       # BB#0:
499 ; ALL-NEXT:    vpermpd {{.*#+}} ymm1 = ymm0[0,3,0,0]
500 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
501 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[0,0,3,0]
502 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
503 ; ALL-NEXT:    retq
504   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 3, i32 0, i32 0, i32 4, i32 4, i32 7, i32 4>
505   ret <8 x double> %shuffle
506 }
507
508 define <8 x double> @shuffle_v8f64_10004444(<8 x double> %a, <8 x double> %b) {
509 ; ALL-LABEL: shuffle_v8f64_10004444:
510 ; ALL:       # BB#0:
511 ; ALL-NEXT:    vpermpd {{.*#+}} ymm1 = ymm0[1,0,0,0]
512 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
513 ; ALL-NEXT:    vbroadcastsd %xmm0, %ymm0
514 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
515 ; ALL-NEXT:    retq
516   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 1, i32 0, i32 0, i32 0, i32 4, i32 4, i32 4, i32 4>
517   ret <8 x double> %shuffle
518 }
519
520 define <8 x double> @shuffle_v8f64_22006446(<8 x double> %a, <8 x double> %b) {
521 ; ALL-LABEL: shuffle_v8f64_22006446:
522 ; ALL:       # BB#0:
523 ; ALL-NEXT:    vpermpd {{.*#+}} ymm1 = ymm0[2,2,0,0]
524 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
525 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[2,0,0,2]
526 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
527 ; ALL-NEXT:    retq
528   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 2, i32 2, i32 0, i32 0, i32 6, i32 4, i32 4, i32 6>
529   ret <8 x double> %shuffle
530 }
531
532 define <8 x double> @shuffle_v8f64_33307474(<8 x double> %a, <8 x double> %b) {
533 ; ALL-LABEL: shuffle_v8f64_33307474:
534 ; ALL:       # BB#0:
535 ; ALL-NEXT:    vpermpd {{.*#+}} ymm1 = ymm0[3,3,3,0]
536 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
537 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[3,0,3,0]
538 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
539 ; ALL-NEXT:    retq
540   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 3, i32 3, i32 3, i32 0, i32 7, i32 4, i32 7, i32 4>
541   ret <8 x double> %shuffle
542 }
543
544 define <8 x double> @shuffle_v8f64_32104567(<8 x double> %a, <8 x double> %b) {
545 ; ALL-LABEL: shuffle_v8f64_32104567:
546 ; ALL:       # BB#0:
547 ; ALL-NEXT:    vpermpd {{.*#+}} ymm1 = ymm0[3,2,1,0]
548 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
549 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
550 ; ALL-NEXT:    retq
551   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 4, i32 5, i32 6, i32 7>
552   ret <8 x double> %shuffle
553 }
554
555 define <8 x double> @shuffle_v8f64_00236744(<8 x double> %a, <8 x double> %b) {
556 ; ALL-LABEL: shuffle_v8f64_00236744:
557 ; ALL:       # BB#0:
558 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm1 = ymm0[0,0,2,3]
559 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
560 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[2,3,0,0]
561 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
562 ; ALL-NEXT:    retq
563   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 0, i32 2, i32 3, i32 6, i32 7, i32 4, i32 4>
564   ret <8 x double> %shuffle
565 }
566
567 define <8 x double> @shuffle_v8f64_00226644(<8 x double> %a, <8 x double> %b) {
568 ; ALL-LABEL: shuffle_v8f64_00226644:
569 ; ALL:       # BB#0:
570 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm1 = ymm0[0,0,2,2]
571 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
572 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[2,2,0,0]
573 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
574 ; ALL-NEXT:    retq
575   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 0, i32 2, i32 2, i32 6, i32 6, i32 4, i32 4>
576   ret <8 x double> %shuffle
577 }
578
579 define <8 x double> @shuffle_v8f64_10324567(<8 x double> %a, <8 x double> %b) {
580 ; ALL-LABEL: shuffle_v8f64_10324567:
581 ; ALL:       # BB#0:
582 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm1 = ymm0[1,0,3,2]
583 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
584 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
585 ; ALL-NEXT:    retq
586   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 1, i32 0, i32 3, i32 2, i32 4, i32 5, i32 6, i32 7>
587   ret <8 x double> %shuffle
588 }
589
590 define <8 x double> @shuffle_v8f64_11334567(<8 x double> %a, <8 x double> %b) {
591 ; ALL-LABEL: shuffle_v8f64_11334567:
592 ; ALL:       # BB#0:
593 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm1 = ymm0[1,1,3,3]
594 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
595 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
596 ; ALL-NEXT:    retq
597   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 1, i32 1, i32 3, i32 3, i32 4, i32 5, i32 6, i32 7>
598   ret <8 x double> %shuffle
599 }
600
601 define <8 x double> @shuffle_v8f64_01235467(<8 x double> %a, <8 x double> %b) {
602 ; ALL-LABEL: shuffle_v8f64_01235467:
603 ; ALL:       # BB#0:
604 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm1
605 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm1 = ymm1[1,0,2,3]
606 ; ALL-NEXT:    vinsertf64x4 $1, %ymm1, %zmm0, %zmm0
607 ; ALL-NEXT:    retq
608   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 5, i32 4, i32 6, i32 7>
609   ret <8 x double> %shuffle
610 }
611
612 define <8 x double> @shuffle_v8f64_01235466(<8 x double> %a, <8 x double> %b) {
613 ; ALL-LABEL: shuffle_v8f64_01235466:
614 ; ALL:       # BB#0:
615 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm1
616 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm1 = ymm1[1,0,2,2]
617 ; ALL-NEXT:    vinsertf64x4 $1, %ymm1, %zmm0, %zmm0
618 ; ALL-NEXT:    retq
619   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 5, i32 4, i32 6, i32 6>
620   ret <8 x double> %shuffle
621 }
622
623 define <8 x double> @shuffle_v8f64_002u6u44(<8 x double> %a, <8 x double> %b) {
624 ; ALL-LABEL: shuffle_v8f64_002u6u44:
625 ; ALL:       # BB#0:
626 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm1 = ymm0[0,0,2,2]
627 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
628 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[2,1,0,0]
629 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
630 ; ALL-NEXT:    retq
631   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 0, i32 2, i32 undef, i32 6, i32 undef, i32 4, i32 4>
632   ret <8 x double> %shuffle
633 }
634
635 define <8 x double> @shuffle_v8f64_00uu66uu(<8 x double> %a, <8 x double> %b) {
636 ; ALL-LABEL: shuffle_v8f64_00uu66uu:
637 ; ALL:       # BB#0:
638 ; ALL-NEXT:    vbroadcastsd %xmm0, %ymm1
639 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
640 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[2,2,2,3]
641 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
642 ; ALL-NEXT:    retq
643   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 0, i32 undef, i32 undef, i32 6, i32 6, i32 undef, i32 undef>
644   ret <8 x double> %shuffle
645 }
646
647 define <8 x double> @shuffle_v8f64_103245uu(<8 x double> %a, <8 x double> %b) {
648 ; ALL-LABEL: shuffle_v8f64_103245uu:
649 ; ALL:       # BB#0:
650 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm1 = ymm0[1,0,3,2]
651 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
652 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
653 ; ALL-NEXT:    retq
654   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 1, i32 0, i32 3, i32 2, i32 4, i32 5, i32 undef, i32 undef>
655   ret <8 x double> %shuffle
656 }
657
658 define <8 x double> @shuffle_v8f64_1133uu67(<8 x double> %a, <8 x double> %b) {
659 ; ALL-LABEL: shuffle_v8f64_1133uu67:
660 ; ALL:       # BB#0:
661 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm1 = ymm0[1,1,3,3]
662 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm0
663 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm1, %zmm0
664 ; ALL-NEXT:    retq
665   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 1, i32 1, i32 3, i32 3, i32 undef, i32 undef, i32 6, i32 7>
666   ret <8 x double> %shuffle
667 }
668
669 define <8 x double> @shuffle_v8f64_0uu354uu(<8 x double> %a, <8 x double> %b) {
670 ; ALL-LABEL: shuffle_v8f64_0uu354uu:
671 ; ALL:       # BB#0:
672 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm1
673 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm1 = ymm1[1,0,2,2]
674 ; ALL-NEXT:    vinsertf64x4 $1, %ymm1, %zmm0, %zmm0
675 ; ALL-NEXT:    retq
676   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 0, i32 undef, i32 undef, i32 3, i32 5, i32 4, i32 undef, i32 undef>
677   ret <8 x double> %shuffle
678 }
679
680 define <8 x double> @shuffle_v8f64_uuu3uu66(<8 x double> %a, <8 x double> %b) {
681 ; ALL-LABEL: shuffle_v8f64_uuu3uu66:
682 ; ALL:       # BB#0:
683 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm1
684 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm1 = ymm1[0,0,2,2]
685 ; ALL-NEXT:    vinsertf64x4 $1, %ymm1, %zmm0, %zmm0
686 ; ALL-NEXT:    retq
687   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 undef, i32 undef, i32 undef, i32 3, i32 undef, i32 undef, i32 6, i32 6>
688   ret <8 x double> %shuffle
689 }
690
691 define <8 x double> @shuffle_v8f64_c348cda0(<8 x double> %a, <8 x double> %b) {
692 ; ALL-LABEL: shuffle_v8f64_c348cda0:
693 ; ALL:       # BB#0:
694 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm2
695 ; ALL-NEXT:    vperm2f128 {{.*#+}} ymm2 = ymm0[0,1],ymm2[0,1]
696 ; ALL-NEXT:    vextractf64x4 $1, %zmm1, %ymm3
697 ; ALL-NEXT:    vbroadcastsd %xmm1, %ymm4
698 ; ALL-NEXT:    vblendpd {{.*#+}} ymm4 = ymm3[0,1,2],ymm4[3]
699 ; ALL-NEXT:    vblendpd {{.*#+}} ymm2 = ymm4[0],ymm2[1,2],ymm4[3]
700 ; ALL-NEXT:    vblendpd {{.*#+}} ymm1 = ymm3[0,1],ymm1[2],ymm3[3]
701 ; ALL-NEXT:    vbroadcastsd %xmm0, %ymm0
702 ; ALL-NEXT:    vblendpd {{.*#+}} ymm0 = ymm1[0,1,2],ymm0[3]
703 ; ALL-NEXT:    vinsertf64x4 $1, %ymm0, %zmm2, %zmm0
704 ; ALL-NEXT:    retq
705   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 12, i32 3, i32 4, i32 8, i32 12, i32 13, i32 10, i32 0>
706   ret <8 x double> %shuffle
707 }
708
709 define <8 x double> @shuffle_v8f64_f511235a(<8 x double> %a, <8 x double> %b) {
710 ; ALL-LABEL: shuffle_v8f64_f511235a:
711 ; ALL:       # BB#0:
712 ; ALL-NEXT:    vperm2f128 {{.*#+}} ymm2 = ymm0[2,3,0,1]
713 ; ALL-NEXT:    vextractf64x4 $1, %zmm0, %ymm3
714 ; ALL-NEXT:    vpermpd {{.*#+}} ymm4 = ymm3[0,1,1,3]
715 ; ALL-NEXT:    vblendpd {{.*#+}} ymm2 = ymm2[0,1],ymm4[2],ymm2[3]
716 ; ALL-NEXT:    vpermilpd {{.*#+}} ymm4 = ymm1[0,0,2,2]
717 ; ALL-NEXT:    vblendpd {{.*#+}} ymm2 = ymm2[0,1,2],ymm4[3]
718 ; ALL-NEXT:    vpermpd {{.*#+}} ymm0 = ymm0[0,1,1,1]
719 ; ALL-NEXT:    vblendpd {{.*#+}} ymm0 = ymm0[0],ymm3[1],ymm0[2,3]
720 ; ALL-NEXT:    vextractf64x4 $1, %zmm1, %ymm1
721 ; ALL-NEXT:    vpermpd {{.*#+}} ymm1 = ymm1[3,1,2,3]
722 ; ALL-NEXT:    vblendpd {{.*#+}} ymm0 = ymm1[0],ymm0[1,2,3]
723 ; ALL-NEXT:    vinsertf64x4 $1, %ymm2, %zmm0, %zmm0
724 ; ALL-NEXT:    retq
725   %shuffle = shufflevector <8 x double> %a, <8 x double> %b, <8 x i32> <i32 15, i32 5, i32 1, i32 1, i32 2, i32 3, i32 5, i32 10>
726   ret <8 x double> %shuffle
727 }
728
729 define <8 x i64> @shuffle_v8i64_00000000(<8 x i64> %a, <8 x i64> %b) {
730 ; ALL-LABEL: shuffle_v8i64_00000000:
731 ; ALL:       # BB#0:
732 ; ALL-NEXT:    vpbroadcastq %xmm0, %ymm0
733 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm0, %zmm0
734 ; ALL-NEXT:    retq
735   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
736   ret <8 x i64> %shuffle
737 }
738
739 define <8 x i64> @shuffle_v8i64_00000010(<8 x i64> %a, <8 x i64> %b) {
740 ; ALL-LABEL: shuffle_v8i64_00000010:
741 ; ALL:       # BB#0:
742 ; ALL-NEXT:    vpbroadcastq %xmm0, %ymm1
743 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[0,0,1,0]
744 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
745 ; ALL-NEXT:    retq
746   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0>
747   ret <8 x i64> %shuffle
748 }
749
750 define <8 x i64> @shuffle_v8i64_00000200(<8 x i64> %a, <8 x i64> %b) {
751 ; ALL-LABEL: shuffle_v8i64_00000200:
752 ; ALL:       # BB#0:
753 ; ALL-NEXT:    vpbroadcastq %xmm0, %ymm1
754 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[0,2,0,0]
755 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
756 ; ALL-NEXT:    retq
757   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 2, i32 0, i32 0>
758   ret <8 x i64> %shuffle
759 }
760
761 define <8 x i64> @shuffle_v8i64_00003000(<8 x i64> %a, <8 x i64> %b) {
762 ; ALL-LABEL: shuffle_v8i64_00003000:
763 ; ALL:       # BB#0:
764 ; ALL-NEXT:    vpbroadcastq %xmm0, %ymm1
765 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[3,0,0,0]
766 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
767 ; ALL-NEXT:    retq
768   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 3, i32 0, i32 0, i32 0>
769   ret <8 x i64> %shuffle
770 }
771
772 define <8 x i64> @shuffle_v8i64_00040000(<8 x i64> %a, <8 x i64> %b) {
773 ; ALL-LABEL: shuffle_v8i64_00040000:
774 ; ALL:       # BB#0:
775 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm1
776 ; ALL-NEXT:    vpbroadcastq %xmm1, %ymm1
777 ; ALL-NEXT:    vpbroadcastq %xmm0, %ymm0
778 ; ALL-NEXT:    vpblendd {{.*#+}} ymm1 = ymm0[0,1,2,3,4,5],ymm1[6,7]
779 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
780 ; ALL-NEXT:    retq
781   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 0, i32 0, i32 4, i32 0, i32 0, i32 0, i32 0>
782   ret <8 x i64> %shuffle
783 }
784
785 define <8 x i64> @shuffle_v8i64_00500000(<8 x i64> %a, <8 x i64> %b) {
786 ; ALL-LABEL: shuffle_v8i64_00500000:
787 ; ALL:       # BB#0:
788 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm1
789 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm1[0,1,1,3]
790 ; ALL-NEXT:    vpbroadcastq %xmm0, %ymm0
791 ; ALL-NEXT:    vpblendd {{.*#+}} ymm1 = ymm0[0,1,2,3],ymm1[4,5],ymm0[6,7]
792 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
793 ; ALL-NEXT:    retq
794   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 0, i32 5, i32 0, i32 0, i32 0, i32 0, i32 0>
795   ret <8 x i64> %shuffle
796 }
797
798 define <8 x i64> @shuffle_v8i64_06000000(<8 x i64> %a, <8 x i64> %b) {
799 ; ALL-LABEL: shuffle_v8i64_06000000:
800 ; ALL:       # BB#0:
801 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm1
802 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm1[0,2,2,3]
803 ; ALL-NEXT:    vpbroadcastq %xmm0, %ymm0
804 ; ALL-NEXT:    vpblendd {{.*#+}} ymm1 = ymm0[0,1],ymm1[2,3],ymm0[4,5,6,7]
805 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
806 ; ALL-NEXT:    retq
807   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 6, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
808   ret <8 x i64> %shuffle
809 }
810
811 define <8 x i64> @shuffle_v8i64_70000000(<8 x i64> %a, <8 x i64> %b) {
812 ; ALL-LABEL: shuffle_v8i64_70000000:
813 ; ALL:       # BB#0:
814 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm1
815 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm1[3,1,2,3]
816 ; ALL-NEXT:    vpbroadcastq %xmm0, %ymm0
817 ; ALL-NEXT:    vpblendd {{.*#+}} ymm1 = ymm1[0,1],ymm0[2,3,4,5,6,7]
818 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
819 ; ALL-NEXT:    retq
820   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 7, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0>
821   ret <8 x i64> %shuffle
822 }
823
824 define <8 x i64> @shuffle_v8i64_01014545(<8 x i64> %a, <8 x i64> %b) {
825 ; ALL-LABEL: shuffle_v8i64_01014545:
826 ; ALL:       # BB#0:
827 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm1
828 ; ALL-NEXT:    vinserti128 $1, %xmm1, %ymm1, %ymm1
829 ; ALL-NEXT:    vinserti128 $1, %xmm0, %ymm0, %ymm0
830 ; ALL-NEXT:    vinserti64x4 $1, %ymm1, %zmm0, %zmm0
831 ; ALL-NEXT:    retq
832   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 1, i32 0, i32 1, i32 4, i32 5, i32 4, i32 5>
833   ret <8 x i64> %shuffle
834 }
835
836 define <8 x i64> @shuffle_v8i64_00112233(<8 x i64> %a, <8 x i64> %b) {
837 ; ALL-LABEL: shuffle_v8i64_00112233:
838 ; ALL:       # BB#0:
839 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm0[0,0,1,1]
840 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[2,2,3,3]
841 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
842 ; ALL-NEXT:    retq
843   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 0, i32 1, i32 1, i32 2, i32 2, i32 3, i32 3>
844   ret <8 x i64> %shuffle
845 }
846
847 define <8 x i64> @shuffle_v8i64_00001111(<8 x i64> %a, <8 x i64> %b) {
848 ; ALL-LABEL: shuffle_v8i64_00001111:
849 ; ALL:       # BB#0:
850 ; ALL-NEXT:    vpbroadcastq %xmm0, %ymm1
851 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[1,1,1,1]
852 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
853 ; ALL-NEXT:    retq
854   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1>
855   ret <8 x i64> %shuffle
856 }
857
858 define <8 x i64> @shuffle_v8i64_81a3c5e7(<8 x i64> %a, <8 x i64> %b) {
859 ; ALL-LABEL: shuffle_v8i64_81a3c5e7:
860 ; ALL:       # BB#0:
861 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm2
862 ; ALL-NEXT:    vextracti64x4 $1, %zmm1, %ymm3
863 ; ALL-NEXT:    vpblendd {{.*#+}} ymm2 = ymm3[0,1],ymm2[2,3],ymm3[4,5],ymm2[6,7]
864 ; ALL-NEXT:    vpblendd {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3],ymm1[4,5],ymm0[6,7]
865 ; ALL-NEXT:    vinserti64x4 $1, %ymm2, %zmm0, %zmm0
866 ; ALL-NEXT:    retq
867   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 8, i32 1, i32 10, i32 3, i32 12, i32 5, i32 14, i32 7>
868   ret <8 x i64> %shuffle
869 }
870
871 define <8 x i64> @shuffle_v8i64_08080808(<8 x i64> %a, <8 x i64> %b) {
872 ; ALL-LABEL: shuffle_v8i64_08080808:
873 ; ALL:       # BB#0:
874 ; ALL-NEXT:    vinserti128 $1, %xmm0, %ymm0, %ymm0
875 ; ALL-NEXT:    vpbroadcastq %xmm1, %ymm1
876 ; ALL-NEXT:    vpblendd {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5],ymm1[6,7]
877 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm0, %zmm0
878 ; ALL-NEXT:    retq
879   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 8, i32 0, i32 8, i32 0, i32 8, i32 0, i32 8>
880   ret <8 x i64> %shuffle
881 }
882
883 define <8 x i64> @shuffle_v8i64_08084c4c(<8 x i64> %a, <8 x i64> %b) {
884 ; ALL-LABEL: shuffle_v8i64_08084c4c:
885 ; ALL:       # BB#0:
886 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm2
887 ; ALL-NEXT:    vinserti128 $1, %xmm2, %ymm2, %ymm2
888 ; ALL-NEXT:    vextracti64x4 $1, %zmm1, %ymm3
889 ; ALL-NEXT:    vpbroadcastq %xmm3, %ymm3
890 ; ALL-NEXT:    vpblendd {{.*#+}} ymm2 = ymm2[0,1],ymm3[2,3],ymm2[4,5],ymm3[6,7]
891 ; ALL-NEXT:    vinserti128 $1, %xmm0, %ymm0, %ymm0
892 ; ALL-NEXT:    vpbroadcastq %xmm1, %ymm1
893 ; ALL-NEXT:    vpblendd {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5],ymm1[6,7]
894 ; ALL-NEXT:    vinserti64x4 $1, %ymm2, %zmm0, %zmm0
895 ; ALL-NEXT:    retq
896   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 8, i32 0, i32 8, i32 4, i32 12, i32 4, i32 12>
897   ret <8 x i64> %shuffle
898 }
899
900 define <8 x i64> @shuffle_v8i64_8823cc67(<8 x i64> %a, <8 x i64> %b) {
901 ; ALL-LABEL: shuffle_v8i64_8823cc67:
902 ; ALL:       # BB#0:
903 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm2
904 ; ALL-NEXT:    vextracti64x4 $1, %zmm1, %ymm3
905 ; ALL-NEXT:    vpbroadcastq %xmm3, %ymm3
906 ; ALL-NEXT:    vpblendd {{.*#+}} ymm2 = ymm3[0,1,2,3],ymm2[4,5,6,7]
907 ; ALL-NEXT:    vpbroadcastq %xmm1, %ymm1
908 ; ALL-NEXT:    vpblendd {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
909 ; ALL-NEXT:    vinserti64x4 $1, %ymm2, %zmm0, %zmm0
910 ; ALL-NEXT:    retq
911   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 8, i32 8, i32 2, i32 3, i32 12, i32 12, i32 6, i32 7>
912   ret <8 x i64> %shuffle
913 }
914
915 define <8 x i64> @shuffle_v8i64_9832dc76(<8 x i64> %a, <8 x i64> %b) {
916 ; ALL-LABEL: shuffle_v8i64_9832dc76:
917 ; ALL:       # BB#0:
918 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm2
919 ; ALL-NEXT:    vpshufd {{.*#+}} ymm2 = ymm2[2,3,0,1,6,7,4,5]
920 ; ALL-NEXT:    vextracti64x4 $1, %zmm1, %ymm3
921 ; ALL-NEXT:    vpshufd {{.*#+}} ymm3 = ymm3[2,3,0,1,6,7,4,5]
922 ; ALL-NEXT:    vpblendd {{.*#+}} ymm2 = ymm3[0,1,2,3],ymm2[4,5,6,7]
923 ; ALL-NEXT:    vpshufd {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
924 ; ALL-NEXT:    vpshufd {{.*#+}} ymm1 = ymm1[2,3,0,1,6,7,4,5]
925 ; ALL-NEXT:    vpblendd {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
926 ; ALL-NEXT:    vinserti64x4 $1, %ymm2, %zmm0, %zmm0
927 ; ALL-NEXT:    retq
928   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 9, i32 8, i32 3, i32 2, i32 13, i32 12, i32 7, i32 6>
929   ret <8 x i64> %shuffle
930 }
931
932 define <8 x i64> @shuffle_v8i64_9810dc54(<8 x i64> %a, <8 x i64> %b) {
933 ; ALL-LABEL: shuffle_v8i64_9810dc54:
934 ; ALL:       # BB#0:
935 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm2
936 ; ALL-NEXT:    vpermq {{.*#+}} ymm2 = ymm2[0,1,1,0]
937 ; ALL-NEXT:    vextracti64x4 $1, %zmm1, %ymm3
938 ; ALL-NEXT:    vpshufd {{.*#+}} ymm3 = ymm3[2,3,0,1,6,7,4,5]
939 ; ALL-NEXT:    vpblendd {{.*#+}} ymm2 = ymm3[0,1,2,3],ymm2[4,5,6,7]
940 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[0,1,1,0]
941 ; ALL-NEXT:    vpshufd {{.*#+}} ymm1 = ymm1[2,3,0,1,6,7,4,5]
942 ; ALL-NEXT:    vpblendd {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
943 ; ALL-NEXT:    vinserti64x4 $1, %ymm2, %zmm0, %zmm0
944 ; ALL-NEXT:    retq
945   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 9, i32 8, i32 1, i32 0, i32 13, i32 12, i32 5, i32 4>
946   ret <8 x i64> %shuffle
947 }
948
949 define <8 x i64> @shuffle_v8i64_08194c5d(<8 x i64> %a, <8 x i64> %b) {
950 ; ALL-LABEL: shuffle_v8i64_08194c5d:
951 ; ALL:       # BB#0:
952 ; ALL-NEXT:    vextracti64x4 $1, %zmm1, %ymm2
953 ; ALL-NEXT:    vpermq {{.*#+}} ymm2 = ymm2[0,0,2,1]
954 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm3
955 ; ALL-NEXT:    vpermq {{.*#+}} ymm3 = ymm3[0,1,1,3]
956 ; ALL-NEXT:    vpblendd {{.*#+}} ymm2 = ymm3[0,1],ymm2[2,3],ymm3[4,5],ymm2[6,7]
957 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm1[0,0,2,1]
958 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[0,1,1,3]
959 ; ALL-NEXT:    vpblendd {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5],ymm1[6,7]
960 ; ALL-NEXT:    vinserti64x4 $1, %ymm2, %zmm0, %zmm0
961 ; ALL-NEXT:    retq
962   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 8, i32 1, i32 9, i32 4, i32 12, i32 5, i32 13>
963   ret <8 x i64> %shuffle
964 }
965
966 define <8 x i64> @shuffle_v8i64_2a3b6e7f(<8 x i64> %a, <8 x i64> %b) {
967 ; ALL-LABEL: shuffle_v8i64_2a3b6e7f:
968 ; ALL:       # BB#0:
969 ; ALL-NEXT:    vextracti64x4 $1, %zmm1, %ymm2
970 ; ALL-NEXT:    vpermq {{.*#+}} ymm2 = ymm2[0,2,2,3]
971 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm3
972 ; ALL-NEXT:    vpermq {{.*#+}} ymm3 = ymm3[2,1,3,3]
973 ; ALL-NEXT:    vpblendd {{.*#+}} ymm2 = ymm3[0,1],ymm2[2,3],ymm3[4,5],ymm2[6,7]
974 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm1[0,2,2,3]
975 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[2,1,3,3]
976 ; ALL-NEXT:    vpblendd {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5],ymm1[6,7]
977 ; ALL-NEXT:    vinserti64x4 $1, %ymm2, %zmm0, %zmm0
978 ; ALL-NEXT:    retq
979   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 2, i32 10, i32 3, i32 11, i32 6, i32 14, i32 7, i32 15>
980   ret <8 x i64> %shuffle
981 }
982
983 define <8 x i64> @shuffle_v8i64_08192a3b(<8 x i64> %a, <8 x i64> %b) {
984 ; ALL-LABEL: shuffle_v8i64_08192a3b:
985 ; ALL:       # BB#0:
986 ; ALL-NEXT:    vpermq {{.*#+}} ymm2 = ymm1[0,2,2,3]
987 ; ALL-NEXT:    vpermq {{.*#+}} ymm3 = ymm0[2,1,3,3]
988 ; ALL-NEXT:    vpblendd {{.*#+}} ymm2 = ymm3[0,1],ymm2[2,3],ymm3[4,5],ymm2[6,7]
989 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm1[0,0,2,1]
990 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[0,1,1,3]
991 ; ALL-NEXT:    vpblendd {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5],ymm1[6,7]
992 ; ALL-NEXT:    vinserti64x4 $1, %ymm2, %zmm0, %zmm0
993 ; ALL-NEXT:    retq
994   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 8, i32 1, i32 9, i32 2, i32 10, i32 3, i32 11>
995   ret <8 x i64> %shuffle
996 }
997
998 define <8 x i64> @shuffle_v8i64_08991abb(<8 x i64> %a, <8 x i64> %b) {
999 ; ALL-LABEL: shuffle_v8i64_08991abb:
1000 ; ALL:       # BB#0:
1001 ; ALL-NEXT:    vpshufd {{.*#+}} ymm2 = ymm0[2,3,2,3,6,7,6,7]
1002 ; ALL-NEXT:    vpermq {{.*#+}} ymm3 = ymm1[0,2,3,3]
1003 ; ALL-NEXT:    vpblendd {{.*#+}} ymm2 = ymm2[0,1],ymm3[2,3,4,5,6,7]
1004 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm1[0,0,1,1]
1005 ; ALL-NEXT:    vpblendd {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3,4,5,6,7]
1006 ; ALL-NEXT:    vinserti64x4 $1, %ymm2, %zmm0, %zmm0
1007 ; ALL-NEXT:    retq
1008   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 8, i32 9, i32 9, i32 1, i32 10, i32 11, i32 11>
1009   ret <8 x i64> %shuffle
1010 }
1011
1012 define <8 x i64> @shuffle_v8i64_091b2d3f(<8 x i64> %a, <8 x i64> %b) {
1013 ; ALL-LABEL: shuffle_v8i64_091b2d3f:
1014 ; ALL:       # BB#0:
1015 ; ALL-NEXT:    vextracti64x4 $1, %zmm1, %ymm2
1016 ; ALL-NEXT:    vpermq {{.*#+}} ymm3 = ymm0[2,1,3,3]
1017 ; ALL-NEXT:    vpblendd {{.*#+}} ymm2 = ymm3[0,1],ymm2[2,3],ymm3[4,5],ymm2[6,7]
1018 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[0,1,1,3]
1019 ; ALL-NEXT:    vpblendd {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5],ymm1[6,7]
1020 ; ALL-NEXT:    vinserti64x4 $1, %ymm2, %zmm0, %zmm0
1021 ; ALL-NEXT:    retq
1022   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 9, i32 1, i32 11, i32 2, i32 13, i32 3, i32 15>
1023   ret <8 x i64> %shuffle
1024 }
1025
1026 define <8 x i64> @shuffle_v8i64_09ab1def(<8 x i64> %a, <8 x i64> %b) {
1027 ; ALL-LABEL: shuffle_v8i64_09ab1def:
1028 ; ALL:       # BB#0:
1029 ; ALL-NEXT:    vextracti64x4 $1, %zmm1, %ymm2
1030 ; ALL-NEXT:    vpshufd {{.*#+}} ymm3 = ymm0[2,3,2,3,6,7,6,7]
1031 ; ALL-NEXT:    vpblendd {{.*#+}} ymm2 = ymm3[0,1],ymm2[2,3,4,5,6,7]
1032 ; ALL-NEXT:    vpblendd {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3,4,5,6,7]
1033 ; ALL-NEXT:    vinserti64x4 $1, %ymm2, %zmm0, %zmm0
1034 ; ALL-NEXT:    retq
1035   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 9, i32 10, i32 11, i32 1, i32 13, i32 14, i32 15>
1036   ret <8 x i64> %shuffle
1037 }
1038
1039 define <8 x i64> @shuffle_v8i64_00014445(<8 x i64> %a, <8 x i64> %b) {
1040 ; ALL-LABEL: shuffle_v8i64_00014445:
1041 ; ALL:       # BB#0:
1042 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm0[0,0,0,1]
1043 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1044 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[0,0,0,1]
1045 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1046 ; ALL-NEXT:    retq
1047   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 0, i32 0, i32 1, i32 4, i32 4, i32 4, i32 5>
1048   ret <8 x i64> %shuffle
1049 }
1050
1051 define <8 x i64> @shuffle_v8i64_00204464(<8 x i64> %a, <8 x i64> %b) {
1052 ; ALL-LABEL: shuffle_v8i64_00204464:
1053 ; ALL:       # BB#0:
1054 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm0[0,0,2,0]
1055 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1056 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[0,0,2,0]
1057 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1058 ; ALL-NEXT:    retq
1059   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 0, i32 2, i32 0, i32 4, i32 4, i32 6, i32 4>
1060   ret <8 x i64> %shuffle
1061 }
1062
1063 define <8 x i64> @shuffle_v8i64_03004744(<8 x i64> %a, <8 x i64> %b) {
1064 ; ALL-LABEL: shuffle_v8i64_03004744:
1065 ; ALL:       # BB#0:
1066 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm0[0,3,0,0]
1067 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1068 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[0,3,0,0]
1069 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1070 ; ALL-NEXT:    retq
1071   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 3, i32 0, i32 0, i32 4, i32 7, i32 4, i32 4>
1072   ret <8 x i64> %shuffle
1073 }
1074
1075 define <8 x i64> @shuffle_v8i64_10005444(<8 x i64> %a, <8 x i64> %b) {
1076 ; ALL-LABEL: shuffle_v8i64_10005444:
1077 ; ALL:       # BB#0:
1078 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm0[1,0,0,0]
1079 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1080 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[1,0,0,0]
1081 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1082 ; ALL-NEXT:    retq
1083   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 1, i32 0, i32 0, i32 0, i32 5, i32 4, i32 4, i32 4>
1084   ret <8 x i64> %shuffle
1085 }
1086
1087 define <8 x i64> @shuffle_v8i64_22006644(<8 x i64> %a, <8 x i64> %b) {
1088 ; ALL-LABEL: shuffle_v8i64_22006644:
1089 ; ALL:       # BB#0:
1090 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm0[2,2,0,0]
1091 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1092 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[2,2,0,0]
1093 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1094 ; ALL-NEXT:    retq
1095   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 2, i32 2, i32 0, i32 0, i32 6, i32 6, i32 4, i32 4>
1096   ret <8 x i64> %shuffle
1097 }
1098
1099 define <8 x i64> @shuffle_v8i64_33307774(<8 x i64> %a, <8 x i64> %b) {
1100 ; ALL-LABEL: shuffle_v8i64_33307774:
1101 ; ALL:       # BB#0:
1102 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm0[3,3,3,0]
1103 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1104 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[3,3,3,0]
1105 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1106 ; ALL-NEXT:    retq
1107   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 3, i32 3, i32 3, i32 0, i32 7, i32 7, i32 7, i32 4>
1108   ret <8 x i64> %shuffle
1109 }
1110
1111 define <8 x i64> @shuffle_v8i64_32107654(<8 x i64> %a, <8 x i64> %b) {
1112 ; ALL-LABEL: shuffle_v8i64_32107654:
1113 ; ALL:       # BB#0:
1114 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm0[3,2,1,0]
1115 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1116 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[3,2,1,0]
1117 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1118 ; ALL-NEXT:    retq
1119   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 7, i32 6, i32 5, i32 4>
1120   ret <8 x i64> %shuffle
1121 }
1122
1123 define <8 x i64> @shuffle_v8i64_00234467(<8 x i64> %a, <8 x i64> %b) {
1124 ; ALL-LABEL: shuffle_v8i64_00234467:
1125 ; ALL:       # BB#0:
1126 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm0[0,0,2,3]
1127 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1128 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[0,0,2,3]
1129 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1130 ; ALL-NEXT:    retq
1131   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 0, i32 2, i32 3, i32 4, i32 4, i32 6, i32 7>
1132   ret <8 x i64> %shuffle
1133 }
1134
1135 define <8 x i64> @shuffle_v8i64_00224466(<8 x i64> %a, <8 x i64> %b) {
1136 ; ALL-LABEL: shuffle_v8i64_00224466:
1137 ; ALL:       # BB#0:
1138 ; ALL-NEXT:    vpshufd {{.*#+}} ymm1 = ymm0[0,1,0,1,4,5,4,5]
1139 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1140 ; ALL-NEXT:    vpshufd {{.*#+}} ymm0 = ymm0[0,1,0,1,4,5,4,5]
1141 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1142 ; ALL-NEXT:    retq
1143   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 0, i32 2, i32 2, i32 4, i32 4, i32 6, i32 6>
1144   ret <8 x i64> %shuffle
1145 }
1146
1147 define <8 x i64> @shuffle_v8i64_10325476(<8 x i64> %a, <8 x i64> %b) {
1148 ; ALL-LABEL: shuffle_v8i64_10325476:
1149 ; ALL:       # BB#0:
1150 ; ALL-NEXT:    vpshufd {{.*#+}} ymm1 = ymm0[2,3,0,1,6,7,4,5]
1151 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1152 ; ALL-NEXT:    vpshufd {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1153 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1154 ; ALL-NEXT:    retq
1155   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 1, i32 0, i32 3, i32 2, i32 5, i32 4, i32 7, i32 6>
1156   ret <8 x i64> %shuffle
1157 }
1158
1159 define <8 x i64> @shuffle_v8i64_11335577(<8 x i64> %a, <8 x i64> %b) {
1160 ; ALL-LABEL: shuffle_v8i64_11335577:
1161 ; ALL:       # BB#0:
1162 ; ALL-NEXT:    vpshufd {{.*#+}} ymm1 = ymm0[2,3,2,3,6,7,6,7]
1163 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1164 ; ALL-NEXT:    vpshufd {{.*#+}} ymm0 = ymm0[2,3,2,3,6,7,6,7]
1165 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1166 ; ALL-NEXT:    retq
1167   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 1, i32 1, i32 3, i32 3, i32 5, i32 5, i32 7, i32 7>
1168   ret <8 x i64> %shuffle
1169 }
1170
1171 define <8 x i64> @shuffle_v8i64_10235467(<8 x i64> %a, <8 x i64> %b) {
1172 ; ALL-LABEL: shuffle_v8i64_10235467:
1173 ; ALL:       # BB#0:
1174 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm0[1,0,2,3]
1175 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1176 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[1,0,2,3]
1177 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1178 ; ALL-NEXT:    retq
1179   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 1, i32 0, i32 2, i32 3, i32 5, i32 4, i32 6, i32 7>
1180   ret <8 x i64> %shuffle
1181 }
1182
1183 define <8 x i64> @shuffle_v8i64_10225466(<8 x i64> %a, <8 x i64> %b) {
1184 ; ALL-LABEL: shuffle_v8i64_10225466:
1185 ; ALL:       # BB#0:
1186 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm0[1,0,2,2]
1187 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1188 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[1,0,2,2]
1189 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1190 ; ALL-NEXT:    retq
1191   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 1, i32 0, i32 2, i32 2, i32 5, i32 4, i32 6, i32 6>
1192   ret <8 x i64> %shuffle
1193 }
1194
1195 define <8 x i64> @shuffle_v8i64_00015444(<8 x i64> %a, <8 x i64> %b) {
1196 ; ALL-LABEL: shuffle_v8i64_00015444:
1197 ; ALL:       # BB#0:
1198 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm0[0,0,0,1]
1199 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1200 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[1,0,0,0]
1201 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1202 ; ALL-NEXT:    retq
1203   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 0, i32 0, i32 1, i32 5, i32 4, i32 4, i32 4>
1204   ret <8 x i64> %shuffle
1205 }
1206
1207 define <8 x i64> @shuffle_v8i64_00204644(<8 x i64> %a, <8 x i64> %b) {
1208 ; ALL-LABEL: shuffle_v8i64_00204644:
1209 ; ALL:       # BB#0:
1210 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm0[0,0,2,0]
1211 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1212 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[0,2,0,0]
1213 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1214 ; ALL-NEXT:    retq
1215   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 0, i32 2, i32 0, i32 4, i32 6, i32 4, i32 4>
1216   ret <8 x i64> %shuffle
1217 }
1218
1219 define <8 x i64> @shuffle_v8i64_03004474(<8 x i64> %a, <8 x i64> %b) {
1220 ; ALL-LABEL: shuffle_v8i64_03004474:
1221 ; ALL:       # BB#0:
1222 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm0[0,3,0,0]
1223 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1224 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[0,0,3,0]
1225 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1226 ; ALL-NEXT:    retq
1227   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 3, i32 0, i32 0, i32 4, i32 4, i32 7, i32 4>
1228   ret <8 x i64> %shuffle
1229 }
1230
1231 define <8 x i64> @shuffle_v8i64_10004444(<8 x i64> %a, <8 x i64> %b) {
1232 ; ALL-LABEL: shuffle_v8i64_10004444:
1233 ; ALL:       # BB#0:
1234 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm0[1,0,0,0]
1235 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1236 ; ALL-NEXT:    vpbroadcastq %xmm0, %ymm0
1237 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1238 ; ALL-NEXT:    retq
1239   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 1, i32 0, i32 0, i32 0, i32 4, i32 4, i32 4, i32 4>
1240   ret <8 x i64> %shuffle
1241 }
1242
1243 define <8 x i64> @shuffle_v8i64_22006446(<8 x i64> %a, <8 x i64> %b) {
1244 ; ALL-LABEL: shuffle_v8i64_22006446:
1245 ; ALL:       # BB#0:
1246 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm0[2,2,0,0]
1247 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1248 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[2,0,0,2]
1249 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1250 ; ALL-NEXT:    retq
1251   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 2, i32 2, i32 0, i32 0, i32 6, i32 4, i32 4, i32 6>
1252   ret <8 x i64> %shuffle
1253 }
1254
1255 define <8 x i64> @shuffle_v8i64_33307474(<8 x i64> %a, <8 x i64> %b) {
1256 ; ALL-LABEL: shuffle_v8i64_33307474:
1257 ; ALL:       # BB#0:
1258 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm0[3,3,3,0]
1259 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1260 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[3,0,3,0]
1261 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1262 ; ALL-NEXT:    retq
1263   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 3, i32 3, i32 3, i32 0, i32 7, i32 4, i32 7, i32 4>
1264   ret <8 x i64> %shuffle
1265 }
1266
1267 define <8 x i64> @shuffle_v8i64_32104567(<8 x i64> %a, <8 x i64> %b) {
1268 ; ALL-LABEL: shuffle_v8i64_32104567:
1269 ; ALL:       # BB#0:
1270 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm0[3,2,1,0]
1271 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1272 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1273 ; ALL-NEXT:    retq
1274   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 4, i32 5, i32 6, i32 7>
1275   ret <8 x i64> %shuffle
1276 }
1277
1278 define <8 x i64> @shuffle_v8i64_00236744(<8 x i64> %a, <8 x i64> %b) {
1279 ; ALL-LABEL: shuffle_v8i64_00236744:
1280 ; ALL:       # BB#0:
1281 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm0[0,0,2,3]
1282 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1283 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[2,3,0,0]
1284 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1285 ; ALL-NEXT:    retq
1286   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 0, i32 2, i32 3, i32 6, i32 7, i32 4, i32 4>
1287   ret <8 x i64> %shuffle
1288 }
1289
1290 define <8 x i64> @shuffle_v8i64_00226644(<8 x i64> %a, <8 x i64> %b) {
1291 ; ALL-LABEL: shuffle_v8i64_00226644:
1292 ; ALL:       # BB#0:
1293 ; ALL-NEXT:    vpshufd {{.*#+}} ymm1 = ymm0[0,1,0,1,4,5,4,5]
1294 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1295 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[2,2,0,0]
1296 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1297 ; ALL-NEXT:    retq
1298   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 0, i32 2, i32 2, i32 6, i32 6, i32 4, i32 4>
1299   ret <8 x i64> %shuffle
1300 }
1301
1302 define <8 x i64> @shuffle_v8i64_10324567(<8 x i64> %a, <8 x i64> %b) {
1303 ; ALL-LABEL: shuffle_v8i64_10324567:
1304 ; ALL:       # BB#0:
1305 ; ALL-NEXT:    vpshufd {{.*#+}} ymm1 = ymm0[2,3,0,1,6,7,4,5]
1306 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1307 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1308 ; ALL-NEXT:    retq
1309   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 1, i32 0, i32 3, i32 2, i32 4, i32 5, i32 6, i32 7>
1310   ret <8 x i64> %shuffle
1311 }
1312
1313 define <8 x i64> @shuffle_v8i64_11334567(<8 x i64> %a, <8 x i64> %b) {
1314 ; ALL-LABEL: shuffle_v8i64_11334567:
1315 ; ALL:       # BB#0:
1316 ; ALL-NEXT:    vpshufd {{.*#+}} ymm1 = ymm0[2,3,2,3,6,7,6,7]
1317 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1318 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1319 ; ALL-NEXT:    retq
1320   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 1, i32 1, i32 3, i32 3, i32 4, i32 5, i32 6, i32 7>
1321   ret <8 x i64> %shuffle
1322 }
1323
1324 define <8 x i64> @shuffle_v8i64_01235467(<8 x i64> %a, <8 x i64> %b) {
1325 ; ALL-LABEL: shuffle_v8i64_01235467:
1326 ; ALL:       # BB#0:
1327 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm1
1328 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm1[1,0,2,3]
1329 ; ALL-NEXT:    vinserti64x4 $1, %ymm1, %zmm0, %zmm0
1330 ; ALL-NEXT:    retq
1331   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 5, i32 4, i32 6, i32 7>
1332   ret <8 x i64> %shuffle
1333 }
1334
1335 define <8 x i64> @shuffle_v8i64_01235466(<8 x i64> %a, <8 x i64> %b) {
1336 ; ALL-LABEL: shuffle_v8i64_01235466:
1337 ; ALL:       # BB#0:
1338 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm1
1339 ; ALL-NEXT:    vpermq {{.*#+}} ymm1 = ymm1[1,0,2,2]
1340 ; ALL-NEXT:    vinserti64x4 $1, %ymm1, %zmm0, %zmm0
1341 ; ALL-NEXT:    retq
1342   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 5, i32 4, i32 6, i32 6>
1343   ret <8 x i64> %shuffle
1344 }
1345
1346 define <8 x i64> @shuffle_v8i64_002u6u44(<8 x i64> %a, <8 x i64> %b) {
1347 ; ALL-LABEL: shuffle_v8i64_002u6u44:
1348 ; ALL:       # BB#0:
1349 ; ALL-NEXT:    vpshufd {{.*#+}} ymm1 = ymm0[0,1,0,1,4,5,4,5]
1350 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1351 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[2,1,0,0]
1352 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1353 ; ALL-NEXT:    retq
1354   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 0, i32 2, i32 undef, i32 6, i32 undef, i32 4, i32 4>
1355   ret <8 x i64> %shuffle
1356 }
1357
1358 define <8 x i64> @shuffle_v8i64_00uu66uu(<8 x i64> %a, <8 x i64> %b) {
1359 ; ALL-LABEL: shuffle_v8i64_00uu66uu:
1360 ; ALL:       # BB#0:
1361 ; ALL-NEXT:    vpbroadcastq %xmm0, %ymm1
1362 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1363 ; ALL-NEXT:    vpermq {{.*#+}} ymm0 = ymm0[2,2,2,3]
1364 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1365 ; ALL-NEXT:    retq
1366   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 0, i32 undef, i32 undef, i32 6, i32 6, i32 undef, i32 undef>
1367   ret <8 x i64> %shuffle
1368 }
1369
1370 define <8 x i64> @shuffle_v8i64_103245uu(<8 x i64> %a, <8 x i64> %b) {
1371 ; ALL-LABEL: shuffle_v8i64_103245uu:
1372 ; ALL:       # BB#0:
1373 ; ALL-NEXT:    vpshufd {{.*#+}} ymm1 = ymm0[2,3,0,1,6,7,4,5]
1374 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1375 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1376 ; ALL-NEXT:    retq
1377   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 1, i32 0, i32 3, i32 2, i32 4, i32 5, i32 undef, i32 undef>
1378   ret <8 x i64> %shuffle
1379 }
1380
1381 define <8 x i64> @shuffle_v8i64_1133uu67(<8 x i64> %a, <8 x i64> %b) {
1382 ; ALL-LABEL: shuffle_v8i64_1133uu67:
1383 ; ALL:       # BB#0:
1384 ; ALL-NEXT:    vpshufd {{.*#+}} ymm1 = ymm0[2,3,2,3,6,7,6,7]
1385 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1386 ; ALL-NEXT:    vinserti64x4 $1, %ymm0, %zmm1, %zmm0
1387 ; ALL-NEXT:    retq
1388   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 1, i32 1, i32 3, i32 3, i32 undef, i32 undef, i32 6, i32 7>
1389   ret <8 x i64> %shuffle
1390 }
1391
1392 define <8 x i64> @shuffle_v8i64_0uu354uu(<8 x i64> %a, <8 x i64> %b) {
1393 ; ALL-LABEL: shuffle_v8i64_0uu354uu:
1394 ; ALL:       # BB#0:
1395 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm1
1396 ; ALL-NEXT:    vpshufd {{.*#+}} ymm1 = ymm1[2,3,0,1,6,7,4,5]
1397 ; ALL-NEXT:    vinserti64x4 $1, %ymm1, %zmm0, %zmm0
1398 ; ALL-NEXT:    retq
1399   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 0, i32 undef, i32 undef, i32 3, i32 5, i32 4, i32 undef, i32 undef>
1400   ret <8 x i64> %shuffle
1401 }
1402
1403 define <8 x i64> @shuffle_v8i64_uuu3uu66(<8 x i64> %a, <8 x i64> %b) {
1404 ; ALL-LABEL: shuffle_v8i64_uuu3uu66:
1405 ; ALL:       # BB#0:
1406 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm1
1407 ; ALL-NEXT:    vpshufd {{.*#+}} ymm1 = ymm1[0,1,0,1,4,5,4,5]
1408 ; ALL-NEXT:    vinserti64x4 $1, %ymm1, %zmm0, %zmm0
1409 ; ALL-NEXT:    retq
1410   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 undef, i32 undef, i32 undef, i32 3, i32 undef, i32 undef, i32 6, i32 6>
1411   ret <8 x i64> %shuffle
1412 }
1413
1414 define <8 x i64> @shuffle_v8i64_6caa87e5(<8 x i64> %a, <8 x i64> %b) {
1415 ; ALL-LABEL: shuffle_v8i64_6caa87e5:
1416 ; ALL:       # BB#0:
1417 ; ALL-NEXT:    vextracti64x4 $1, %zmm0, %ymm0
1418 ; ALL-NEXT:    vperm2i128 {{.*#+}} ymm2 = ymm0[0,1,0,1]
1419 ; ALL-NEXT:    vextracti64x4 $1, %zmm1, %ymm3
1420 ; ALL-NEXT:    vpblendd {{.*#+}} ymm4 = ymm1[0,1,2,3],ymm3[4,5],ymm1[6,7]
1421 ; ALL-NEXT:    vpblendd {{.*#+}} ymm2 = ymm4[0,1],ymm2[2,3],ymm4[4,5],ymm2[6,7]
1422 ; ALL-NEXT:    vperm2i128 {{.*#+}} ymm0 = ymm0[2,3,0,1]
1423 ; ALL-NEXT:    vpshufd {{.*#+}} ymm1 = ymm1[0,1,0,1,4,5,4,5]
1424 ; ALL-NEXT:    vpbroadcastq %xmm3, %ymm3
1425 ; ALL-NEXT:    vpblendd {{.*#+}} ymm1 = ymm1[0,1],ymm3[2,3],ymm1[4,5,6,7]
1426 ; ALL-NEXT:    vpblendd {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3,4,5,6,7]
1427 ; ALL-NEXT:    vinserti64x4 $1, %ymm2, %zmm0, %zmm0
1428 ; ALL-NEXT:    retq
1429   %shuffle = shufflevector <8 x i64> %a, <8 x i64> %b, <8 x i32> <i32 6, i32 12, i32 10, i32 10, i32 8, i32 7, i32 14, i32 5>
1430   ret <8 x i64> %shuffle
1431 }