1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple aarch64-unknown-unknown -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
4 # Check that we can continue matching when we are in a situation where we will
12 tracksRegLiveness: true
14 ; CHECK-LABEL: name: fold_zext
16 ; CHECK: successors: %bb.0(0x40000000), %bb.1(0x40000000)
18 ; CHECK: %copy:gpr32 = COPY $w0
19 ; CHECK: TBNZW %copy, 3, %bb.1
24 successors: %bb.0, %bb.1
26 %copy:gpr(s32) = COPY $w0
27 %bit:gpr(s64) = G_CONSTANT i64 8
28 %zero:gpr(s64) = G_CONSTANT i64 0
29 %fold_me:gpr(s64) = G_ZEXT %copy(s32)
30 %and:gpr(s64) = G_AND %fold_me, %bit
31 %cmp:gpr(s32) = G_ICMP intpred(ne), %and(s64), %zero
32 %cmp_trunc:gpr(s1) = G_TRUNC %cmp(s32)
33 G_BRCOND %cmp_trunc(s1), %bb.1
43 tracksRegLiveness: true
45 ; CHECK-LABEL: name: fold_anyext
47 ; CHECK: successors: %bb.0(0x40000000), %bb.1(0x40000000)
49 ; CHECK: %copy:gpr32 = COPY $w0
50 ; CHECK: TBNZW %copy, 3, %bb.1
55 successors: %bb.0, %bb.1
57 %copy:gpr(s32) = COPY $w0
58 %bit:gpr(s64) = G_CONSTANT i64 8
59 %zero:gpr(s64) = G_CONSTANT i64 0
60 %fold_me:gpr(s64) = G_ANYEXT %copy(s32)
61 %and:gpr(s64) = G_AND %fold_me, %bit
62 %cmp:gpr(s32) = G_ICMP intpred(ne), %and(s64), %zero
63 %cmp_trunc:gpr(s1) = G_TRUNC %cmp(s32)
64 G_BRCOND %cmp_trunc(s1), %bb.1
74 tracksRegLiveness: true
76 ; CHECK-LABEL: name: fold_multiple
78 ; CHECK: successors: %bb.0(0x40000000), %bb.1(0x40000000)
80 ; CHECK: [[SUBREG_TO_REG:%[0-9]+]]:fpr32 = SUBREG_TO_REG 0, $h0, %subreg.hsub
81 ; CHECK: %copy:gpr32all = COPY [[SUBREG_TO_REG]]
82 ; CHECK: [[COPY:%[0-9]+]]:gpr32 = COPY %copy
83 ; CHECK: TBNZW [[COPY]], 3, %bb.1
88 successors: %bb.0, %bb.1
90 %copy:gpr(s16) = COPY $h0
91 %bit:gpr(s64) = G_CONSTANT i64 8
92 %zero:gpr(s64) = G_CONSTANT i64 0
93 %ext1:gpr(s32) = G_ZEXT %copy(s16)
94 %ext2:gpr(s64) = G_ANYEXT %ext1(s32)
95 %and:gpr(s64) = G_AND %ext2, %bit
96 %cmp:gpr(s32) = G_ICMP intpred(ne), %and(s64), %zero
97 %cmp_trunc:gpr(s1) = G_TRUNC %cmp(s32)
98 G_BRCOND %cmp_trunc(s1), %bb.1
104 name: dont_fold_more_than_one_use
107 regBankSelected: true
108 tracksRegLiveness: true
110 ; CHECK-LABEL: name: dont_fold_more_than_one_use
112 ; CHECK: successors: %bb.0(0x40000000), %bb.1(0x40000000)
113 ; CHECK: liveins: $x0
114 ; CHECK: %copy:gpr32 = COPY $w0
115 ; CHECK: [[ORRWrs:%[0-9]+]]:gpr32 = ORRWrs $wzr, %copy, 0
116 ; CHECK: %zext:gpr64 = SUBREG_TO_REG 0, [[ORRWrs]], %subreg.sub_32
117 ; CHECK: [[COPY:%[0-9]+]]:gpr32all = COPY %zext.sub_32
118 ; CHECK: [[COPY1:%[0-9]+]]:gpr32 = COPY [[COPY]]
119 ; CHECK: TBNZW [[COPY1]], 3, %bb.1
122 ; CHECK: $x0 = COPY %zext
123 ; CHECK: RET_ReallyLR implicit $x0
125 successors: %bb.0, %bb.1
127 %copy:gpr(s32) = COPY $w0
128 %bit:gpr(s64) = G_CONSTANT i64 8
129 %zero:gpr(s64) = G_CONSTANT i64 0
130 %zext:gpr(s64) = G_ZEXT %copy(s32)
131 %and:gpr(s64) = G_AND %zext, %bit
132 %cmp:gpr(s32) = G_ICMP intpred(ne), %and(s64), %zero
133 %cmp_trunc:gpr(s1) = G_TRUNC %cmp(s32)
134 G_BRCOND %cmp_trunc(s1), %bb.1
137 $x0 = COPY %zext:gpr(s64)
138 RET_ReallyLR implicit $x0