1 # RUN: llc -ppc-asm-full-reg-names -mtriple=powerpc64le-unknown-linux-gnu \
2 # RUN: -run-pass=ppc-ctrloops %s -o - -verify-machineinstrs | FileCheck %s
3 # RUN: llc -ppc-asm-full-reg-names -mtriple=powerpc64-ibm-aix-xcoff \
4 # RUN: -run-pass=ppc-ctrloops %s -o - -verify-machineinstrs | FileCheck %s
10 tracksRegLiveness: true
20 MTCTR8loop killed %0:g8rc, implicit-def dead $ctr8
24 %1:crbitrc = DecreaseCTR8loop 1, implicit-def dead $ctr8, implicit $ctr8
25 BC killed %1:crbitrc, %bb.1
30 BLR8 implicit $lr8, implicit $rm
33 name: test_fail_clobber
34 # CHECK: test_fail_clobber
35 tracksRegLiveness: true
40 ; CHECK-NOT: MTCTR8loop
45 MTCTR8loop killed %0:g8rc, implicit-def dead $ctr8
49 INLINEASM &"", 1 /* sideeffect attdialect */, 12 /* clobber */, implicit-def early-clobber $ctr8
50 %1:crbitrc = DecreaseCTR8loop 1, implicit-def dead $ctr8, implicit $ctr8
51 BC killed %1:crbitrc, %bb.1
56 BLR8 implicit $lr8, implicit $rm
59 name: test_fail_use_in_loop
60 # CHECK: test_fail_use_in_loop
61 tracksRegLiveness: true
66 ; CHECK-NOT: MTCTR8loop
71 MTCTR8loop killed %0:g8rc, implicit-def dead $ctr8
75 %1:g8rc = MFCTR8 implicit $ctr8
76 %2:crbitrc = DecreaseCTR8loop 1, implicit-def dead $ctr8, implicit $ctr8
77 BC killed %2:crbitrc, %bb.1
82 BLR8 implicit $lr8, implicit $rm
85 name: test_fail_call_in_preheader_after_mtctr
86 # CHECK: test_fail_call_in_preheader_after_mtctr
87 tracksRegLiveness: true
97 MTCTR8loop killed %0:g8rc, implicit-def dead $ctr8
98 BL8 @test_fail_use_in_loop, csr_ppc64, implicit-def dead $lr8, implicit $rm
102 %1:crbitrc = DecreaseCTR8loop 1, implicit-def dead $ctr8, implicit $ctr8
103 BC killed %1:crbitrc, %bb.1
108 BLR8 implicit $lr8, implicit $rm
111 name: test_succ_call_in_preheader_before_mtctr
112 # CHECK: test_succ_call_in_preheader_before_mtctr
113 tracksRegLiveness: true
118 BL8 @test_fail_use_in_loop, csr_ppc64, implicit-def dead $lr8, implicit $rm
124 MTCTR8loop killed %0:g8rc, implicit-def dead $ctr8
128 %1:crbitrc = DecreaseCTR8loop 1, implicit-def dead $ctr8, implicit $ctr8
129 BC killed %1:crbitrc, %bb.1
134 BLR8 implicit $lr8, implicit $rm
137 name: test_fail_call_in_loop
138 # CHECK: test_fail_call_in_loop
139 tracksRegLiveness: true
149 MTCTR8loop killed %0:g8rc, implicit-def dead $ctr8
153 BL8 @test_fail_use_in_loop, csr_ppc64, implicit-def dead $lr8, implicit $rm
154 %1:crbitrc = DecreaseCTR8loop 1, implicit-def dead $ctr8, implicit $ctr8
155 BC killed %1:crbitrc, %bb.1
160 BLR8 implicit $lr8, implicit $rm
163 name: test_fail_indirect_call_in_loop
164 # CHECK: test_fail_indirect_call_in_loop
165 tracksRegLiveness: true
176 renamable %1:crrc = CMPLD killed renamable $x3, killed renamable $x4
177 renamable %2:crbitrc = COPY %1.sub_gt
178 MTLR8 %0:g8rc, implicit-def $lr8
179 MTCTR8loop killed %0:g8rc, implicit-def dead $ctr8
183 BCLRL renamable %2, implicit $lr, implicit $rm
184 %3:crbitrc = DecreaseCTR8loop 1, implicit-def dead $ctr8, implicit $ctr8
185 BC killed %3:crbitrc, %bb.1
190 BLR8 implicit $lr8, implicit $rm
193 name: test_fail_livein_preheader
194 # CHECK: test_fail_livein_preheader
195 tracksRegLiveness: true
201 ; CHECK-NOT: MTCTR8loop
206 MTCTR8loop killed %0:g8rc, implicit-def dead $ctr8
210 %1:crbitrc = DecreaseCTR8loop 1, implicit-def dead $ctr8, implicit $ctr8
211 BC killed %1:crbitrc, %bb.1
216 BLR8 implicit $lr8, implicit $rm
219 name: test_fail_def_preheader
220 # CHECK: test_fail_def_preheader
221 tracksRegLiveness: true
225 INLINEASM &"", 1 /* sideeffect attdialect */, 12 /* clobber */, implicit-def early-clobber $ctr8
227 ; CHECK-NOT: MTCTR8loop
232 MTCTR8loop killed %0:g8rc, implicit-def dead $ctr8
236 %1:crbitrc = DecreaseCTR8loop 1, implicit-def dead $ctr8, implicit $ctr8
237 BC killed %1:crbitrc, %bb.1
242 BLR8 implicit $lr8, implicit $rm
245 name: test_success_only_use_preheader
246 # CHECK: test_success_only_use_preheader
247 tracksRegLiveness: true
251 %0:g8rc = MFCTR8 implicit $ctr8
258 MTCTR8loop killed %1:g8rc, implicit-def dead $ctr8
262 %2:crbitrc = DecreaseCTR8loop 1, implicit-def dead $ctr8, implicit $ctr8
263 BC killed %2:crbitrc, %bb.1
268 BLR8 implicit $lr8, implicit $rm
271 name: test_fail_use_after_mtctr
272 # CHECK: test_fail_use_after_mtctr
273 tracksRegLiveness: true
278 ; CHECK-NOT: MTCTR8loop
283 MTCTR8loop killed %0:g8rc, implicit-def dead $ctr8
284 %1:g8rc = MFCTR8 implicit $ctr8
288 %2:crbitrc = DecreaseCTR8loop 1, implicit-def dead $ctr8, implicit $ctr8
289 BC killed %2:crbitrc, %bb.1
294 BLR8 implicit $lr8, implicit $rm
297 name: test_fail_def_after_mtctr
298 # CHECK: test_fail_def_after_mtctr
299 tracksRegLiveness: true
304 ; CHECK-NOT: MTCTR8loop
309 MTCTR8loop killed %0:g8rc, implicit-def dead $ctr8
310 INLINEASM &"", 1 /* sideeffect attdialect */, 12 /* clobber */, implicit-def early-clobber $ctr8
314 %2:crbitrc = DecreaseCTR8loop 1, implicit-def dead $ctr8, implicit $ctr8
315 BC killed %2:crbitrc, %bb.1
320 BLR8 implicit $lr8, implicit $rm
323 name: test_success_def_after_loop
324 # CHECK: test_success_def_after_loop
325 tracksRegLiveness: true
335 MTCTR8loop killed %0:g8rc, implicit-def dead $ctr8
339 %2:crbitrc = DecreaseCTR8loop 1, implicit-def dead $ctr8, implicit $ctr8
340 BC killed %2:crbitrc, %bb.1
344 INLINEASM &"", 1 /* sideeffect attdialect */, 12 /* clobber */, implicit-def early-clobber $ctr8
346 BLR8 implicit $lr8, implicit $rm
349 name: test_fail_dead_def_in_preheader
350 # CHECK: test_fail_dead_def_in_preheader
351 tracksRegLiveness: true
357 MTCTR8loop killed %0:g8rc, implicit-def dead $ctr8
358 MTCTR8 killed %1:g8rc, implicit-def dead $ctr8
359 ; CHECK-NOT: MTCTR8loop
367 %2:crbitrc = DecreaseCTR8loop 1, implicit-def dead $ctr8, implicit $ctr8
368 BC killed %2:crbitrc, %bb.1
373 BLR8 implicit $lr8, implicit $rm