1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=thumbv8.1m.main -mattr=+mve.fp -run-pass=arm-low-overhead-loops --verify-machineinstrs %s -o - | FileCheck %s
5 define dso_local arm_aapcs_vfpcc void @remove_mov_lr_chain(ptr nocapture readonly %pSrc, ptr nocapture %pDst, i32 %blockSize) #0 {
7 %cmp5 = icmp eq i32 %blockSize, 0
8 br i1 %cmp5, label %while.end, label %while.body.preheader
10 while.body.preheader: ; preds = %entry
11 %min.iters.check = icmp ult i32 %blockSize, 4
12 br i1 %min.iters.check, label %while.body.preheader19, label %vector.memcheck
14 vector.memcheck: ; preds = %while.body.preheader
15 %scevgep = getelementptr float, ptr %pDst, i32 %blockSize
16 %scevgep12 = getelementptr float, ptr %pSrc, i32 %blockSize
17 %bound0 = icmp ugt ptr %scevgep12, %pDst
18 %bound1 = icmp ugt ptr %scevgep, %pSrc
19 %found.conflict = and i1 %bound0, %bound1
20 %0 = lshr i32 %blockSize, 2
21 %1 = shl nuw i32 %0, 2
24 %4 = add nuw nsw i32 %3, 1
25 br i1 %found.conflict, label %while.body.preheader19, label %vector.ph
27 vector.ph: ; preds = %vector.memcheck
28 %n.vec = and i32 %blockSize, -4
29 %ind.end = sub i32 %blockSize, %n.vec
30 %ind.end15 = getelementptr float, ptr %pSrc, i32 %n.vec
31 %ind.end17 = getelementptr float, ptr %pDst, i32 %n.vec
32 %scevgep9 = getelementptr float, ptr %pDst, i32 -4
33 %scevgep14 = getelementptr float, ptr %pSrc, i32 -4
34 %start1 = call i32 @llvm.start.loop.iterations.i32(i32 %4)
37 vector.body: ; preds = %vector.body, %vector.ph
38 %lsr.iv15 = phi ptr [ %scevgep16, %vector.body ], [ %scevgep14, %vector.ph ]
39 %lsr.iv10 = phi ptr [ %scevgep11, %vector.body ], [ %scevgep9, %vector.ph ]
40 %5 = phi i32 [ %start1, %vector.ph ], [ %7, %vector.body ]
41 %scevgep18 = getelementptr <4 x float>, ptr %lsr.iv15, i32 1
42 %wide.load = load <4 x float>, ptr %scevgep18, align 4
43 %6 = call fast <4 x float> @llvm.fabs.v4f32(<4 x float> %wide.load)
44 %scevgep13 = getelementptr <4 x float>, ptr %lsr.iv10, i32 1
45 store <4 x float> %6, ptr %scevgep13, align 4
46 %scevgep11 = getelementptr float, ptr %lsr.iv10, i32 4
47 %scevgep16 = getelementptr float, ptr %lsr.iv15, i32 4
48 %7 = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %5, i32 1)
49 %8 = icmp ne i32 %7, 0
50 br i1 %8, label %vector.body, label %middle.block
52 middle.block: ; preds = %vector.body
53 %cmp.n = icmp eq i32 %n.vec, %blockSize
54 br i1 %cmp.n, label %while.end, label %while.body.preheader19
56 while.body.preheader19: ; preds = %middle.block, %vector.memcheck, %while.body.preheader
57 %blkCnt.08.ph = phi i32 [ %blockSize, %vector.memcheck ], [ %blockSize, %while.body.preheader ], [ %ind.end, %middle.block ]
58 %pSrc.addr.07.ph = phi ptr [ %pSrc, %vector.memcheck ], [ %pSrc, %while.body.preheader ], [ %ind.end15, %middle.block ]
59 %pDst.addr.06.ph = phi ptr [ %pDst, %vector.memcheck ], [ %pDst, %while.body.preheader ], [ %ind.end17, %middle.block ]
60 %scevgep1 = getelementptr float, ptr %pSrc.addr.07.ph, i32 -1
61 %scevgep4 = getelementptr float, ptr %pDst.addr.06.ph, i32 -1
62 %start2 = call i32 @llvm.start.loop.iterations.i32(i32 %blkCnt.08.ph)
65 while.body: ; preds = %while.body, %while.body.preheader19
66 %lsr.iv5 = phi ptr [ %scevgep6, %while.body ], [ %scevgep4, %while.body.preheader19 ]
67 %lsr.iv = phi ptr [ %scevgep2, %while.body ], [ %scevgep1, %while.body.preheader19 ]
68 %9 = phi i32 [ %start2, %while.body.preheader19 ], [ %12, %while.body ]
69 %scevgep3 = getelementptr float, ptr %lsr.iv, i32 1
70 %scevgep7 = getelementptr float, ptr %lsr.iv5, i32 1
71 %10 = load float, ptr %scevgep3, align 4
72 %11 = tail call fast float @llvm.fabs.f32(float %10)
73 store float %11, ptr %scevgep7, align 4
74 %scevgep2 = getelementptr float, ptr %lsr.iv, i32 1
75 %scevgep6 = getelementptr float, ptr %lsr.iv5, i32 1
76 %12 = call i32 @llvm.loop.decrement.reg.i32.i32.i32(i32 %9, i32 1)
77 %13 = icmp ne i32 %12, 0
78 br i1 %13, label %while.body, label %while.end
80 while.end: ; preds = %while.body, %middle.block, %entry
83 declare float @llvm.fabs.f32(float)
84 declare <4 x float> @llvm.fabs.v4f32(<4 x float>)
85 declare i32 @llvm.start.loop.iterations.i32(i32)
86 declare i32 @llvm.loop.decrement.reg.i32.i32.i32(i32, i32)
90 name: remove_mov_lr_chain
92 exposesReturnsTwice: false
94 regBankSelected: false
97 tracksRegLiveness: true
101 - { reg: '$r0', virtual-reg: '' }
102 - { reg: '$r1', virtual-reg: '' }
103 - { reg: '$r2', virtual-reg: '' }
105 isFrameAddressTaken: false
106 isReturnAddressTaken: false
116 cvBytesOfCalleeSavedRegisters: 0
117 hasOpaqueSPAdjustment: false
119 hasMustTailInVarArgFunc: false
125 - { id: 0, name: '', type: spill-slot, offset: -4, size: 4, alignment: 4,
126 stack-id: default, callee-saved-register: '$lr', callee-saved-restored: false,
127 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
128 - { id: 1, name: '', type: spill-slot, offset: -8, size: 4, alignment: 4,
129 stack-id: default, callee-saved-register: '$r7', callee-saved-restored: true,
130 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
131 - { id: 2, name: '', type: spill-slot, offset: -12, size: 4, alignment: 4,
132 stack-id: default, callee-saved-register: '$r5', callee-saved-restored: true,
133 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
134 - { id: 3, name: '', type: spill-slot, offset: -16, size: 4, alignment: 4,
135 stack-id: default, callee-saved-register: '$r4', callee-saved-restored: true,
136 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
139 machineFunctionInfo: {}
141 ; CHECK-LABEL: name: remove_mov_lr_chain
143 ; CHECK: successors: %bb.9(0x30000000), %bb.1(0x50000000)
144 ; CHECK: liveins: $lr, $r0, $r1, $r2, $r4, $r5, $r7
145 ; CHECK: frame-setup tPUSH 14 /* CC::al */, $noreg, killed $r4, killed $r5, killed $r7, killed $lr, implicit-def $sp, implicit $sp
146 ; CHECK: frame-setup CFI_INSTRUCTION def_cfa_offset 16
147 ; CHECK: frame-setup CFI_INSTRUCTION offset $lr, -4
148 ; CHECK: frame-setup CFI_INSTRUCTION offset $r7, -8
149 ; CHECK: frame-setup CFI_INSTRUCTION offset $r5, -12
150 ; CHECK: frame-setup CFI_INSTRUCTION offset $r4, -16
151 ; CHECK: tCMPi8 renamable $r2, 0, 14 /* CC::al */, $noreg, implicit-def $cpsr
152 ; CHECK: tBcc %bb.9, 0 /* CC::eq */, killed $cpsr
153 ; CHECK: bb.1.while.body.preheader:
154 ; CHECK: successors: %bb.6(0x40000000), %bb.2(0x40000000)
155 ; CHECK: liveins: $r0, $r1, $r2
156 ; CHECK: tCMPi8 renamable $r2, 4, 14 /* CC::al */, $noreg, implicit-def $cpsr
157 ; CHECK: tBcc %bb.6, 3 /* CC::lo */, killed $cpsr
158 ; CHECK: bb.2.vector.memcheck:
159 ; CHECK: successors: %bb.3(0x40000000), %bb.6(0x40000000)
160 ; CHECK: liveins: $r0, $r1, $r2
161 ; CHECK: renamable $r3 = t2ADDrs renamable $r0, renamable $r2, 18, 14 /* CC::al */, $noreg, $noreg
162 ; CHECK: tCMPr killed renamable $r3, renamable $r1, 14 /* CC::al */, $noreg, implicit-def $cpsr
163 ; CHECK: t2IT 8, 4, implicit-def $itstate
164 ; CHECK: renamable $r3 = t2ADDrs renamable $r1, renamable $r2, 18, 8 /* CC::hi */, $cpsr, $noreg, implicit $itstate
165 ; CHECK: tCMPr killed renamable $r3, renamable $r0, 8 /* CC::hi */, killed $cpsr, implicit-def $cpsr, implicit killed $itstate
166 ; CHECK: tBcc %bb.6, 8 /* CC::hi */, killed $cpsr
167 ; CHECK: bb.3.vector.ph:
168 ; CHECK: successors: %bb.4(0x80000000)
169 ; CHECK: liveins: $r0, $r1, $r2
170 ; CHECK: renamable $r4 = t2BICri renamable $r2, 3, 14 /* CC::al */, $noreg, $noreg
171 ; CHECK: renamable $r3, dead $cpsr = tMOVi8 1, 14 /* CC::al */, $noreg
172 ; CHECK: renamable $r12 = t2SUBri renamable $r4, 4, 14 /* CC::al */, $noreg, $noreg
173 ; CHECK: renamable $r7, dead $cpsr = tSUBrr renamable $r2, renamable $r4, 14 /* CC::al */, $noreg
174 ; CHECK: renamable $r3 = nuw nsw t2ADDrs killed renamable $r3, killed renamable $r12, 19, 14 /* CC::al */, $noreg, $noreg
175 ; CHECK: renamable $r12 = t2ADDrs renamable $r0, renamable $r4, 18, 14 /* CC::al */, $noreg, $noreg
176 ; CHECK: dead $lr = tMOVr renamable $r3, 14 /* CC::al */, $noreg
177 ; CHECK: renamable $r0, dead $cpsr = tSUBi8 killed renamable $r0, 16, 14 /* CC::al */, $noreg
178 ; CHECK: $r5 = tMOVr killed $r3, 14 /* CC::al */, $noreg
179 ; CHECK: renamable $r3 = t2ADDrs renamable $r1, renamable $r4, 18, 14 /* CC::al */, $noreg, $noreg
180 ; CHECK: renamable $r1, dead $cpsr = tSUBi8 killed renamable $r1, 16, 14 /* CC::al */, $noreg
181 ; CHECK: bb.4.vector.body:
182 ; CHECK: successors: %bb.4(0x7c000000), %bb.5(0x04000000)
183 ; CHECK: liveins: $r0, $r1, $r2, $r3, $r4, $r5, $r7, $r12
184 ; CHECK: renamable $r0, renamable $q0 = MVE_VLDRWU32_pre killed renamable $r0, 16, 0, $noreg, $noreg :: (load (s128) from %ir.scevgep18, align 4)
185 ; CHECK: $lr = tMOVr killed $r5, 14 /* CC::al */, $noreg
186 ; CHECK: renamable $q0 = nnan ninf nsz arcp contract afn reassoc MVE_VABSf32 killed renamable $q0, 0, $noreg, $noreg, undef renamable $q0
187 ; CHECK: renamable $r1 = MVE_VSTRBU8_pre killed renamable $q0, killed renamable $r1, 16, 0, $noreg, $noreg :: (store (s128) into %ir.scevgep13, align 4)
188 ; CHECK: renamable $lr = t2SUBri killed renamable $lr, 1, 14 /* CC::al */, $noreg, def $cpsr
189 ; CHECK: $r5 = tMOVr killed $lr, 14 /* CC::al */, $noreg
190 ; CHECK: tBcc %bb.4, 1 /* CC::ne */, killed $cpsr
191 ; CHECK: tB %bb.5, 14 /* CC::al */, $noreg
192 ; CHECK: bb.5.middle.block:
193 ; CHECK: successors: %bb.7(0x80000000)
194 ; CHECK: liveins: $r2, $r3, $r4, $r7, $r12
195 ; CHECK: tCMPr killed renamable $r4, killed renamable $r2, 14 /* CC::al */, $noreg, implicit-def $cpsr
196 ; CHECK: $lr = tMOVr killed $r7, 14 /* CC::al */, $noreg
197 ; CHECK: t2IT 0, 8, implicit-def $itstate
198 ; CHECK: tPOP_RET 0 /* CC::eq */, killed $cpsr, def $r4, def $r5, def $r7, def $pc, implicit killed $itstate
199 ; CHECK: tB %bb.7, 14 /* CC::al */, $noreg
201 ; CHECK: successors: %bb.7(0x80000000)
202 ; CHECK: liveins: $r0, $r1, $r2
203 ; CHECK: $lr = tMOVr killed $r2, 14 /* CC::al */, $noreg
204 ; CHECK: $r12 = tMOVr killed $r0, 14 /* CC::al */, $noreg
205 ; CHECK: $r3 = tMOVr killed $r1, 14 /* CC::al */, $noreg
206 ; CHECK: bb.7.while.body.preheader19:
207 ; CHECK: successors: %bb.8(0x80000000)
208 ; CHECK: liveins: $lr, $r3, $r12
209 ; CHECK: renamable $r0, dead $cpsr = tSUBi3 killed renamable $r3, 4, 14 /* CC::al */, $noreg
210 ; CHECK: renamable $r1 = t2SUBri killed renamable $r12, 4, 14 /* CC::al */, $noreg, $noreg
211 ; CHECK: bb.8.while.body:
212 ; CHECK: successors: %bb.8(0x7c000000), %bb.9(0x04000000)
213 ; CHECK: liveins: $lr, $r0, $r1
214 ; CHECK: renamable $s0 = VLDRS renamable $r1, 1, 14 /* CC::al */, $noreg :: (load (s32) from %ir.scevgep3)
215 ; CHECK: renamable $r1, dead $cpsr = tADDi8 killed renamable $r1, 4, 14 /* CC::al */, $noreg
216 ; CHECK: renamable $s0 = nnan ninf nsz arcp contract afn reassoc VABSS killed renamable $s0, 14 /* CC::al */, $noreg
217 ; CHECK: VSTRS killed renamable $s0, renamable $r0, 1, 14 /* CC::al */, $noreg :: (store (s32) into %ir.scevgep7)
218 ; CHECK: renamable $r0, dead $cpsr = tADDi8 killed renamable $r0, 4, 14 /* CC::al */, $noreg
219 ; CHECK: $lr = t2LEUpdate killed renamable $lr, %bb.8
220 ; CHECK: bb.9.while.end:
221 ; CHECK: tPOP_RET 14 /* CC::al */, $noreg, def $r4, def $r5, def $r7, def $pc
223 successors: %bb.9(0x30000000), %bb.1(0x50000000)
224 liveins: $r0, $r1, $r2, $r4, $r5, $r7, $lr
226 frame-setup tPUSH 14, $noreg, killed $r4, killed $r5, killed $r7, killed $lr, implicit-def $sp, implicit $sp
227 frame-setup CFI_INSTRUCTION def_cfa_offset 16
228 frame-setup CFI_INSTRUCTION offset $lr, -4
229 frame-setup CFI_INSTRUCTION offset $r7, -8
230 frame-setup CFI_INSTRUCTION offset $r5, -12
231 frame-setup CFI_INSTRUCTION offset $r4, -16
232 tCMPi8 renamable $r2, 0, 14, $noreg, implicit-def $cpsr
233 tBcc %bb.9, 0, killed $cpsr
235 bb.1.while.body.preheader:
236 successors: %bb.6(0x40000000), %bb.2(0x40000000)
237 liveins: $r0, $r1, $r2
239 tCMPi8 renamable $r2, 4, 14, $noreg, implicit-def $cpsr
240 tBcc %bb.6, 3, killed $cpsr
242 bb.2.vector.memcheck:
243 successors: %bb.3(0x40000000), %bb.6(0x40000000)
244 liveins: $r0, $r1, $r2
246 renamable $r3 = t2ADDrs renamable $r0, renamable $r2, 18, 14, $noreg, $noreg
247 tCMPr killed renamable $r3, renamable $r1, 14, $noreg, implicit-def $cpsr
248 t2IT 8, 4, implicit-def $itstate
249 renamable $r3 = t2ADDrs renamable $r1, renamable $r2, 18, 8, $cpsr, $noreg, implicit $itstate
250 tCMPr killed renamable $r3, renamable $r0, 8, killed $cpsr, implicit-def $cpsr, implicit killed $itstate
251 tBcc %bb.6, 8, killed $cpsr
254 successors: %bb.4(0x80000000)
255 liveins: $r0, $r1, $r2
257 renamable $r4 = t2BICri renamable $r2, 3, 14, $noreg, $noreg
258 renamable $r3, dead $cpsr = tMOVi8 1, 14, $noreg
259 renamable $r12 = t2SUBri renamable $r4, 4, 14, $noreg, $noreg
260 renamable $r7, dead $cpsr = tSUBrr renamable $r2, renamable $r4, 14, $noreg
261 renamable $r3 = nuw nsw t2ADDrs killed renamable $r3, killed renamable $r12, 19, 14, $noreg, $noreg
262 renamable $r12 = t2ADDrs renamable $r0, renamable $r4, 18, 14, $noreg, $noreg
263 $lr = t2DoLoopStart renamable $r3
264 renamable $r0, dead $cpsr = tSUBi8 killed renamable $r0, 16, 14, $noreg
265 $r5 = tMOVr killed $r3, 14, $noreg
266 renamable $r3 = t2ADDrs renamable $r1, renamable $r4, 18, 14, $noreg, $noreg
267 renamable $r1, dead $cpsr = tSUBi8 killed renamable $r1, 16, 14, $noreg
270 successors: %bb.4(0x7c000000), %bb.5(0x04000000)
271 liveins: $r0, $r1, $r2, $r3, $r4, $r5, $r7, $r12
273 renamable $r0, renamable $q0 = MVE_VLDRWU32_pre killed renamable $r0, 16, 0, $noreg, $noreg :: (load (s128) from %ir.scevgep18, align 4)
274 $lr = tMOVr killed $r5, 14, $noreg
275 renamable $q0 = nnan ninf nsz arcp contract afn reassoc MVE_VABSf32 killed renamable $q0, 0, $noreg, $noreg, undef renamable $q0
276 renamable $r1 = MVE_VSTRBU8_pre killed renamable $q0, killed renamable $r1, 16, 0, $noreg, $noreg :: (store (s128) into %ir.scevgep13, align 4)
277 renamable $lr = t2LoopDec killed renamable $lr, 1
278 $r5 = tMOVr $lr, 14, $noreg
279 t2LoopEnd killed renamable $lr, %bb.4, implicit-def dead $cpsr
283 successors: %bb.7(0x80000000)
284 liveins: $r2, $r3, $r4, $r7, $r12
286 tCMPr killed renamable $r4, killed renamable $r2, 14, $noreg, implicit-def $cpsr
287 $lr = tMOVr killed $r7, 14, $noreg
288 t2IT 0, 8, implicit-def $itstate
289 tPOP_RET 0, killed $cpsr, def $r4, def $r5, def $r7, def $pc, implicit killed $itstate
293 successors: %bb.7(0x80000000)
294 liveins: $r0, $r1, $r2
296 $lr = tMOVr killed $r2, 14, $noreg
297 $r12 = tMOVr killed $r0, 14, $noreg
298 $r3 = tMOVr killed $r1, 14, $noreg
300 bb.7.while.body.preheader19:
301 successors: %bb.8(0x80000000)
302 liveins: $lr, $r3, $r12
304 renamable $r0, dead $cpsr = tSUBi3 killed renamable $r3, 4, 14, $noreg
305 renamable $r1 = t2SUBri killed renamable $r12, 4, 14, $noreg, $noreg
306 $lr = t2DoLoopStart renamable $lr
309 successors: %bb.8(0x7c000000), %bb.9(0x04000000)
310 liveins: $lr, $r0, $r1
312 renamable $s0 = VLDRS renamable $r1, 1, 14, $noreg :: (load (s32) from %ir.scevgep3)
313 renamable $r1, dead $cpsr = tADDi8 killed renamable $r1, 4, 14, $noreg
314 renamable $s0 = nnan ninf nsz arcp contract afn reassoc VABSS killed renamable $s0, 14, $noreg
315 VSTRS killed renamable $s0, renamable $r0, 1, 14, $noreg :: (store (s32) into %ir.scevgep7)
316 renamable $r0, dead $cpsr = tADDi8 killed renamable $r0, 4, 14, $noreg
317 renamable $lr = t2LoopDec killed renamable $lr, 1
318 t2LoopEnd renamable $lr, %bb.8, implicit-def dead $cpsr
322 tPOP_RET 14, $noreg, def $r4, def $r5, def $r7, def $pc