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