1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple aarch64 -run-pass=aarch64-prelegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s
7 tracksRegLiveness: true
11 ; or (sext X), (sext Y) --> sext (or X, Y)
13 ; CHECK-LABEL: name: or_combine_sext
14 ; CHECK: liveins: $w0, $w1
15 ; CHECK: %x:_(s32) = COPY $w0
16 ; CHECK: %y:_(s32) = COPY $w1
17 ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR %x, %y
18 ; CHECK: %logic_op:_(s64) = G_SEXT [[OR]](s32)
19 ; CHECK: $x0 = COPY %logic_op(s64)
20 ; CHECK: RET_ReallyLR implicit $x0
23 %hand1:_(s64) = G_SEXT %x(s32)
24 %hand2:_(s64) = G_SEXT %y(s32)
25 %logic_op:_(s64) = G_OR %hand1, %hand2
26 $x0 = COPY %logic_op(s64)
27 RET_ReallyLR implicit $x0
32 tracksRegLiveness: true
36 ; or (zext X), (zext Y) --> zext (or X, Y)
38 ; CHECK-LABEL: name: or_combine_zext
39 ; CHECK: liveins: $w0, $w1
40 ; CHECK: %x:_(s32) = COPY $w0
41 ; CHECK: %y:_(s32) = COPY $w1
42 ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR %x, %y
43 ; CHECK: %logic_op:_(s64) = G_ZEXT [[OR]](s32)
44 ; CHECK: $x0 = COPY %logic_op(s64)
45 ; CHECK: RET_ReallyLR implicit $x0
48 %hand1:_(s64) = G_ZEXT %x(s32)
49 %hand2:_(s64) = G_ZEXT %y(s32)
50 %logic_op:_(s64) = G_OR %hand1, %hand2
51 $x0 = COPY %logic_op(s64)
52 RET_ReallyLR implicit $x0
56 name: or_combine_anyext
57 tracksRegLiveness: true
61 ; or (anyext X), (anyext Y) --> anyext (or X, Y)
63 ; CHECK-LABEL: name: or_combine_anyext
64 ; CHECK: liveins: $w0, $w1
65 ; CHECK: %x:_(s32) = COPY $w0
66 ; CHECK: %y:_(s32) = COPY $w1
67 ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR %x, %y
68 ; CHECK: %logic_op:_(s64) = G_ANYEXT [[OR]](s32)
69 ; CHECK: $x0 = COPY %logic_op(s64)
70 ; CHECK: RET_ReallyLR implicit $x0
73 %hand1:_(s64) = G_ANYEXT %x(s32)
74 %hand2:_(s64) = G_ANYEXT %y(s32)
75 %logic_op:_(s64) = G_OR %hand1, %hand2
76 $x0 = COPY %logic_op(s64)
77 RET_ReallyLR implicit $x0
81 name: and_combine_sext
82 tracksRegLiveness: true
86 ; and (sext X), (sext Y) --> sext (and X, Y)
88 ; CHECK-LABEL: name: and_combine_sext
89 ; CHECK: liveins: $w0, $w1
90 ; CHECK: %x:_(s32) = COPY $w0
91 ; CHECK: %y:_(s32) = COPY $w1
92 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND %x, %y
93 ; CHECK: %logic_op:_(s64) = G_SEXT [[AND]](s32)
94 ; CHECK: $x0 = COPY %logic_op(s64)
95 ; CHECK: RET_ReallyLR implicit $x0
98 %hand1:_(s64) = G_SEXT %x(s32)
99 %hand2:_(s64) = G_SEXT %y(s32)
100 %logic_op:_(s64) = G_AND %hand1, %hand2
101 $x0 = COPY %logic_op(s64)
102 RET_ReallyLR implicit $x0
106 name: and_combine_zext
107 tracksRegLiveness: true
111 ; and (zext X), (zext Y) --> zext (and X, Y)
113 ; CHECK-LABEL: name: and_combine_zext
114 ; CHECK: liveins: $w0, $w1
115 ; CHECK: %x:_(s32) = COPY $w0
116 ; CHECK: %y:_(s32) = COPY $w1
117 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND %x, %y
118 ; CHECK: %logic_op:_(s64) = G_ZEXT [[AND]](s32)
119 ; CHECK: $x0 = COPY %logic_op(s64)
120 ; CHECK: RET_ReallyLR implicit $x0
123 %hand1:_(s64) = G_ZEXT %x(s32)
124 %hand2:_(s64) = G_ZEXT %y(s32)
125 %logic_op:_(s64) = G_AND %hand1, %hand2
126 $x0 = COPY %logic_op(s64)
127 RET_ReallyLR implicit $x0
131 name: and_combine_anyext
132 tracksRegLiveness: true
136 ; and (anyext X), (anyext Y) --> anyext (and X, Y)
138 ; CHECK-LABEL: name: and_combine_anyext
139 ; CHECK: liveins: $w0, $w1
140 ; CHECK: %x:_(s32) = COPY $w0
141 ; CHECK: %y:_(s32) = COPY $w1
142 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND %x, %y
143 ; CHECK: %logic_op:_(s64) = G_ANYEXT [[AND]](s32)
144 ; CHECK: $x0 = COPY %logic_op(s64)
145 ; CHECK: RET_ReallyLR implicit $x0
148 %hand1:_(s64) = G_ANYEXT %x(s32)
149 %hand2:_(s64) = G_ANYEXT %y(s32)
150 %logic_op:_(s64) = G_AND %hand1, %hand2
151 $x0 = COPY %logic_op(s64)
152 RET_ReallyLR implicit $x0
156 name: xor_combine_sext
157 tracksRegLiveness: true
161 ; xor (sext X), (sext Y) --> sext (xor X, Y)
163 ; CHECK-LABEL: name: xor_combine_sext
164 ; CHECK: liveins: $w0, $w1
165 ; CHECK: %x:_(s32) = COPY $w0
166 ; CHECK: %y:_(s32) = COPY $w1
167 ; CHECK: [[XOR:%[0-9]+]]:_(s32) = G_XOR %x, %y
168 ; CHECK: %logic_op:_(s64) = G_SEXT [[XOR]](s32)
169 ; CHECK: $x0 = COPY %logic_op(s64)
170 ; CHECK: RET_ReallyLR implicit $x0
173 %hand1:_(s64) = G_SEXT %x(s32)
174 %hand2:_(s64) = G_SEXT %y(s32)
175 %logic_op:_(s64) = G_XOR %hand1, %hand2
176 $x0 = COPY %logic_op(s64)
177 RET_ReallyLR implicit $x0
181 name: xor_combine_zext
182 tracksRegLiveness: true
186 ; xor (zext X), (zext Y) --> zext (xor X, Y)
188 ; CHECK-LABEL: name: xor_combine_zext
189 ; CHECK: liveins: $w0, $w1
190 ; CHECK: %x:_(s32) = COPY $w0
191 ; CHECK: %y:_(s32) = COPY $w1
192 ; CHECK: [[XOR:%[0-9]+]]:_(s32) = G_XOR %x, %y
193 ; CHECK: %logic_op:_(s64) = G_ZEXT [[XOR]](s32)
194 ; CHECK: $x0 = COPY %logic_op(s64)
195 ; CHECK: RET_ReallyLR implicit $x0
198 %hand1:_(s64) = G_ZEXT %x(s32)
199 %hand2:_(s64) = G_ZEXT %y(s32)
200 %logic_op:_(s64) = G_XOR %hand1, %hand2
201 $x0 = COPY %logic_op(s64)
202 RET_ReallyLR implicit $x0
206 name: xor_combine_anyext
207 tracksRegLiveness: true
211 ; xor (anyext X), (anyext Y) --> anyext (xor X, Y)
213 ; CHECK-LABEL: name: xor_combine_anyext
214 ; CHECK: liveins: $w0, $w1
215 ; CHECK: %x:_(s32) = COPY $w0
216 ; CHECK: %y:_(s32) = COPY $w1
217 ; CHECK: [[XOR:%[0-9]+]]:_(s32) = G_XOR %x, %y
218 ; CHECK: %logic_op:_(s64) = G_ANYEXT [[XOR]](s32)
219 ; CHECK: $x0 = COPY %logic_op(s64)
220 ; CHECK: RET_ReallyLR implicit $x0
223 %hand1:_(s64) = G_ANYEXT %x(s32)
224 %hand2:_(s64) = G_ANYEXT %y(s32)
225 %logic_op:_(s64) = G_XOR %hand1, %hand2
226 $x0 = COPY %logic_op(s64)
227 RET_ReallyLR implicit $x0
231 name: dont_combine_different_types
232 tracksRegLiveness: true
236 ; When %x and %y don't have the same type, don't perform the combine.
238 ; CHECK-LABEL: name: dont_combine_different_types
239 ; CHECK: liveins: $w0, $w1
240 ; CHECK: %x:_(s32) = COPY $w0
241 ; CHECK: %hand1:_(s32) = COPY $w1
242 ; CHECK: %y:_(s16) = G_TRUNC %hand1(s32)
243 ; CHECK: %hand2:_(s64) = G_SEXT %x(s32)
244 ; CHECK: %logic_op:_(s64) = G_SEXT %y(s16)
245 ; CHECK: [[OR:%[0-9]+]]:_(s64) = G_OR %hand2, %logic_op
246 ; CHECK: $x0 = COPY [[OR]](s64)
247 ; CHECK: RET_ReallyLR implicit $x0
249 %hand1:_(s32) = COPY $w1
250 %y:_(s16) = G_TRUNC %hand1(s32)
251 %hand2:_(s64) = G_SEXT %x(s32)
252 %logic_op:_(s64) = G_SEXT %y(s16)
253 %5:_(s64) = G_OR %hand2, %logic_op
255 RET_ReallyLR implicit $x0
260 tracksRegLiveness: true
265 ; Pre-legalization, it's okay to produce illegal types.
267 ; CHECK-LABEL: name: illegal_ty
268 ; CHECK: liveins: $w0, $w1
269 ; CHECK: %x_wide:_(s32) = COPY $w0
270 ; CHECK: %y_wide:_(s32) = COPY $w1
271 ; CHECK: %8:_(s32) = G_OR %x_wide, %y_wide
272 ; CHECK: %7:_(s1) = G_TRUNC %8(s32)
273 ; CHECK: %logic_op:_(s64) = G_SEXT %7(s1)
274 ; CHECK: $x0 = COPY %logic_op(s64)
275 ; CHECK: RET_ReallyLR implicit $x0
276 %x_wide:_(s32) = COPY $w0
277 %y_wide:_(s32) = COPY $w1
278 %x:_(s1) = G_TRUNC %x_wide
279 %y:_(s1) = G_TRUNC %y_wide
280 %hand1:_(s64) = G_SEXT %x(s1)
281 %hand2:_(s64) = G_SEXT %y(s1)
282 %logic_op:_(s64) = G_OR %hand1, %hand2
283 $x0 = COPY %logic_op(s64)
284 RET_ReallyLR implicit $x0
289 tracksRegLiveness: true
292 ; or (and x, z), (and y, z) --> and (or x, y), z
294 liveins: $x0, $x1, $x2
295 ; CHECK-LABEL: name: or_combine_and
296 ; CHECK: liveins: $x0, $x1, $x2
297 ; CHECK: %x:_(s64) = COPY $x0
298 ; CHECK: %y:_(s64) = COPY $x1
299 ; CHECK: %z:_(s64) = COPY $x2
300 ; CHECK: [[OR:%[0-9]+]]:_(s64) = G_OR %x, %y
301 ; CHECK: %logic_op:_(s64) = G_AND [[OR]], %z
302 ; CHECK: $x0 = COPY %logic_op(s64)
303 ; CHECK: RET_ReallyLR implicit $x0
307 %hand1:_(s64) = G_AND %x(s64), %z
308 %hand2:_(s64) = G_AND %y(s64), %z
309 %logic_op:_(s64) = G_OR %hand1, %hand2
310 $x0 = COPY %logic_op(s64)
311 RET_ReallyLR implicit $x0
315 name: or_combine_ashr
316 tracksRegLiveness: true
319 ; or (ashr x, z), (ashr y, z) --> ashr (or x, y), z
321 liveins: $x0, $x1, $x2
322 ; CHECK-LABEL: name: or_combine_ashr
323 ; CHECK: liveins: $x0, $x1, $x2
324 ; CHECK: %x:_(s64) = COPY $x0
325 ; CHECK: %y:_(s64) = COPY $x1
326 ; CHECK: %z:_(s64) = COPY $x2
327 ; CHECK: [[OR:%[0-9]+]]:_(s64) = G_OR %x, %y
328 ; CHECK: %logic_op:_(s64) = G_ASHR [[OR]], %z(s64)
329 ; CHECK: $x0 = COPY %logic_op(s64)
330 ; CHECK: RET_ReallyLR implicit $x0
334 %hand1:_(s64) = G_ASHR %x(s64), %z
335 %hand2:_(s64) = G_ASHR %y(s64), %z
336 %logic_op:_(s64) = G_OR %hand1, %hand2
337 $x0 = COPY %logic_op(s64)
338 RET_ReallyLR implicit $x0
342 name: or_combine_lshr
343 tracksRegLiveness: true
346 ; or (lshr x, z), (lshr y, z) --> lshr (or x, y), z
348 liveins: $x0, $x1, $x2
349 ; CHECK-LABEL: name: or_combine_lshr
350 ; CHECK: liveins: $x0, $x1, $x2
351 ; CHECK: %x:_(s64) = COPY $x0
352 ; CHECK: %y:_(s64) = COPY $x1
353 ; CHECK: %z:_(s64) = COPY $x2
354 ; CHECK: [[OR:%[0-9]+]]:_(s64) = G_OR %x, %y
355 ; CHECK: %logic_op:_(s64) = G_LSHR [[OR]], %z(s64)
356 ; CHECK: $x0 = COPY %logic_op(s64)
357 ; CHECK: RET_ReallyLR implicit $x0
361 %hand1:_(s64) = G_LSHR %x(s64), %z
362 %hand2:_(s64) = G_LSHR %y(s64), %z
363 %logic_op:_(s64) = G_OR %hand1, %hand2
364 $x0 = COPY %logic_op(s64)
365 RET_ReallyLR implicit $x0
370 tracksRegLiveness: true
373 ; or (shl x, z), (shl y, z) --> shl (or x, y), z
375 liveins: $x0, $x1, $x2
376 ; CHECK-LABEL: name: or_combine_shl
377 ; CHECK: liveins: $x0, $x1, $x2
378 ; CHECK: %x:_(s64) = COPY $x0
379 ; CHECK: %y:_(s64) = COPY $x1
380 ; CHECK: %z:_(s64) = COPY $x2
381 ; CHECK: [[OR:%[0-9]+]]:_(s64) = G_OR %x, %y
382 ; CHECK: %logic_op:_(s64) = G_SHL [[OR]], %z(s64)
383 ; CHECK: $x0 = COPY %logic_op(s64)
384 ; CHECK: RET_ReallyLR implicit $x0
388 %hand1:_(s64) = G_SHL %x(s64), %z
389 %hand2:_(s64) = G_SHL %y(s64), %z
390 %logic_op:_(s64) = G_OR %hand1, %hand2
391 $x0 = COPY %logic_op(s64)
392 RET_ReallyLR implicit $x0
396 name: xor_combine_and
397 tracksRegLiveness: true
400 ; xor (and x, z), (and y, z) --> and (xor x, y), z
402 liveins: $x0, $x1, $x2
403 ; CHECK-LABEL: name: xor_combine_and
404 ; CHECK: liveins: $x0, $x1, $x2
405 ; CHECK: %x:_(s64) = COPY $x0
406 ; CHECK: %y:_(s64) = COPY $x1
407 ; CHECK: %z:_(s64) = COPY $x2
408 ; CHECK: [[XOR:%[0-9]+]]:_(s64) = G_XOR %x, %y
409 ; CHECK: %logic_op:_(s64) = G_AND [[XOR]], %z
410 ; CHECK: $x0 = COPY %logic_op(s64)
411 ; CHECK: RET_ReallyLR implicit $x0
415 %hand1:_(s64) = G_AND %x(s64), %z
416 %hand2:_(s64) = G_AND %y(s64), %z
417 %logic_op:_(s64) = G_XOR %hand1, %hand2
418 $x0 = COPY %logic_op(s64)
419 RET_ReallyLR implicit $x0
423 name: xor_combine_ashr
424 tracksRegLiveness: true
427 ; xor (ashr x, z), (ashr y, z) --> ashr (xor x, y), z
429 liveins: $x0, $x1, $x2
430 ; CHECK-LABEL: name: xor_combine_ashr
431 ; CHECK: liveins: $x0, $x1, $x2
432 ; CHECK: %x:_(s64) = COPY $x0
433 ; CHECK: %y:_(s64) = COPY $x1
434 ; CHECK: %z:_(s64) = COPY $x2
435 ; CHECK: [[XOR:%[0-9]+]]:_(s64) = G_XOR %x, %y
436 ; CHECK: %logic_op:_(s64) = G_ASHR [[XOR]], %z(s64)
437 ; CHECK: $x0 = COPY %logic_op(s64)
438 ; CHECK: RET_ReallyLR implicit $x0
442 %hand1:_(s64) = G_ASHR %x(s64), %z
443 %hand2:_(s64) = G_ASHR %y(s64), %z
444 %logic_op:_(s64) = G_XOR %hand1, %hand2
445 $x0 = COPY %logic_op(s64)
446 RET_ReallyLR implicit $x0
450 name: xor_combine_lshr
451 tracksRegLiveness: true
454 ; xor (lshr x, z), (lshr y, z) --> lshr (xor x, y), z
456 liveins: $x0, $x1, $x2
457 ; CHECK-LABEL: name: xor_combine_lshr
458 ; CHECK: liveins: $x0, $x1, $x2
459 ; CHECK: %x:_(s64) = COPY $x0
460 ; CHECK: %y:_(s64) = COPY $x1
461 ; CHECK: %z:_(s64) = COPY $x2
462 ; CHECK: [[XOR:%[0-9]+]]:_(s64) = G_XOR %x, %y
463 ; CHECK: %logic_op:_(s64) = G_LSHR [[XOR]], %z(s64)
464 ; CHECK: $x0 = COPY %logic_op(s64)
465 ; CHECK: RET_ReallyLR implicit $x0
469 %hand1:_(s64) = G_LSHR %x(s64), %z
470 %hand2:_(s64) = G_LSHR %y(s64), %z
471 %logic_op:_(s64) = G_XOR %hand1, %hand2
472 $x0 = COPY %logic_op(s64)
473 RET_ReallyLR implicit $x0
477 name: xor_combine_shl
478 tracksRegLiveness: true
481 ; xor (shl x, z), (shl y, z) --> shl (xor x, y), z
483 liveins: $x0, $x1, $x2
484 ; CHECK-LABEL: name: xor_combine_shl
485 ; CHECK: liveins: $x0, $x1, $x2
486 ; CHECK: %x:_(s64) = COPY $x0
487 ; CHECK: %y:_(s64) = COPY $x1
488 ; CHECK: %z:_(s64) = COPY $x2
489 ; CHECK: [[XOR:%[0-9]+]]:_(s64) = G_XOR %x, %y
490 ; CHECK: %logic_op:_(s64) = G_SHL [[XOR]], %z(s64)
491 ; CHECK: $x0 = COPY %logic_op(s64)
492 ; CHECK: RET_ReallyLR implicit $x0
496 %hand1:_(s64) = G_SHL %x(s64), %z
497 %hand2:_(s64) = G_SHL %y(s64), %z
498 %logic_op:_(s64) = G_XOR %hand1, %hand2
499 $x0 = COPY %logic_op(s64)
500 RET_ReallyLR implicit $x0
504 name: and_combine_and
505 tracksRegLiveness: true
508 ; and (and x, z), (and y, z) --> and (and x, y), z
510 liveins: $x0, $x1, $x2
511 ; CHECK-LABEL: name: and_combine_and
512 ; CHECK: liveins: $x0, $x1, $x2
513 ; CHECK: %x:_(s64) = COPY $x0
514 ; CHECK: %y:_(s64) = COPY $x1
515 ; CHECK: %z:_(s64) = COPY $x2
516 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND %x, %y
517 ; CHECK: %logic_op:_(s64) = G_AND [[AND]], %z
518 ; CHECK: $x0 = COPY %logic_op(s64)
519 ; CHECK: RET_ReallyLR implicit $x0
523 %hand1:_(s64) = G_AND %x(s64), %z
524 %hand2:_(s64) = G_AND %y(s64), %z
525 %logic_op:_(s64) = G_AND %hand1, %hand2
526 $x0 = COPY %logic_op(s64)
527 RET_ReallyLR implicit $x0
531 name: and_combine_ashr
532 tracksRegLiveness: true
535 ; and (ashr x, z), (ashr y, z) --> ashr (and x, y), z
537 liveins: $x0, $x1, $x2
538 ; CHECK-LABEL: name: and_combine_ashr
539 ; CHECK: liveins: $x0, $x1, $x2
540 ; CHECK: %x:_(s64) = COPY $x0
541 ; CHECK: %y:_(s64) = COPY $x1
542 ; CHECK: %z:_(s64) = COPY $x2
543 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND %x, %y
544 ; CHECK: %logic_op:_(s64) = G_ASHR [[AND]], %z(s64)
545 ; CHECK: $x0 = COPY %logic_op(s64)
546 ; CHECK: RET_ReallyLR implicit $x0
550 %hand1:_(s64) = G_ASHR %x(s64), %z
551 %hand2:_(s64) = G_ASHR %y(s64), %z
552 %logic_op:_(s64) = G_AND %hand1, %hand2
553 $x0 = COPY %logic_op(s64)
554 RET_ReallyLR implicit $x0
558 name: and_combine_lshr
559 tracksRegLiveness: true
562 ; and (lshr x, z), (lshr y, z) --> lshr (and x, y), z
564 liveins: $x0, $x1, $x2
565 ; CHECK-LABEL: name: and_combine_lshr
566 ; CHECK: liveins: $x0, $x1, $x2
567 ; CHECK: %x:_(s64) = COPY $x0
568 ; CHECK: %y:_(s64) = COPY $x1
569 ; CHECK: %z:_(s64) = COPY $x2
570 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND %x, %y
571 ; CHECK: %logic_op:_(s64) = G_LSHR [[AND]], %z(s64)
572 ; CHECK: $x0 = COPY %logic_op(s64)
573 ; CHECK: RET_ReallyLR implicit $x0
577 %hand1:_(s64) = G_LSHR %x(s64), %z
578 %hand2:_(s64) = G_LSHR %y(s64), %z
579 %logic_op:_(s64) = G_AND %hand1, %hand2
580 $x0 = COPY %logic_op(s64)
581 RET_ReallyLR implicit $x0
585 name: and_combine_shl
586 tracksRegLiveness: true
589 ; and (shl x, z), (shl y, z) --> shl (and x, y), z
591 liveins: $x0, $x1, $x2
592 ; CHECK-LABEL: name: and_combine_shl
593 ; CHECK: liveins: $x0, $x1, $x2
594 ; CHECK: %x:_(s64) = COPY $x0
595 ; CHECK: %y:_(s64) = COPY $x1
596 ; CHECK: %z:_(s64) = COPY $x2
597 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND %x, %y
598 ; CHECK: %logic_op:_(s64) = G_SHL [[AND]], %z(s64)
599 ; CHECK: $x0 = COPY %logic_op(s64)
600 ; CHECK: RET_ReallyLR implicit $x0
604 %hand1:_(s64) = G_SHL %x(s64), %z
605 %hand2:_(s64) = G_SHL %y(s64), %z
606 %logic_op:_(s64) = G_AND %hand1, %hand2
607 $x0 = COPY %logic_op(s64)
608 RET_ReallyLR implicit $x0
612 name: dont_combine_different_defs_on_binop
613 tracksRegLiveness: true
616 ; z1 != z2, so don't combine.
618 liveins: $x0, $x1, $x2, $x3
619 ; CHECK-LABEL: name: dont_combine_different_defs_on_binop
620 ; CHECK: liveins: $x0, $x1, $x2, $x3
621 ; CHECK: %x:_(s64) = COPY $x0
622 ; CHECK: %y:_(s64) = COPY $x1
623 ; CHECK: %z1:_(s64) = COPY $x2
624 ; CHECK: %z2:_(s64) = COPY $x3
625 ; CHECK: %hand1:_(s64) = G_AND %x, %z1
626 ; CHECK: %hand2:_(s64) = G_AND %y, %z2
627 ; CHECK: %logic_op:_(s64) = G_OR %hand1, %hand2
628 ; CHECK: $x0 = COPY %logic_op(s64)
629 ; CHECK: RET_ReallyLR implicit $x0
632 %z1:_(s64) = COPY $x2
633 %z2:_(s64) = COPY $x3
634 %hand1:_(s64) = G_AND %x(s64), %z1
635 %hand2:_(s64) = G_AND %y(s64), %z2
636 %logic_op:_(s64) = G_OR %hand1, %hand2
637 $x0 = COPY %logic_op(s64)
638 RET_ReallyLR implicit $x0
642 name: dont_combine_more_than_one_use
643 tracksRegLiveness: true
647 ; The LHS register is used more than once. Don't combine.
649 ; CHECK-LABEL: name: dont_combine_more_than_one_use
650 ; CHECK: liveins: $w0, $w1
651 ; CHECK: %x:_(s32) = COPY $w0
652 ; CHECK: %y:_(s32) = COPY $w1
653 ; CHECK: %hand1:_(s64) = G_SEXT %x(s32)
654 ; CHECK: %hand2:_(s64) = G_SEXT %y(s32)
655 ; CHECK: %logic_op:_(s64) = G_OR %hand1, %hand2
656 ; CHECK: %other_op:_(s64) = G_ADD %hand1, %logic_op
657 ; CHECK: $x0 = COPY %other_op(s64)
658 ; CHECK: RET_ReallyLR implicit $x0
661 %hand1:_(s64) = G_SEXT %x(s32)
662 %hand2:_(s64) = G_SEXT %y(s32)
663 %logic_op:_(s64) = G_OR %hand1, %hand2
664 %other_op:_(s64) = G_ADD %hand1, %logic_op
665 $x0 = COPY %other_op(s64)
666 RET_ReallyLR implicit $x0
671 tracksRegLiveness: true
675 ; Show that we can combine vector types.
677 ; CHECK-LABEL: name: combine_vector
678 ; CHECK: liveins: $d0, $d1
679 ; CHECK: %x:_(<2 x s32>) = COPY $d0
680 ; CHECK: %y:_(<2 x s32>) = COPY $d1
681 ; CHECK: [[OR:%[0-9]+]]:_(<2 x s32>) = G_OR %x, %y
682 ; CHECK: %logic_op:_(<2 x s64>) = G_SEXT [[OR]](<2 x s32>)
683 ; CHECK: $q0 = COPY %logic_op(<2 x s64>)
684 ; CHECK: RET_ReallyLR implicit $q0
685 %x:_(<2 x s32>) = COPY $d0
686 %y:_(<2 x s32>) = COPY $d1
687 %hand1:_(<2 x s64>) = G_SEXT %x(<2 x s32>)
688 %hand2:_(<2 x s64>) = G_SEXT %y(<2 x s32>)
689 %logic_op:_(<2 x s64>) = G_OR %hand1, %hand2
690 $q0 = COPY %logic_op(<2 x s64>)
691 RET_ReallyLR implicit $q0