1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple aarch64-apple-ios -run-pass=aarch64-prelegalizer-combiner %s -o - | FileCheck %s
4 # Check that we canonicalize shuffle_vector(Src1, Src2, mask(0,1,2,3))
5 # into concat_vector(Src1, Src2).
7 name: shuffle_vector_to_concat_vector_0123
8 tracksRegLiveness: true
13 ; CHECK-LABEL: name: shuffle_vector_to_concat_vector_0123
14 ; CHECK: liveins: $d0, $d1
16 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
17 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $d1
18 ; CHECK-NEXT: [[CONCAT_VECTORS:%[0-9]+]]:_(<4 x s32>) = G_CONCAT_VECTORS [[COPY]](<2 x s32>), [[COPY1]](<2 x s32>)
19 ; CHECK-NEXT: RET_ReallyLR implicit [[CONCAT_VECTORS]](<4 x s32>)
20 %0:_(<2 x s32>) = COPY $d0
21 %1:_(<2 x s32>) = COPY $d1
22 %2:_(<4 x s32>) = G_SHUFFLE_VECTOR %0(<2 x s32>), %1(<2 x s32>), shufflemask(0, 1, 2, 3)
23 RET_ReallyLR implicit %2
25 # Check that we canonicalize shuffle_vector(Src1, Src2, mask(2,3,0,1,2,3))
26 # into concat_vector(Src2, Src1, Src2).
28 name: shuffle_vector_to_concat_vector_230123
29 tracksRegLiveness: true
34 ; CHECK-LABEL: name: shuffle_vector_to_concat_vector_230123
35 ; CHECK: liveins: $d0, $d1
37 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
38 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $d1
39 ; CHECK-NEXT: [[CONCAT_VECTORS:%[0-9]+]]:_(<6 x s32>) = G_CONCAT_VECTORS [[COPY1]](<2 x s32>), [[COPY]](<2 x s32>), [[COPY1]](<2 x s32>)
40 ; CHECK-NEXT: RET_ReallyLR implicit [[CONCAT_VECTORS]](<6 x s32>)
41 %0:_(<2 x s32>) = COPY $d0
42 %1:_(<2 x s32>) = COPY $d1
43 %2:_(<6 x s32>) = G_SHUFFLE_VECTOR %0(<2 x s32>), %1(<2 x s32>), shufflemask(2,3,0,1,2,3)
44 RET_ReallyLR implicit %2
46 # Check that we canonicalize shuffle_vector(Src1, Src2, mask(2,undef,0,1,undef,3))
47 # into concat_vector(Src2, Src1, Src2).
49 name: shuffle_vector_to_concat_vector_2undef01undef3
50 tracksRegLiveness: true
55 ; CHECK-LABEL: name: shuffle_vector_to_concat_vector_2undef01undef3
56 ; CHECK: liveins: $d0, $d1
58 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
59 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $d1
60 ; CHECK-NEXT: [[CONCAT_VECTORS:%[0-9]+]]:_(<6 x s32>) = G_CONCAT_VECTORS [[COPY1]](<2 x s32>), [[COPY]](<2 x s32>), [[COPY1]](<2 x s32>)
61 ; CHECK-NEXT: RET_ReallyLR implicit [[CONCAT_VECTORS]](<6 x s32>)
62 %0:_(<2 x s32>) = COPY $d0
63 %1:_(<2 x s32>) = COPY $d1
64 %2:_(<6 x s32>) = G_SHUFFLE_VECTOR %0(<2 x s32>), %1(<2 x s32>), shufflemask(2,-1,0,1,-1,3)
65 RET_ReallyLR implicit %2
67 # Check that we don't canonicalize shuffle_vector into concat_vectors
68 # when the sources get half mixed.
70 name: shuffle_vector_to_concat_vector_mixed_src_200123_neg
71 tracksRegLiveness: true
76 ; CHECK-LABEL: name: shuffle_vector_to_concat_vector_mixed_src_200123_neg
77 ; CHECK: liveins: $d0, $d1
79 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
80 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $d1
81 ; CHECK-NEXT: [[SHUF:%[0-9]+]]:_(<6 x s32>) = G_SHUFFLE_VECTOR [[COPY]](<2 x s32>), [[COPY1]], shufflemask(2, 0, 0, 1, 2, 3)
82 ; CHECK-NEXT: RET_ReallyLR implicit [[SHUF]](<6 x s32>)
83 %0:_(<2 x s32>) = COPY $d0
84 %1:_(<2 x s32>) = COPY $d1
85 %2:_(<6 x s32>) = G_SHUFFLE_VECTOR %0(<2 x s32>), %1(<2 x s32>), shufflemask(2,0,0,1,2,3)
86 RET_ReallyLR implicit %2
88 # Check that we produce implicit_def while canonicalizing shuffle_vector(Src1, Src2, mask(2,undef,undef,undef,undef,1))
89 # into concat_vector(Src2, undef, Src1).
91 name: shuffle_vector_to_concat_vector_2undef1
92 tracksRegLiveness: true
97 ; CHECK-LABEL: name: shuffle_vector_to_concat_vector_2undef1
98 ; CHECK: liveins: $d0, $d1
100 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
101 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $d1
102 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(<2 x s32>) = G_IMPLICIT_DEF
103 ; CHECK-NEXT: [[CONCAT_VECTORS:%[0-9]+]]:_(<6 x s32>) = G_CONCAT_VECTORS [[COPY1]](<2 x s32>), [[DEF]](<2 x s32>), [[COPY]](<2 x s32>)
104 ; CHECK-NEXT: RET_ReallyLR implicit [[CONCAT_VECTORS]](<6 x s32>)
105 %0:_(<2 x s32>) = COPY $d0
106 %1:_(<2 x s32>) = COPY $d1
107 %2:_(<6 x s32>) = G_SHUFFLE_VECTOR %0(<2 x s32>), %1(<2 x s32>), shufflemask(2,-1,-1,-1,-1,1)
108 RET_ReallyLR implicit %2
110 # Check that we don't canonicalize shuffle_vector into concat_vectors
111 # if a source is flipped.
113 name: shuffle_vector_to_concat_vector_src_flipped_230132_neg
114 tracksRegLiveness: true
119 ; CHECK-LABEL: name: shuffle_vector_to_concat_vector_src_flipped_230132_neg
120 ; CHECK: liveins: $d0, $d1
122 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
123 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $d1
124 ; CHECK-NEXT: [[SHUF:%[0-9]+]]:_(<6 x s32>) = G_SHUFFLE_VECTOR [[COPY]](<2 x s32>), [[COPY1]], shufflemask(2, 3, 0, 1, 3, 2)
125 ; CHECK-NEXT: RET_ReallyLR implicit [[SHUF]](<6 x s32>)
126 %0:_(<2 x s32>) = COPY $d0
127 %1:_(<2 x s32>) = COPY $d1
128 %2:_(<6 x s32>) = G_SHUFFLE_VECTOR %0(<2 x s32>), %1(<2 x s32>), shufflemask(2,3,0,1,3,2)
129 RET_ReallyLR implicit %2
131 # Check that we don't canonicalize shuffle_vector into concat_vectors
132 # if a source is flipped and the other half is undef.
134 name: shuffle_vector_to_concat_vector_src_flipped_23013undef_neg
135 tracksRegLiveness: true
140 ; CHECK-LABEL: name: shuffle_vector_to_concat_vector_src_flipped_23013undef_neg
141 ; CHECK: liveins: $d0, $d1
143 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $d0
144 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s32>) = COPY $d1
145 ; CHECK-NEXT: [[SHUF:%[0-9]+]]:_(<6 x s32>) = G_SHUFFLE_VECTOR [[COPY]](<2 x s32>), [[COPY1]], shufflemask(2, 3, 0, 1, 3, undef)
146 ; CHECK-NEXT: RET_ReallyLR implicit [[SHUF]](<6 x s32>)
147 %0:_(<2 x s32>) = COPY $d0
148 %1:_(<2 x s32>) = COPY $d1
149 %2:_(<6 x s32>) = G_SHUFFLE_VECTOR %0(<2 x s32>), %1(<2 x s32>), shufflemask(2,3,0,1,3,-1)
150 RET_ReallyLR implicit %2
153 # Check that we canonicalize shuffle_vector(Src1, Src2, mask(0,1,2,3,4,5,6,7))
154 # into concat_vector(Src1, Src2) with bigger vector type.
156 name: shuffle_vector_to_concat_vector_01234567
157 tracksRegLiveness: true
162 ; CHECK-LABEL: name: shuffle_vector_to_concat_vector_01234567
163 ; CHECK: liveins: $q0, $q1
165 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
166 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
167 ; CHECK-NEXT: [[CONCAT_VECTORS:%[0-9]+]]:_(<8 x s32>) = G_CONCAT_VECTORS [[COPY]](<4 x s32>), [[COPY1]](<4 x s32>)
168 ; CHECK-NEXT: RET_ReallyLR implicit [[CONCAT_VECTORS]](<8 x s32>)
169 %0:_(<4 x s32>) = COPY $q0
170 %1:_(<4 x s32>) = COPY $q1
171 %2:_(<8 x s32>) = G_SHUFFLE_VECTOR %0(<4 x s32>), %1(<4 x s32>), shufflemask(0, 1, 2, 3, 4, 5, 6, 7)
172 RET_ReallyLR implicit %2
174 # Check that we canonicalize shuffle_vector(Src1, Src2, mask(4,5,6,7,0,1,2,3))
175 # into concat_vector(Src2, Src1, Src2) with bigger vector type.
177 name: shuffle_vector_to_concat_vector_45670123
178 tracksRegLiveness: true
183 ; CHECK-LABEL: name: shuffle_vector_to_concat_vector_45670123
184 ; CHECK: liveins: $q0, $q1
186 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
187 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
188 ; CHECK-NEXT: [[CONCAT_VECTORS:%[0-9]+]]:_(<12 x s32>) = G_CONCAT_VECTORS [[COPY1]](<4 x s32>), [[COPY]](<4 x s32>), [[COPY1]](<4 x s32>)
189 ; CHECK-NEXT: RET_ReallyLR implicit [[CONCAT_VECTORS]](<12 x s32>)
190 %0:_(<4 x s32>) = COPY $q0
191 %1:_(<4 x s32>) = COPY $q1
192 %2:_(<12 x s32>) = G_SHUFFLE_VECTOR %0(<4 x s32>), %1(<4 x s32>), shufflemask(4,5,6,7,0,1,2,3,4,5,6,7)
193 RET_ReallyLR implicit %2
195 # Check that we canonicalize shuffle_vector(Src1, Src2, mask(4,5,undef,undef,0,1,2,3,undef,undef,6,7))
196 # into concat_vector(Src2, Src1, Src2) with bigger vector type.
198 name: shuffle_vector_to_concat_vector_45undefundef0123undefundef67
199 tracksRegLiveness: true
204 ; CHECK-LABEL: name: shuffle_vector_to_concat_vector_45undefundef0123undefundef67
205 ; CHECK: liveins: $q0, $q1
207 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
208 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
209 ; CHECK-NEXT: [[CONCAT_VECTORS:%[0-9]+]]:_(<12 x s32>) = G_CONCAT_VECTORS [[COPY1]](<4 x s32>), [[COPY]](<4 x s32>), [[COPY1]](<4 x s32>)
210 ; CHECK-NEXT: RET_ReallyLR implicit [[CONCAT_VECTORS]](<12 x s32>)
211 %0:_(<4 x s32>) = COPY $q0
212 %1:_(<4 x s32>) = COPY $q1
213 %2:_(<12 x s32>) = G_SHUFFLE_VECTOR %0(<4 x s32>), %1(<4 x s32>), shufflemask(4,5,-1,-1,0,1,2,3,-1,-1,6,7)
214 RET_ReallyLR implicit %2
216 # Check that we don't canonicalize shuffle_vector into concat_vectors
217 # when the sources get half mixed with bigger vector type.
219 name: shuffle_vector_to_concat_vector_mixed_src_456000123_neg
220 tracksRegLiveness: true
225 ; CHECK-LABEL: name: shuffle_vector_to_concat_vector_mixed_src_456000123_neg
226 ; CHECK: liveins: $q0, $q1
228 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
229 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
230 ; CHECK-NEXT: [[SHUF:%[0-9]+]]:_(<8 x s32>) = G_SHUFFLE_VECTOR [[COPY]](<4 x s32>), [[COPY1]], shufflemask(4, 5, 6, 0, 0, 1, 2, 3)
231 ; CHECK-NEXT: RET_ReallyLR implicit [[SHUF]](<8 x s32>)
232 %0:_(<4 x s32>) = COPY $q0
233 %1:_(<4 x s32>) = COPY $q1
234 %2:_(<8 x s32>) = G_SHUFFLE_VECTOR %0(<4 x s32>), %1(<4 x s32>), shufflemask(4,5,6,0,0,1,2,3)
235 RET_ReallyLR implicit %2
237 # Check that we produce implicit_def while canonicalizing shuffle_vector(Src1, Src2, mask(2,undef,undef,undef,undef,1))
238 # into concat_vector(Src2, undef, Src1) with bigger vector type.
240 name: shuffle_vector_to_concat_vector_45undefundefundefundefundefundefundefundef23
241 tracksRegLiveness: true
246 ; CHECK-LABEL: name: shuffle_vector_to_concat_vector_45undefundefundefundefundefundefundefundef23
247 ; CHECK: liveins: $q0, $q1
249 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
250 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
251 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(<4 x s32>) = G_IMPLICIT_DEF
252 ; CHECK-NEXT: [[CONCAT_VECTORS:%[0-9]+]]:_(<12 x s32>) = G_CONCAT_VECTORS [[COPY1]](<4 x s32>), [[DEF]](<4 x s32>), [[COPY]](<4 x s32>)
253 ; CHECK-NEXT: RET_ReallyLR implicit [[CONCAT_VECTORS]](<12 x s32>)
254 %0:_(<4 x s32>) = COPY $q0
255 %1:_(<4 x s32>) = COPY $q1
256 %2:_(<12 x s32>) = G_SHUFFLE_VECTOR %0(<4 x s32>), %1(<4 x s32>), shufflemask(4,5,-1,-1,-1,-1,-1,-1,-1,-1,2,3)
257 RET_ReallyLR implicit %2
259 # Check that we don't canonicalize shuffle_vector into concat_vectors
260 # when we grab less than the full vectors.
262 name: shuffle_vector_to_concat_vector_4501_neg
263 tracksRegLiveness: true
268 ; CHECK-LABEL: name: shuffle_vector_to_concat_vector_4501_neg
269 ; CHECK: liveins: $q0, $q1
271 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
272 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
273 ; CHECK-NEXT: [[SHUF:%[0-9]+]]:_(<4 x s32>) = G_SHUFFLE_VECTOR [[COPY]](<4 x s32>), [[COPY1]], shufflemask(4, 5, 0, 1)
274 ; CHECK-NEXT: RET_ReallyLR implicit [[SHUF]](<4 x s32>)
275 %0:_(<4 x s32>) = COPY $q0
276 %1:_(<4 x s32>) = COPY $q1
277 %2:_(<4 x s32>) = G_SHUFFLE_VECTOR %0(<4 x s32>), %1(<4 x s32>), shufflemask(4,5,0,1)
278 RET_ReallyLR implicit %2
280 # Check that we don't canonicalize shuffle_vector into concat_vectors
281 # if a source is flipped and the other half is undef with bigger vector.
283 name: shuffle_vector_to_concat_vector_src_flipped_4567012367undefundef_neg
284 tracksRegLiveness: true
289 ; CHECK-LABEL: name: shuffle_vector_to_concat_vector_src_flipped_4567012367undefundef_neg
290 ; CHECK: liveins: $q0, $q1
292 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
293 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x s32>) = COPY $q1
294 ; CHECK-NEXT: [[SHUF:%[0-9]+]]:_(<12 x s32>) = G_SHUFFLE_VECTOR [[COPY]](<4 x s32>), [[COPY1]], shufflemask(4, 5, 6, 7, 0, 1, 2, 3, 6, 7, undef, undef)
295 ; CHECK-NEXT: RET_ReallyLR implicit [[SHUF]](<12 x s32>)
296 %0:_(<4 x s32>) = COPY $q0
297 %1:_(<4 x s32>) = COPY $q1
298 %2:_(<12 x s32>) = G_SHUFFLE_VECTOR %0(<4 x s32>), %1(<4 x s32>), shufflemask(4,5,6,7,0,1,2,3,6,7,-1,-1)
299 RET_ReallyLR implicit %2
301 # Check that we canonicalize shuffle_vector(Src1, Src2, mask(4,5,undef,undef,0,1,2,3,undef,undef,6,7))
302 # into concat_vector(Src2, Src1, Src2) with vector of pointers.
304 name: shuffle_vector_to_concat_vector_45undefundef0123undefundef67_ptr
305 tracksRegLiveness: true
308 liveins: $q0_q1, $q2_q3
310 ; CHECK-LABEL: name: shuffle_vector_to_concat_vector_45undefundef0123undefundef67_ptr
311 ; CHECK: liveins: $q0_q1, $q2_q3
313 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x p0>) = COPY $q0_q1
314 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x p0>) = COPY $q2_q3
315 ; CHECK-NEXT: [[CONCAT_VECTORS:%[0-9]+]]:_(<12 x p0>) = G_CONCAT_VECTORS [[COPY1]](<4 x p0>), [[COPY]](<4 x p0>), [[COPY1]](<4 x p0>)
316 ; CHECK-NEXT: RET_ReallyLR implicit [[CONCAT_VECTORS]](<12 x p0>)
317 %0:_(<4 x p0>) = COPY $q0_q1
318 %1:_(<4 x p0>) = COPY $q2_q3
319 %2:_(<12 x p0>) = G_SHUFFLE_VECTOR %0(<4 x p0>), %1(<4 x p0>), shufflemask(4,5,-1,-1,0,1,2,3,-1,-1,6,7)
320 RET_ReallyLR implicit %2
322 # Check that we don't canonicalize shuffle_vector into concat_vectors
323 # when the sources get half mixed with vector of pointers.
325 name: shuffle_vector_to_concat_vector_mixed_src_456000123_neg_ptr
326 tracksRegLiveness: true
329 liveins: $q0_q1, $q2_q3
331 ; CHECK-LABEL: name: shuffle_vector_to_concat_vector_mixed_src_456000123_neg_ptr
332 ; CHECK: liveins: $q0_q1, $q2_q3
334 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<4 x p0>) = COPY $q0_q1
335 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<4 x p0>) = COPY $q2_q3
336 ; CHECK-NEXT: [[SHUF:%[0-9]+]]:_(<8 x p0>) = G_SHUFFLE_VECTOR [[COPY]](<4 x p0>), [[COPY1]], shufflemask(4, 5, 6, 0, 0, 1, 2, 3)
337 ; CHECK-NEXT: RET_ReallyLR implicit [[SHUF]](<8 x p0>)
338 %0:_(<4 x p0>) = COPY $q0_q1
339 %1:_(<4 x p0>) = COPY $q2_q3
340 %2:_(<8 x p0>) = G_SHUFFLE_VECTOR %0(<4 x p0>), %1(<4 x p0>), shufflemask(4,5,6,0,0,1,2,3)
341 RET_ReallyLR implicit %2
344 # Check that shuffle_vector gets combined into concat_vectors then the
345 # concat_vectors gets combined into build_vector.
347 name: shuffle_vector_to_build_vector_ptr
348 tracksRegLiveness: true
351 liveins: $x0, $x1, $x2, $x3
353 ; CHECK-LABEL: name: shuffle_vector_to_build_vector_ptr
354 ; CHECK: liveins: $x0, $x1, $x2, $x3
356 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
357 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x1
358 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(p0) = COPY $x2
359 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(p0) = COPY $x3
360 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x p0>) = G_BUILD_VECTOR [[COPY]](p0), [[COPY1]](p0), [[COPY2]](p0), [[COPY3]](p0)
361 ; CHECK-NEXT: RET_ReallyLR implicit [[BUILD_VECTOR]](<4 x p0>)
366 %4:_(<2 x p0>) = G_BUILD_VECTOR %0(p0), %1
367 %5:_(<2 x p0>) = G_BUILD_VECTOR %2(p0), %3
368 %6:_(<4 x p0>) = G_SHUFFLE_VECTOR %4(<2 x p0>), %5(<2 x p0>), shufflemask(0,1,2,3)
369 RET_ReallyLR implicit %6
372 # Check that shuffle_vector on scalars gets combined into build_vector.
374 name: shuffle_vector_on_scalars_to_build_vector_ptr
375 tracksRegLiveness: true
380 ; CHECK-LABEL: name: shuffle_vector_on_scalars_to_build_vector_ptr
381 ; CHECK: liveins: $x0, $x1
383 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
384 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x1
385 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x p0>) = G_BUILD_VECTOR [[COPY]](p0), [[COPY1]](p0), [[COPY]](p0), [[COPY1]](p0)
386 ; CHECK-NEXT: RET_ReallyLR implicit [[BUILD_VECTOR]](<4 x p0>)
389 %6:_(<4 x p0>) = G_SHUFFLE_VECTOR %0, %1, shufflemask(0,1,0,1)
390 RET_ReallyLR implicit %6
393 # Check that shuffle_vector on scalars gets combined into build_vector,
394 # even if we swap the order of the operands.
396 name: shuffle_vector_on_scalars_to_build_vector_swap_ptr
397 tracksRegLiveness: true
402 ; CHECK-LABEL: name: shuffle_vector_on_scalars_to_build_vector_swap_ptr
403 ; CHECK: liveins: $x0, $x1
405 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
406 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x1
407 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x p0>) = G_BUILD_VECTOR [[COPY1]](p0), [[COPY]](p0)
408 ; CHECK-NEXT: RET_ReallyLR implicit [[BUILD_VECTOR]](<2 x p0>)
411 %6:_(<2 x p0>) = G_SHUFFLE_VECTOR %0, %1, shufflemask(1,0)
412 RET_ReallyLR implicit %6
415 # Check that we properly use undef values when shuffle_vector
416 # on scalars gets lowered to build_vector.
418 name: shuffle_vector_on_scalars_to_build_vector_with_undef
419 tracksRegLiveness: true
424 ; CHECK-LABEL: name: shuffle_vector_on_scalars_to_build_vector_with_undef
425 ; CHECK: liveins: $x0, $x1
427 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
428 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
429 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s64) = G_IMPLICIT_DEF
430 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<4 x s64>) = G_BUILD_VECTOR [[COPY]](s64), [[DEF]](s64), [[DEF]](s64), [[COPY1]](s64)
431 ; CHECK-NEXT: RET_ReallyLR implicit [[BUILD_VECTOR]](<4 x s64>)
434 %6:_(<4 x s64>) = G_SHUFFLE_VECTOR %0, %1, shufflemask(0,-1,-1,1)
435 RET_ReallyLR implicit %6
438 # Check that shuffle_vector on scalars gets combined into a plain
439 # copy when the resulting type is a scalar as well and the sizes
442 name: shuffle_vector_on_scalars_to_copy_ptr
443 tracksRegLiveness: true
448 ; CHECK-LABEL: name: shuffle_vector_on_scalars_to_copy_ptr
449 ; CHECK: liveins: $x0
451 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
452 ; CHECK-NEXT: RET_ReallyLR implicit [[COPY]](p0)
454 %6:_(p0) = G_SHUFFLE_VECTOR %0, %0, shufflemask(0)
455 RET_ReallyLR implicit %6
458 name: shuffle_vector_to_copy_lhs
459 tracksRegLiveness: true
464 ; CHECK-LABEL: name: shuffle_vector_to_copy_lhs
465 ; CHECK: liveins: $x0, $x1
467 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $x0
468 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
469 ; CHECK-NEXT: [[EVEC:%[0-9]+]]:_(s32) = G_EXTRACT_VECTOR_ELT [[COPY]](<2 x s32>), [[C]](s64)
470 ; CHECK-NEXT: RET_ReallyLR implicit [[EVEC]](s32)
471 %0:_(<2 x s32>) = COPY $x0
472 %1:_(<2 x s32>) = COPY $x1
473 %6:_(s32) = G_SHUFFLE_VECTOR %0, %1, shufflemask(1)
474 RET_ReallyLR implicit %6
477 name: shuffle_vector_to_copy_rhs
478 tracksRegLiveness: true
483 ; CHECK-LABEL: name: shuffle_vector_to_copy_rhs
484 ; CHECK: liveins: $x0, $x1
486 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $x1
487 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
488 ; CHECK-NEXT: [[EVEC:%[0-9]+]]:_(s32) = G_EXTRACT_VECTOR_ELT [[COPY]](<2 x s32>), [[C]](s64)
489 ; CHECK-NEXT: RET_ReallyLR implicit [[EVEC]](s32)
490 %0:_(<2 x s32>) = COPY $x0
491 %1:_(<2 x s32>) = COPY $x1
492 %6:_(s32) = G_SHUFFLE_VECTOR %0, %1, shufflemask(2)
493 RET_ReallyLR implicit %6
496 name: shuffle_vector_to_copy_undef
497 tracksRegLiveness: true
502 ; CHECK-LABEL: name: shuffle_vector_to_copy_undef
503 ; CHECK: liveins: $x0, $x1
505 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
506 ; CHECK-NEXT: RET_ReallyLR implicit [[DEF]](s32)
507 %0:_(<2 x s32>) = COPY $x0
508 %1:_(<2 x s32>) = COPY $x1
509 %6:_(s32) = G_SHUFFLE_VECTOR %0, %1, shufflemask(-1)
510 RET_ReallyLR implicit %6