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: %x:_(s1) = G_TRUNC %x_wide(s32)
272 ; CHECK: %y:_(s1) = G_TRUNC %y_wide(s32)
273 ; CHECK: [[OR:%[0-9]+]]:_(s1) = G_OR %x, %y
274 ; CHECK: %logic_op:_(s64) = G_SEXT [[OR]](s1)
275 ; CHECK: $x0 = COPY %logic_op(s64)
276 ; CHECK: RET_ReallyLR implicit $x0
277 %x_wide:_(s32) = COPY $w0
278 %y_wide:_(s32) = COPY $w1
279 %x:_(s1) = G_TRUNC %x_wide
280 %y:_(s1) = G_TRUNC %y_wide
281 %hand1:_(s64) = G_SEXT %x(s1)
282 %hand2:_(s64) = G_SEXT %y(s1)
283 %logic_op:_(s64) = G_OR %hand1, %hand2
284 $x0 = COPY %logic_op(s64)
285 RET_ReallyLR implicit $x0
290 tracksRegLiveness: true
293 ; or (and x, z), (and y, z) --> and (or x, y), z
295 liveins: $x0, $x1, $x2
296 ; CHECK-LABEL: name: or_combine_and
297 ; CHECK: liveins: $x0, $x1, $x2
298 ; CHECK: %x:_(s64) = COPY $x0
299 ; CHECK: %y:_(s64) = COPY $x1
300 ; CHECK: %z:_(s64) = COPY $x2
301 ; CHECK: [[OR:%[0-9]+]]:_(s64) = G_OR %x, %y
302 ; CHECK: %logic_op:_(s64) = G_AND [[OR]], %z
303 ; CHECK: $x0 = COPY %logic_op(s64)
304 ; CHECK: RET_ReallyLR implicit $x0
308 %hand1:_(s64) = G_AND %x(s64), %z
309 %hand2:_(s64) = G_AND %y(s64), %z
310 %logic_op:_(s64) = G_OR %hand1, %hand2
311 $x0 = COPY %logic_op(s64)
312 RET_ReallyLR implicit $x0
316 name: or_combine_ashr
317 tracksRegLiveness: true
320 ; or (ashr x, z), (ashr y, z) --> ashr (or x, y), z
322 liveins: $x0, $x1, $x2
323 ; CHECK-LABEL: name: or_combine_ashr
324 ; CHECK: liveins: $x0, $x1, $x2
325 ; CHECK: %x:_(s64) = COPY $x0
326 ; CHECK: %y:_(s64) = COPY $x1
327 ; CHECK: %z:_(s64) = COPY $x2
328 ; CHECK: [[OR:%[0-9]+]]:_(s64) = G_OR %x, %y
329 ; CHECK: %logic_op:_(s64) = G_ASHR [[OR]], %z(s64)
330 ; CHECK: $x0 = COPY %logic_op(s64)
331 ; CHECK: RET_ReallyLR implicit $x0
335 %hand1:_(s64) = G_ASHR %x(s64), %z
336 %hand2:_(s64) = G_ASHR %y(s64), %z
337 %logic_op:_(s64) = G_OR %hand1, %hand2
338 $x0 = COPY %logic_op(s64)
339 RET_ReallyLR implicit $x0
343 name: or_combine_lshr
344 tracksRegLiveness: true
347 ; or (lshr x, z), (lshr y, z) --> lshr (or x, y), z
349 liveins: $x0, $x1, $x2
350 ; CHECK-LABEL: name: or_combine_lshr
351 ; CHECK: liveins: $x0, $x1, $x2
352 ; CHECK: %x:_(s64) = COPY $x0
353 ; CHECK: %y:_(s64) = COPY $x1
354 ; CHECK: %z:_(s64) = COPY $x2
355 ; CHECK: [[OR:%[0-9]+]]:_(s64) = G_OR %x, %y
356 ; CHECK: %logic_op:_(s64) = G_LSHR [[OR]], %z(s64)
357 ; CHECK: $x0 = COPY %logic_op(s64)
358 ; CHECK: RET_ReallyLR implicit $x0
362 %hand1:_(s64) = G_LSHR %x(s64), %z
363 %hand2:_(s64) = G_LSHR %y(s64), %z
364 %logic_op:_(s64) = G_OR %hand1, %hand2
365 $x0 = COPY %logic_op(s64)
366 RET_ReallyLR implicit $x0
371 tracksRegLiveness: true
374 ; or (shl x, z), (shl y, z) --> shl (or x, y), z
376 liveins: $x0, $x1, $x2
377 ; CHECK-LABEL: name: or_combine_shl
378 ; CHECK: liveins: $x0, $x1, $x2
379 ; CHECK: %x:_(s64) = COPY $x0
380 ; CHECK: %y:_(s64) = COPY $x1
381 ; CHECK: %z:_(s64) = COPY $x2
382 ; CHECK: [[OR:%[0-9]+]]:_(s64) = G_OR %x, %y
383 ; CHECK: %logic_op:_(s64) = G_SHL [[OR]], %z(s64)
384 ; CHECK: $x0 = COPY %logic_op(s64)
385 ; CHECK: RET_ReallyLR implicit $x0
389 %hand1:_(s64) = G_SHL %x(s64), %z
390 %hand2:_(s64) = G_SHL %y(s64), %z
391 %logic_op:_(s64) = G_OR %hand1, %hand2
392 $x0 = COPY %logic_op(s64)
393 RET_ReallyLR implicit $x0
397 name: xor_combine_and
398 tracksRegLiveness: true
401 ; xor (and x, z), (and y, z) --> and (xor x, y), z
403 liveins: $x0, $x1, $x2
404 ; CHECK-LABEL: name: xor_combine_and
405 ; CHECK: liveins: $x0, $x1, $x2
406 ; CHECK: %x:_(s64) = COPY $x0
407 ; CHECK: %y:_(s64) = COPY $x1
408 ; CHECK: %z:_(s64) = COPY $x2
409 ; CHECK: [[XOR:%[0-9]+]]:_(s64) = G_XOR %x, %y
410 ; CHECK: %logic_op:_(s64) = G_AND [[XOR]], %z
411 ; CHECK: $x0 = COPY %logic_op(s64)
412 ; CHECK: RET_ReallyLR implicit $x0
416 %hand1:_(s64) = G_AND %x(s64), %z
417 %hand2:_(s64) = G_AND %y(s64), %z
418 %logic_op:_(s64) = G_XOR %hand1, %hand2
419 $x0 = COPY %logic_op(s64)
420 RET_ReallyLR implicit $x0
424 name: xor_combine_ashr
425 tracksRegLiveness: true
428 ; xor (ashr x, z), (ashr y, z) --> ashr (xor x, y), z
430 liveins: $x0, $x1, $x2
431 ; CHECK-LABEL: name: xor_combine_ashr
432 ; CHECK: liveins: $x0, $x1, $x2
433 ; CHECK: %x:_(s64) = COPY $x0
434 ; CHECK: %y:_(s64) = COPY $x1
435 ; CHECK: %z:_(s64) = COPY $x2
436 ; CHECK: [[XOR:%[0-9]+]]:_(s64) = G_XOR %x, %y
437 ; CHECK: %logic_op:_(s64) = G_ASHR [[XOR]], %z(s64)
438 ; CHECK: $x0 = COPY %logic_op(s64)
439 ; CHECK: RET_ReallyLR implicit $x0
443 %hand1:_(s64) = G_ASHR %x(s64), %z
444 %hand2:_(s64) = G_ASHR %y(s64), %z
445 %logic_op:_(s64) = G_XOR %hand1, %hand2
446 $x0 = COPY %logic_op(s64)
447 RET_ReallyLR implicit $x0
451 name: xor_combine_lshr
452 tracksRegLiveness: true
455 ; xor (lshr x, z), (lshr y, z) --> lshr (xor x, y), z
457 liveins: $x0, $x1, $x2
458 ; CHECK-LABEL: name: xor_combine_lshr
459 ; CHECK: liveins: $x0, $x1, $x2
460 ; CHECK: %x:_(s64) = COPY $x0
461 ; CHECK: %y:_(s64) = COPY $x1
462 ; CHECK: %z:_(s64) = COPY $x2
463 ; CHECK: [[XOR:%[0-9]+]]:_(s64) = G_XOR %x, %y
464 ; CHECK: %logic_op:_(s64) = G_LSHR [[XOR]], %z(s64)
465 ; CHECK: $x0 = COPY %logic_op(s64)
466 ; CHECK: RET_ReallyLR implicit $x0
470 %hand1:_(s64) = G_LSHR %x(s64), %z
471 %hand2:_(s64) = G_LSHR %y(s64), %z
472 %logic_op:_(s64) = G_XOR %hand1, %hand2
473 $x0 = COPY %logic_op(s64)
474 RET_ReallyLR implicit $x0
478 name: xor_combine_shl
479 tracksRegLiveness: true
482 ; xor (shl x, z), (shl y, z) --> shl (xor x, y), z
484 liveins: $x0, $x1, $x2
485 ; CHECK-LABEL: name: xor_combine_shl
486 ; CHECK: liveins: $x0, $x1, $x2
487 ; CHECK: %x:_(s64) = COPY $x0
488 ; CHECK: %y:_(s64) = COPY $x1
489 ; CHECK: %z:_(s64) = COPY $x2
490 ; CHECK: [[XOR:%[0-9]+]]:_(s64) = G_XOR %x, %y
491 ; CHECK: %logic_op:_(s64) = G_SHL [[XOR]], %z(s64)
492 ; CHECK: $x0 = COPY %logic_op(s64)
493 ; CHECK: RET_ReallyLR implicit $x0
497 %hand1:_(s64) = G_SHL %x(s64), %z
498 %hand2:_(s64) = G_SHL %y(s64), %z
499 %logic_op:_(s64) = G_XOR %hand1, %hand2
500 $x0 = COPY %logic_op(s64)
501 RET_ReallyLR implicit $x0
505 name: and_combine_and
506 tracksRegLiveness: true
509 ; and (and x, z), (and y, z) --> and (and x, y), z
511 liveins: $x0, $x1, $x2
512 ; CHECK-LABEL: name: and_combine_and
513 ; CHECK: liveins: $x0, $x1, $x2
514 ; CHECK: %x:_(s64) = COPY $x0
515 ; CHECK: %y:_(s64) = COPY $x1
516 ; CHECK: %z:_(s64) = COPY $x2
517 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND %x, %y
518 ; CHECK: %logic_op:_(s64) = G_AND [[AND]], %z
519 ; CHECK: $x0 = COPY %logic_op(s64)
520 ; CHECK: RET_ReallyLR implicit $x0
524 %hand1:_(s64) = G_AND %x(s64), %z
525 %hand2:_(s64) = G_AND %y(s64), %z
526 %logic_op:_(s64) = G_AND %hand1, %hand2
527 $x0 = COPY %logic_op(s64)
528 RET_ReallyLR implicit $x0
532 name: and_combine_ashr
533 tracksRegLiveness: true
536 ; and (ashr x, z), (ashr y, z) --> ashr (and x, y), z
538 liveins: $x0, $x1, $x2
539 ; CHECK-LABEL: name: and_combine_ashr
540 ; CHECK: liveins: $x0, $x1, $x2
541 ; CHECK: %x:_(s64) = COPY $x0
542 ; CHECK: %y:_(s64) = COPY $x1
543 ; CHECK: %z:_(s64) = COPY $x2
544 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND %x, %y
545 ; CHECK: %logic_op:_(s64) = G_ASHR [[AND]], %z(s64)
546 ; CHECK: $x0 = COPY %logic_op(s64)
547 ; CHECK: RET_ReallyLR implicit $x0
551 %hand1:_(s64) = G_ASHR %x(s64), %z
552 %hand2:_(s64) = G_ASHR %y(s64), %z
553 %logic_op:_(s64) = G_AND %hand1, %hand2
554 $x0 = COPY %logic_op(s64)
555 RET_ReallyLR implicit $x0
559 name: and_combine_lshr
560 tracksRegLiveness: true
563 ; and (lshr x, z), (lshr y, z) --> lshr (and x, y), z
565 liveins: $x0, $x1, $x2
566 ; CHECK-LABEL: name: and_combine_lshr
567 ; CHECK: liveins: $x0, $x1, $x2
568 ; CHECK: %x:_(s64) = COPY $x0
569 ; CHECK: %y:_(s64) = COPY $x1
570 ; CHECK: %z:_(s64) = COPY $x2
571 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND %x, %y
572 ; CHECK: %logic_op:_(s64) = G_LSHR [[AND]], %z(s64)
573 ; CHECK: $x0 = COPY %logic_op(s64)
574 ; CHECK: RET_ReallyLR implicit $x0
578 %hand1:_(s64) = G_LSHR %x(s64), %z
579 %hand2:_(s64) = G_LSHR %y(s64), %z
580 %logic_op:_(s64) = G_AND %hand1, %hand2
581 $x0 = COPY %logic_op(s64)
582 RET_ReallyLR implicit $x0
586 name: and_combine_shl
587 tracksRegLiveness: true
590 ; and (shl x, z), (shl y, z) --> shl (and x, y), z
592 liveins: $x0, $x1, $x2
593 ; CHECK-LABEL: name: and_combine_shl
594 ; CHECK: liveins: $x0, $x1, $x2
595 ; CHECK: %x:_(s64) = COPY $x0
596 ; CHECK: %y:_(s64) = COPY $x1
597 ; CHECK: %z:_(s64) = COPY $x2
598 ; CHECK: [[AND:%[0-9]+]]:_(s64) = G_AND %x, %y
599 ; CHECK: %logic_op:_(s64) = G_SHL [[AND]], %z(s64)
600 ; CHECK: $x0 = COPY %logic_op(s64)
601 ; CHECK: RET_ReallyLR implicit $x0
605 %hand1:_(s64) = G_SHL %x(s64), %z
606 %hand2:_(s64) = G_SHL %y(s64), %z
607 %logic_op:_(s64) = G_AND %hand1, %hand2
608 $x0 = COPY %logic_op(s64)
609 RET_ReallyLR implicit $x0
613 name: dont_combine_different_defs_on_binop
614 tracksRegLiveness: true
617 ; z1 != z2, so don't combine.
619 liveins: $x0, $x1, $x2, $x3
620 ; CHECK-LABEL: name: dont_combine_different_defs_on_binop
621 ; CHECK: liveins: $x0, $x1, $x2, $x3
622 ; CHECK: %x:_(s64) = COPY $x0
623 ; CHECK: %y:_(s64) = COPY $x1
624 ; CHECK: %z1:_(s64) = COPY $x2
625 ; CHECK: %z2:_(s64) = COPY $x3
626 ; CHECK: %hand1:_(s64) = G_AND %x, %z1
627 ; CHECK: %hand2:_(s64) = G_AND %y, %z2
628 ; CHECK: %logic_op:_(s64) = G_OR %hand1, %hand2
629 ; CHECK: $x0 = COPY %logic_op(s64)
630 ; CHECK: RET_ReallyLR implicit $x0
633 %z1:_(s64) = COPY $x2
634 %z2:_(s64) = COPY $x3
635 %hand1:_(s64) = G_AND %x(s64), %z1
636 %hand2:_(s64) = G_AND %y(s64), %z2
637 %logic_op:_(s64) = G_OR %hand1, %hand2
638 $x0 = COPY %logic_op(s64)
639 RET_ReallyLR implicit $x0
643 name: dont_combine_more_than_one_use
644 tracksRegLiveness: true
648 ; The LHS register is used more than once. Don't combine.
650 ; CHECK-LABEL: name: dont_combine_more_than_one_use
651 ; CHECK: liveins: $w0, $w1
652 ; CHECK: %x:_(s32) = COPY $w0
653 ; CHECK: %y:_(s32) = COPY $w1
654 ; CHECK: %hand1:_(s64) = G_SEXT %x(s32)
655 ; CHECK: %hand2:_(s64) = G_SEXT %y(s32)
656 ; CHECK: %logic_op:_(s64) = G_OR %hand1, %hand2
657 ; CHECK: %other_op:_(s64) = G_ADD %hand1, %logic_op
658 ; CHECK: $x0 = COPY %other_op(s64)
659 ; CHECK: RET_ReallyLR implicit $x0
662 %hand1:_(s64) = G_SEXT %x(s32)
663 %hand2:_(s64) = G_SEXT %y(s32)
664 %logic_op:_(s64) = G_OR %hand1, %hand2
665 %other_op:_(s64) = G_ADD %hand1, %logic_op
666 $x0 = COPY %other_op(s64)
667 RET_ReallyLR implicit $x0
672 tracksRegLiveness: true
676 ; Show that we can combine vector types.
678 ; CHECK-LABEL: name: combine_vector
679 ; CHECK: liveins: $d0, $d1
680 ; CHECK: %x:_(<2 x s32>) = COPY $d0
681 ; CHECK: %y:_(<2 x s32>) = COPY $d1
682 ; CHECK: [[OR:%[0-9]+]]:_(<2 x s32>) = G_OR %x, %y
683 ; CHECK: %logic_op:_(<2 x s64>) = G_SEXT [[OR]](<2 x s32>)
684 ; CHECK: $q0 = COPY %logic_op(<2 x s64>)
685 ; CHECK: RET_ReallyLR implicit $q0
686 %x:_(<2 x s32>) = COPY $d0
687 %y:_(<2 x s32>) = COPY $d1
688 %hand1:_(<2 x s64>) = G_SEXT %x(<2 x s32>)
689 %hand2:_(<2 x s64>) = G_SEXT %y(<2 x s32>)
690 %logic_op:_(<2 x s64>) = G_OR %hand1, %hand2
691 $q0 = COPY %logic_op(<2 x s64>)
692 RET_ReallyLR implicit $q0