1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple aarch64 -run-pass=aarch64-postlegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s
7 tracksRegLiveness: true
12 ; or (sext X), (sext Y) --> sext (or X, Y)
14 ; CHECK-LABEL: name: or_combine_sext
15 ; CHECK: liveins: $w0, $w1
16 ; CHECK: %x:_(s32) = COPY $w0
17 ; CHECK: %y:_(s32) = COPY $w1
18 ; CHECK: [[OR:%[0-9]+]]:_(s32) = G_OR %x, %y
19 ; CHECK: %logic_op:_(s64) = G_SEXT [[OR]](s32)
20 ; CHECK: $x0 = COPY %logic_op(s64)
21 ; CHECK: RET_ReallyLR implicit $x0
24 %hand1:_(s64) = G_SEXT %x(s32)
25 %hand2:_(s64) = G_SEXT %y(s32)
26 %logic_op:_(s64) = G_OR %hand1, %hand2
27 $x0 = COPY %logic_op(s64)
28 RET_ReallyLR implicit $x0
33 tracksRegLiveness: true
38 ; Post-legalization, we should not perform the optimization here, since
39 ; it would create an illegal G_OR.
41 ; CHECK-LABEL: name: illegal_ty
42 ; CHECK: liveins: $w0, $w1
43 ; CHECK: %x_wide:_(s32) = COPY $w0
44 ; CHECK: %y_wide:_(s32) = COPY $w1
45 ; CHECK: %x:_(s1) = G_TRUNC %x_wide(s32)
46 ; CHECK: %y:_(s1) = G_TRUNC %y_wide(s32)
47 ; CHECK: %hand1:_(s64) = G_SEXT %x(s1)
48 ; CHECK: %hand2:_(s64) = G_SEXT %y(s1)
49 ; CHECK: %logic_op:_(s64) = G_OR %hand1, %hand2
50 ; CHECK: $x0 = COPY %logic_op(s64)
51 ; CHECK: RET_ReallyLR implicit $x0
52 %x_wide:_(s32) = COPY $w0
53 %y_wide:_(s32) = COPY $w1
54 %x:_(s1) = G_TRUNC %x_wide
55 %y:_(s1) = G_TRUNC %y_wide
56 %hand1:_(s64) = G_SEXT %x(s1)
57 %hand2:_(s64) = G_SEXT %y(s1)
58 %logic_op:_(s64) = G_OR %hand1, %hand2
59 $x0 = COPY %logic_op(s64)
60 RET_ReallyLR implicit $x0
64 name: dont_combine_physreg
65 tracksRegLiveness: true
70 ; Post-legalization, we must not crash here.
72 ; CHECK-LABEL: name: dont_combine_physreg
75 %logic_op:_(s32) = G_OR %x, %y
76 $w0 = COPY %logic_op(s32)
77 RET_ReallyLR implicit $w0