1 # RUN: llc -ppc-asm-full-reg-names -mtriple=powerpc64le-unknown-linux-gnu \
2 # RUN: -run-pass=early-tailduplication,ppc-ctrloops %s -o - -verify-machineinstrs 2>&1 | FileCheck %s
5 target datalayout = "e-m:e-i64:64-n32:64-S128-v256:256:256-v512:512:512"
6 target triple = "powerpc64le-unknown-linux-gnu"
8 define dso_local void @test() local_unnamed_addr #0 {
10 %_val_domain_ = load i32, ptr undef, align 4
11 %_conv765 = sext i32 %_val_domain_ to i64
12 br i1 undef, label %_label_42, label %_loop_40_loopHeader_
14 _loop_40_loopHeader_: ; preds = %test_entry
15 %_val_flags_1020 = load i32, ptr undef, align 4
16 %0 = and i32 %_val_flags_1020, 1
17 %_cond_conv_1022.not = icmp eq i32 %0, 0
18 %1 = sub i64 1, %_conv765
19 %smax = call i64 @llvm.smax.i64(i64 %1, i64 1)
22 _label_43.loopexit: ; preds = %_loop_44_loopHeader_
23 %lsr.iv.next = add i64 %lsr.iv, -1
26 _label_43: ; preds = %_label_43.loopexit, %_loop_40_loopHeader_
27 %lsr.iv = phi i64 [ %lsr.iv.next, %_label_43.loopexit ], [ undef, %_loop_40_loopHeader_ ]
28 call void @llvm.set.loop.iterations.i64(i64 %smax)
29 br label %_loop_44_do_
31 _loop_44_loopHeader_: ; preds = %_loop_44_do_
32 %2 = call i1 @llvm.loop.decrement.i64(i64 1)
33 br i1 %2, label %_loop_44_do_, label %_label_43.loopexit
35 _loop_44_do_: ; preds = %_loop_44_loopHeader_, %_label_43
36 br i1 %_cond_conv_1022.not, label %_label_42.loopexit, label %_loop_44_loopHeader_
38 _label_42.loopexit: ; preds = %_loop_44_do_
39 %3 = trunc i64 %lsr.iv to i32
40 store i32 %3, ptr undef, align 4
43 _label_42: ; preds = %test_entry
47 ; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn
48 declare i64 @llvm.smax.i64(i64, i64) #1
50 ; Function Attrs: nocallback noduplicate nofree nosync nounwind willreturn
51 declare void @llvm.set.loop.iterations.i64(i64) #2
53 ; Function Attrs: nocallback noduplicate nofree nosync nounwind willreturn
54 declare i1 @llvm.loop.decrement.i64(i64) #2
56 attributes #0 = { "unsafe-fp-math"="true" }
57 attributes #1 = { nocallback nofree nosync nounwind readnone speculatable willreturn }
58 attributes #2 = { nocallback noduplicate nofree nosync nounwind willreturn }
69 exposesReturnsTwice: false
71 regBankSelected: false
74 tracksRegLiveness: true
77 callsUnwindInit: false
81 failsVerification: false
82 tracksDebugUserValues: false
84 - { id: 0, class: g8rc, preferred-register: '' }
85 - { id: 1, class: crbitrc, preferred-register: '' }
86 - { id: 2, class: g8rc, preferred-register: '' }
87 - { id: 3, class: g8rc, preferred-register: '' }
88 - { id: 4, class: g8rc_and_g8rc_nox0, preferred-register: '' }
89 - { id: 5, class: g8rc_and_g8rc_nox0, preferred-register: '' }
90 - { id: 6, class: crbitrc, preferred-register: '' }
91 - { id: 7, class: g8rc, preferred-register: '' }
92 - { id: 8, class: gprc, preferred-register: '' }
93 - { id: 9, class: g8rc_and_g8rc_nox0, preferred-register: '' }
94 - { id: 10, class: g8rc_and_g8rc_nox0, preferred-register: '' }
95 - { id: 11, class: crrc, preferred-register: '' }
96 - { id: 12, class: g8rc_and_g8rc_nox0, preferred-register: '' }
97 - { id: 13, class: crbitrc, preferred-register: '' }
98 - { id: 14, class: g8rc_and_g8rc_nox0, preferred-register: '' }
99 - { id: 15, class: gprc, preferred-register: '' }
102 isFrameAddressTaken: false
103 isReturnAddressTaken: false
113 maxCallFrameSize: 4294967295
114 cvBytesOfCalleeSavedRegisters: 0
115 hasOpaqueSPAdjustment: false
117 hasMustTailInVarArgFunc: false
125 debugValueSubstitutions: []
127 machineFunctionInfo: {}
130 successors: %bb.7(0x40000000), %bb.1(0x40000000)
132 %5:g8rc_and_g8rc_nox0 = IMPLICIT_DEF
133 %0:g8rc = LWA 0, killed %5 :: (load (s32) from `ptr undef`)
134 %6:crbitrc = IMPLICIT_DEF
138 bb.1._loop_40_loopHeader_:
139 successors: %bb.3(0x80000000)
141 %9:g8rc_and_g8rc_nox0 = IMPLICIT_DEF
142 %8:gprc = LWZ 0, %9 :: (load (s32) from `ptr undef`)
143 %15:gprc = ANDI_rec %8, 1, implicit-def $cr0
144 %1:crbitrc = COPY $cr0eq
145 %10:g8rc_and_g8rc_nox0 = SUBFIC8 %0, 1, implicit-def dead $carry
146 %11:crrc = CMPDI %10, 1
147 %12:g8rc_and_g8rc_nox0 = LI8 1
148 %2:g8rc = ISEL8 %10, %12, %11.sub_gt
149 %7:g8rc = IMPLICIT_DEF
152 bb.2._label_43.loopexit:
153 successors: %bb.3(0x80000000)
155 %3:g8rc = ADDI8 %4, -1
158 successors: %bb.5(0x80000000)
160 %4:g8rc_and_g8rc_nox0 = PHI %7, %bb.1, %3, %bb.2
161 MTCTR8loop %2, implicit-def dead $ctr8
164 bb.4._loop_44_loopHeader_:
165 successors: %bb.5(0x7c000000), %bb.2(0x04000000)
167 %13:crbitrc = DecreaseCTR8loop 1, implicit-def dead $ctr8, implicit $ctr8
168 BCn killed %13, %bb.2
172 successors: %bb.6(0x00000000), %bb.4(0x80000000)
177 bb.6._label_42.loopexit:
180 %14:g8rc_and_g8rc_nox0 = IMPLICIT_DEF
181 STW8 %4, 0, killed %14 :: (store (s32) into `ptr undef`)