1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64-- -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
5 define void @cbz_s32() { ret void }
6 define void @cbz_s64() { ret void }
7 define void @cbnz_s32() { ret void }
8 define void @cbnz_s64() { ret void }
9 define hidden void @test_rhs_inttoptr(i64* %p) { ret void }
10 define hidden void @test_rhs_unknown(i64* %p) { ret void }
19 ; CHECK-LABEL: name: cbz_s32
21 ; CHECK: successors: %bb.0(0x40000000), %bb.1(0x40000000)
22 ; CHECK: [[COPY:%[0-9]+]]:gpr32 = COPY $w0
23 ; CHECK: CBZW [[COPY]], %bb.1
28 successors: %bb.0, %bb.1
30 %0:gpr(s32) = COPY $w0
31 %1:gpr(s32) = G_CONSTANT i32 0
32 %2:gpr(s32) = G_ICMP intpred(eq), %0, %1
33 %3:gpr(s1) = G_TRUNC %2(s32)
34 G_BRCOND %3(s1), %bb.1
46 ; CHECK-LABEL: name: cbz_s64
48 ; CHECK: successors: %bb.0(0x40000000), %bb.1(0x40000000)
49 ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
50 ; CHECK: CBZX [[COPY]], %bb.1
55 successors: %bb.0, %bb.1
57 %0:gpr(s64) = COPY $x0
58 %1:gpr(s64) = G_CONSTANT i64 0
59 %2:gpr(s32) = G_ICMP intpred(eq), %0, %1
60 %3:gpr(s1) = G_TRUNC %2(s32)
61 G_BRCOND %3(s1), %bb.1
73 ; CHECK-LABEL: name: cbnz_s32
75 ; CHECK: successors: %bb.0(0x40000000), %bb.1(0x40000000)
76 ; CHECK: [[COPY:%[0-9]+]]:gpr32 = COPY $w0
77 ; CHECK: CBNZW [[COPY]], %bb.1
82 successors: %bb.0, %bb.1
84 %0:gpr(s32) = COPY $w0
85 %1:gpr(s32) = G_CONSTANT i32 0
86 %2:gpr(s32) = G_ICMP intpred(ne), %0, %1
87 %3:gpr(s1) = G_TRUNC %2(s32)
88 G_BRCOND %3(s1), %bb.1
100 ; CHECK-LABEL: name: cbnz_s64
102 ; CHECK: successors: %bb.0(0x40000000), %bb.1(0x40000000)
103 ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $x0
104 ; CHECK: CBNZX [[COPY]], %bb.1
109 successors: %bb.0, %bb.1
111 %0:gpr(s64) = COPY $x0
112 %1:gpr(s64) = G_CONSTANT i64 0
113 %2:gpr(s32) = G_ICMP intpred(ne), %0, %1
114 %3:gpr(s1) = G_TRUNC %2(s32)
115 G_BRCOND %3(s1), %bb.1
121 name: test_rhs_inttoptr
124 regBankSelected: true
125 tracksRegLiveness: true
127 ; CHECK-LABEL: name: test_rhs_inttoptr
129 ; CHECK: successors: %bb.1(0x40000000), %bb.2(0x40000000)
130 ; CHECK: liveins: $x0
131 ; CHECK: [[COPY:%[0-9]+]]:gpr64common = COPY $x0
132 ; CHECK: CBZX [[COPY]], %bb.2
134 ; CHECK: successors: %bb.2(0x80000000)
135 ; CHECK: STRXui $xzr, [[COPY]], 0 :: (store 8 into %ir.p)
137 ; CHECK: RET_ReallyLR
139 successors: %bb.2, %bb.3
142 %0:gpr(p0) = COPY $x0
143 %2:gpr(s64) = G_CONSTANT i64 0
144 %1:gpr(p0) = G_INTTOPTR %2(s64)
145 %4:gpr(s32) = G_ICMP intpred(eq), %0(p0), %1
146 %3:gpr(s1) = G_TRUNC %4(s32)
147 G_BRCOND %3(s1), %bb.3
150 %5:gpr(s64) = G_CONSTANT i64 0
151 G_STORE %5(s64), %0(p0) :: (store 8 into %ir.p)
158 name: test_rhs_unknown
161 regBankSelected: true
162 tracksRegLiveness: true
164 ; CHECK-LABEL: name: test_rhs_unknown
166 ; CHECK: successors: %bb.1(0x40000000), %bb.2(0x40000000)
167 ; CHECK: liveins: $x0
168 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
169 ; CHECK: [[LDRXui:%[0-9]+]]:gpr64common = LDRXui [[COPY]], 0 :: (load 8 from %ir.p)
170 ; CHECK: $xzr = SUBSXri [[LDRXui]], 42, 0, implicit-def $nzcv
171 ; CHECK: Bcc 0, %bb.2, implicit $nzcv
173 ; CHECK: successors: %bb.2(0x80000000)
174 ; CHECK: STRXui $xzr, [[COPY]], 0 :: (store 8 into %ir.p)
176 ; CHECK: RET_ReallyLR
178 successors: %bb.2, %bb.3
181 %0:gpr(p0) = COPY $x0
182 %2:gpr(s64) = G_CONSTANT i64 42
183 %4:gpr(s64) = G_CONSTANT i64 0
184 %1:gpr(s64) = G_LOAD %0(p0) :: (load 8 from %ir.p)
185 %5:gpr(s32) = G_ICMP intpred(eq), %1(s64), %2
186 %3:gpr(s1) = G_TRUNC %5(s32)
187 G_BRCOND %3(s1), %bb.3
190 %6:gpr(s64) = G_CONSTANT i64 0
191 G_STORE %6(s64), %0(p0) :: (store 8 into %ir.p)