1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=thumbv8.1m.main -mattr=+lob -run-pass=arm-low-overhead-loops --verify-machineinstrs %s -o - | FileCheck %s
5 target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
6 target triple = "thumbv8.1m.main"
8 define void @ne_trip_count(i1 zeroext %t1, i32* nocapture %a, i32* nocapture readonly %b, i32 %N) #0 {
10 %0 = call i1 @llvm.test.set.loop.iterations.i32(i32 %N)
11 br i1 %0, label %do.body.preheader, label %if.end
13 do.body.preheader: ; preds = %entry
14 %scevgep2 = getelementptr i32, i32* %a, i32 -1
15 %scevgep5 = getelementptr i32, i32* %b, i32 -1
18 do.body: ; preds = %do.body, %do.body.preheader
19 %lsr.iv6 = phi i32* [ %scevgep5, %do.body.preheader ], [ %scevgep7, %do.body ]
20 %lsr.iv = phi i32* [ %scevgep2, %do.body.preheader ], [ %scevgep3, %do.body ]
21 %1 = phi i32 [ %2, %do.body ], [ %N, %do.body.preheader ]
22 %scevgep = getelementptr i32, i32* %lsr.iv6, i32 1
23 %scevgep1 = getelementptr i32, i32* %lsr.iv, i32 1
24 %size = call i32 @llvm.arm.space(i32 4096, i32 undef)
25 %tmp = load i32, i32* %scevgep, align 4
26 store i32 %tmp, i32* %scevgep1, align 4
27 %2 = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %1, i32 1)
28 %3 = icmp ne i32 %2, 0
29 %scevgep3 = getelementptr i32, i32* %lsr.iv, i32 1
30 %scevgep7 = getelementptr i32, i32* %lsr.iv6, i32 1
31 br i1 %3, label %do.body, label %if.end
33 if.end: ; preds = %do.body, %entry
37 ; Function Attrs: nounwind
38 declare i32 @llvm.arm.space(i32 immarg, i32) #1
40 ; Function Attrs: noduplicate nounwind
41 declare i1 @llvm.test.set.loop.iterations.i32(i32) #2
43 ; Function Attrs: noduplicate nounwind
44 declare i32 @llvm.loop.decrement.reg.i32.i32.i32(i32, i32) #2
46 attributes #0 = { "target-features"="+lob" }
47 attributes #1 = { nounwind }
48 attributes #2 = { noduplicate nounwind }
54 exposesReturnsTwice: false
56 regBankSelected: false
59 tracksRegLiveness: true
63 - { reg: '$r1', virtual-reg: '' }
64 - { reg: '$r2', virtual-reg: '' }
65 - { reg: '$r3', virtual-reg: '' }
67 isFrameAddressTaken: false
68 isReturnAddressTaken: false
78 cvBytesOfCalleeSavedRegisters: 0
79 hasOpaqueSPAdjustment: false
81 hasMustTailInVarArgFunc: false
87 - { id: 0, name: '', type: spill-slot, offset: -4, size: 4, alignment: 4,
88 stack-id: default, callee-saved-register: '$lr', callee-saved-restored: false,
89 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
90 - { id: 1, name: '', type: spill-slot, offset: -8, size: 4, alignment: 4,
91 stack-id: default, callee-saved-register: '$r7', callee-saved-restored: true,
92 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
95 machineFunctionInfo: {}
97 ; CHECK-LABEL: name: ne_trip_count
99 ; CHECK: successors: %bb.1(0x40000000), %bb.3(0x40000000)
100 ; CHECK: liveins: $lr, $r1, $r2, $r3, $r7
101 ; CHECK: frame-setup tPUSH 14 /* CC::al */, $noreg, killed $r7, killed $lr, implicit-def $sp, implicit $sp
102 ; CHECK: frame-setup CFI_INSTRUCTION def_cfa_offset 8
103 ; CHECK: frame-setup CFI_INSTRUCTION offset $lr, -4
104 ; CHECK: frame-setup CFI_INSTRUCTION offset $r7, -8
105 ; CHECK: dead $lr = t2SUBri $r3, 0, 14 /* CC::al */, $noreg, def $cpsr
106 ; CHECK: t2Bcc %bb.3, 0 /* CC::eq */, killed $cpsr
107 ; CHECK: tB %bb.1, 14 /* CC::al */, $noreg
108 ; CHECK: bb.1.do.body.preheader:
109 ; CHECK: successors: %bb.2(0x80000000)
110 ; CHECK: liveins: $r1, $r2, $r3
111 ; CHECK: renamable $r0, dead $cpsr = tSUBi3 killed renamable $r2, 4, 14 /* CC::al */, $noreg
112 ; CHECK: renamable $r1, dead $cpsr = tSUBi8 killed renamable $r1, 4, 14 /* CC::al */, $noreg
113 ; CHECK: $lr = tMOVr killed $r3, 14 /* CC::al */, $noreg
114 ; CHECK: bb.2.do.body:
115 ; CHECK: successors: %bb.2(0x7c000000), %bb.3(0x04000000)
116 ; CHECK: liveins: $lr, $r0, $r1
117 ; CHECK: dead renamable $r2 = SPACE 4096, undef renamable $r0
118 ; CHECK: renamable $r2, renamable $r0 = t2LDR_PRE killed renamable $r0, 4, 14 /* CC::al */, $noreg :: (load (s32) from %ir.scevgep)
119 ; CHECK: early-clobber renamable $r1 = t2STR_PRE killed renamable $r2, killed renamable $r1, 4, 14 /* CC::al */, $noreg :: (store (s32) into %ir.scevgep1)
120 ; CHECK: renamable $lr = t2SUBri killed renamable $lr, 1, 14 /* CC::al */, $noreg, def $cpsr
121 ; CHECK: t2Bcc %bb.2, 1 /* CC::ne */, killed $cpsr
122 ; CHECK: tB %bb.3, 14 /* CC::al */, $noreg
123 ; CHECK: bb.3.if.end:
124 ; CHECK: tPOP_RET 14 /* CC::al */, $noreg, def $r7, def $pc
126 successors: %bb.1(0x40000000), %bb.3(0x40000000)
127 liveins: $r1, $r2, $r3, $r7, $lr
129 frame-setup tPUSH 14, $noreg, killed $r7, killed $lr, implicit-def $sp, implicit $sp
130 frame-setup CFI_INSTRUCTION def_cfa_offset 8
131 frame-setup CFI_INSTRUCTION offset $lr, -4
132 frame-setup CFI_INSTRUCTION offset $r7, -8
133 $lr = t2WhileLoopStartLR $r3, %bb.3, implicit-def dead $cpsr
136 bb.1.do.body.preheader:
137 successors: %bb.2(0x80000000)
138 liveins: $r1, $r2, $r3
140 renamable $r0, dead $cpsr = tSUBi3 killed renamable $r2, 4, 14, $noreg
141 renamable $r1, dead $cpsr = tSUBi8 killed renamable $r1, 4, 14, $noreg
142 $lr = tMOVr killed $r3, 14, $noreg
145 successors: %bb.2(0x7c000000), %bb.3(0x04000000)
146 liveins: $lr, $r0, $r1
148 dead renamable $r2 = SPACE 4096, undef renamable $r0
149 renamable $r2, renamable $r0 = t2LDR_PRE killed renamable $r0, 4, 14, $noreg :: (load (s32) from %ir.scevgep)
150 early-clobber renamable $r1 = t2STR_PRE killed renamable $r2, killed renamable $r1, 4, 14, $noreg :: (store (s32) into %ir.scevgep1)
151 renamable $lr = t2LoopDec killed renamable $lr, 1
152 t2LoopEnd renamable $lr, %bb.2, implicit-def dead $cpsr
156 tPOP_RET 14, $noreg, def $r7, def $pc