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 %s -o - | FileCheck %s
5 define hidden arm_aapcs_vfpcc void @it_block_store_count_before_start(float* %pSrc, float* %pDst, i32 %blockSize, i32* %iter.addr) #0 {
7 %mul = shl i32 %blockSize, 1
9 %1 = icmp slt i32 %mul, 4
10 %smin = select i1 %1, i32 %mul, i32 4
11 %2 = sub i32 %0, %smin
13 %4 = add nuw nsw i32 %3, 1
14 store i32 %4, i32* %iter.addr, align 4
15 %start = call i32 @llvm.start.loop.iterations.i32(i32 %4)
18 do.body: ; preds = %do.body, %entry
19 %lsr.iv = phi i32 [ %lsr.iv.next, %do.body ], [ %start, %entry ]
20 %blkCnt.0 = phi i32 [ %mul, %entry ], [ %sub, %do.body ]
21 %pDst.addr.0 = phi float* [ %pDst, %entry ], [ %add.ptr4, %do.body ]
22 %pSrc.addr.0 = phi float* [ %pSrc, %entry ], [ %add.ptr, %do.body ]
23 %pDst.addr.01 = bitcast float* %pDst.addr.0 to <4 x float>*
24 %pSrc.addr.02 = bitcast float* %pSrc.addr.0 to <4 x float>*
25 %5 = tail call <4 x i1> @llvm.arm.mve.vctp32(i32 %blkCnt.0)
26 %6 = tail call <4 x float> @llvm.masked.load.v4f32.p0v4f32(<4 x float>* %pSrc.addr.02, i32 4, <4 x i1> %5, <4 x float> undef)
27 %7 = fmul <4 x float> %6, %6
28 tail call void @llvm.masked.store.v4f32.p0v4f32(<4 x float> %7, <4 x float>* %pDst.addr.01, i32 4, <4 x i1> %5)
29 %add.ptr = getelementptr inbounds float, float* %pSrc.addr.0, i32 4
30 %add.ptr4 = getelementptr inbounds float, float* %pDst.addr.0, i32 4
31 %sub = add nsw i32 %blkCnt.0, -4
32 %8 = call i32 @llvm.loop.decrement.reg.i32(i32 %lsr.iv, i32 1)
33 %9 = icmp ne i32 %8, 0
34 %lsr.iv.next = add nsw i32 %lsr.iv, -1
35 br i1 %9, label %do.body, label %do.end
37 do.end: ; preds = %do.body
41 define hidden arm_aapcs_vfpcc void @it_block_store_count_after_start(float* %pSrc, float* %pDst, i32 %blockSize, i32* %iter.addr) #0 {
43 %mul = shl i32 %blockSize, 1
45 %1 = icmp slt i32 %mul, 4
46 %smin = select i1 %1, i32 %mul, i32 4
47 %2 = sub i32 %0, %smin
49 %4 = add nuw nsw i32 %3, 1
50 %start = call i32 @llvm.start.loop.iterations.i32(i32 %4)
51 store i32 %4, i32* %iter.addr, align 4
54 do.body: ; preds = %do.body, %entry
55 %lsr.iv = phi i32 [ %lsr.iv.next, %do.body ], [ %start, %entry ]
56 %blkCnt.0 = phi i32 [ %mul, %entry ], [ %sub, %do.body ]
57 %pDst.addr.0 = phi float* [ %pDst, %entry ], [ %add.ptr4, %do.body ]
58 %pSrc.addr.0 = phi float* [ %pSrc, %entry ], [ %add.ptr, %do.body ]
59 %pDst.addr.01 = bitcast float* %pDst.addr.0 to <4 x float>*
60 %pSrc.addr.02 = bitcast float* %pSrc.addr.0 to <4 x float>*
61 %5 = tail call <4 x i1> @llvm.arm.mve.vctp32(i32 %blkCnt.0)
62 %6 = tail call <4 x float> @llvm.masked.load.v4f32.p0v4f32(<4 x float>* %pSrc.addr.02, i32 4, <4 x i1> %5, <4 x float> undef)
63 %7 = fmul <4 x float> %6, %6
64 tail call void @llvm.masked.store.v4f32.p0v4f32(<4 x float> %7, <4 x float>* %pDst.addr.01, i32 4, <4 x i1> %5)
65 %add.ptr = getelementptr inbounds float, float* %pSrc.addr.0, i32 4
66 %add.ptr4 = getelementptr inbounds float, float* %pDst.addr.0, i32 4
67 %sub = add nsw i32 %blkCnt.0, -4
68 %8 = call i32 @llvm.loop.decrement.reg.i32(i32 %lsr.iv, i32 1)
69 %9 = icmp ne i32 %8, 0
70 %lsr.iv.next = add nsw i32 %lsr.iv, -1
71 br i1 %9, label %do.body, label %do.end
73 do.end: ; preds = %do.body
77 ; Function Attrs: nounwind readnone
78 declare <4 x i1> @llvm.arm.mve.vctp32(i32) #1
80 ; Function Attrs: argmemonly nounwind readonly willreturn
81 declare <4 x float> @llvm.masked.load.v4f32.p0v4f32(<4 x float>*, i32 immarg, <4 x i1>, <4 x float>) #2
83 ; Function Attrs: argmemonly nounwind willreturn writeonly
84 declare void @llvm.masked.store.v4f32.p0v4f32(<4 x float>, <4 x float>*, i32 immarg, <4 x i1>) #3
86 ; Function Attrs: noduplicate nounwind
87 declare i32 @llvm.start.loop.iterations.i32(i32) #4
89 ; Function Attrs: noduplicate nounwind
90 declare i32 @llvm.loop.decrement.reg.i32(i32, i32) #4
92 attributes #0 = { "target-features"="+mve.fp" }
93 attributes #1 = { nounwind readnone "target-features"="+mve.fp" }
94 attributes #2 = { argmemonly nounwind readonly willreturn "target-features"="+mve.fp" }
95 attributes #3 = { argmemonly nounwind willreturn writeonly "target-features"="+mve.fp" }
96 attributes #4 = { noduplicate nounwind "target-features"="+mve.fp" }
100 name: it_block_store_count_before_start
102 tracksRegLiveness: true
105 - { reg: '$r0', virtual-reg: '' }
106 - { reg: '$r1', virtual-reg: '' }
107 - { reg: '$r2', virtual-reg: '' }
108 - { reg: '$r3', virtual-reg: '' }
118 - { id: 0, name: '', type: spill-slot, offset: -4, size: 4, alignment: 4,
119 stack-id: default, callee-saved-register: '$lr', callee-saved-restored: false,
120 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
121 - { id: 1, name: '', type: spill-slot, offset: -8, size: 4, alignment: 4,
122 stack-id: default, callee-saved-register: '$r7', callee-saved-restored: true,
123 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
126 machineFunctionInfo: {}
128 ; CHECK-LABEL: name: it_block_store_count_before_start
130 ; CHECK: successors: %bb.1(0x80000000)
131 ; CHECK: liveins: $lr, $r0, $r1, $r2, $r3, $r7
132 ; CHECK: frame-setup tPUSH 14 /* CC::al */, $noreg, killed $r7, killed $lr, implicit-def $sp, implicit $sp
133 ; CHECK: frame-setup CFI_INSTRUCTION def_cfa_offset 8
134 ; CHECK: frame-setup CFI_INSTRUCTION offset $lr, -4
135 ; CHECK: frame-setup CFI_INSTRUCTION offset $r7, -8
136 ; CHECK: renamable $lr = t2MOVi 4, 14 /* CC::al */, $noreg, $noreg
137 ; CHECK: renamable $r12 = t2LSLri renamable $r2, 1, 14 /* CC::al */, $noreg, $noreg
138 ; CHECK: t2CMPri renamable $r12, 4, 14 /* CC::al */, $noreg, implicit-def $cpsr
139 ; CHECK: t2IT 11, 8, implicit-def $itstate
140 ; CHECK: $lr = t2LSLri renamable $r2, 1, 11 /* CC::lt */, killed $cpsr, $noreg, implicit killed renamable $lr, implicit killed $itstate
141 ; CHECK: renamable $r2 = t2RSBrs killed renamable $lr, killed renamable $r2, 10, 14 /* CC::al */, $noreg, $noreg
142 ; CHECK: renamable $lr = t2ADDri killed renamable $r2, 3, 14 /* CC::al */, $noreg, $noreg
143 ; CHECK: renamable $r2, dead $cpsr = tMOVi8 1, 14 /* CC::al */, $noreg
144 ; CHECK: renamable $lr = nuw nsw t2ADDrs killed renamable $r2, killed renamable $lr, 19, 14 /* CC::al */, $noreg, $noreg
145 ; CHECK: t2STRi12 killed renamable $lr, killed renamable $r3, 0, 14 /* CC::al */, $noreg :: (store (s32) into %ir.iter.addr)
146 ; CHECK: $lr = MVE_DLSTP_32 killed renamable $r12
147 ; CHECK: $r2 = tMOVr killed $lr, 14 /* CC::al */, $noreg
148 ; CHECK: bb.1.do.body:
149 ; CHECK: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
150 ; CHECK: liveins: $r0, $r1, $r2
151 ; CHECK: $lr = tMOVr $r2, 14 /* CC::al */, $noreg
152 ; CHECK: renamable $r2, dead $cpsr = nsw tSUBi8 killed $r2, 1, 14 /* CC::al */, $noreg
153 ; CHECK: renamable $r0, renamable $q0 = MVE_VLDRWU32_post killed renamable $r0, 16, 0, $noreg :: (load (s128) from %ir.pSrc.addr.02, align 4)
154 ; CHECK: renamable $q0 = MVE_VMULf32 killed renamable $q0, killed renamable $q0, 0, $noreg, undef renamable $q0
155 ; CHECK: renamable $r1 = MVE_VSTRWU32_post killed renamable $q0, killed renamable $r1, 16, 0, killed $noreg :: (store (s128) into %ir.pDst.addr.01, align 4)
156 ; CHECK: dead $lr = MVE_LETP killed renamable $lr, %bb.1
157 ; CHECK: bb.2.do.end:
158 ; CHECK: frame-destroy tPOP_RET 14 /* CC::al */, $noreg, def $r7, def $pc
160 successors: %bb.1(0x80000000)
161 liveins: $r0, $r1, $r2, $r3, $r7, $lr
163 frame-setup tPUSH 14 /* CC::al */, $noreg, killed $r7, killed $lr, implicit-def $sp, implicit $sp
164 frame-setup CFI_INSTRUCTION def_cfa_offset 8
165 frame-setup CFI_INSTRUCTION offset $lr, -4
166 frame-setup CFI_INSTRUCTION offset $r7, -8
167 renamable $lr = t2MOVi 4, 14 /* CC::al */, $noreg, $noreg
168 renamable $r12 = t2LSLri renamable $r2, 1, 14 /* CC::al */, $noreg, $noreg
169 t2CMPri renamable $r12, 4, 14 /* CC::al */, $noreg, implicit-def $cpsr
170 t2IT 11, 8, implicit-def $itstate
171 $lr = t2LSLri renamable $r2, 1, 11 /* CC::lt */, killed $cpsr, $noreg, implicit killed renamable $lr, implicit killed $itstate
172 renamable $r2 = t2RSBrs killed renamable $lr, killed renamable $r2, 10, 14 /* CC::al */, $noreg, $noreg
173 renamable $lr = t2ADDri killed renamable $r2, 3, 14 /* CC::al */, $noreg, $noreg
174 renamable $r2, dead $cpsr = tMOVi8 1, 14 /* CC::al */, $noreg
175 renamable $lr = nuw nsw t2ADDrs killed renamable $r2, killed renamable $lr, 19, 14 /* CC::al */, $noreg, $noreg
176 t2STRi12 renamable $lr, killed renamable $r3, 0, 14 /* CC::al */, $noreg :: (store (s32) into %ir.iter.addr)
177 $lr = t2DoLoopStart renamable $lr
178 $r2 = tMOVr killed $lr, 14 /* CC::al */, $noreg
181 successors: %bb.1(0x7c000000), %bb.2(0x04000000)
182 liveins: $r0, $r1, $r2, $r12
184 $lr = tMOVr $r2, 14 /* CC::al */, $noreg
185 renamable $vpr = MVE_VCTP32 renamable $r12, 0, $noreg
186 renamable $r2, dead $cpsr = nsw tSUBi8 killed $r2, 1, 14 /* CC::al */, $noreg
187 renamable $r12 = nsw t2SUBri killed renamable $r12, 4, 14 /* CC::al */, $noreg, $noreg
188 MVE_VPST 8, implicit $vpr
189 renamable $r0, renamable $q0 = MVE_VLDRWU32_post killed renamable $r0, 16, 1, renamable $vpr :: (load (s128) from %ir.pSrc.addr.02, align 4)
190 renamable $lr = t2LoopDec killed renamable $lr, 1
191 renamable $q0 = MVE_VMULf32 killed renamable $q0, renamable $q0, 0, $noreg, undef renamable $q0
192 MVE_VPST 8, implicit $vpr
193 renamable $r1 = MVE_VSTRWU32_post killed renamable $q0, killed renamable $r1, 16, 1, killed renamable $vpr :: (store (s128) into %ir.pDst.addr.01, align 4)
194 t2LoopEnd killed renamable $lr, %bb.1, implicit-def dead $cpsr
195 tB %bb.2, 14 /* CC::al */, $noreg
198 frame-destroy tPOP_RET 14 /* CC::al */, $noreg, def $r7, def $pc
202 name: it_block_store_count_after_start
204 tracksRegLiveness: true
207 - { reg: '$r0', virtual-reg: '' }
208 - { reg: '$r1', virtual-reg: '' }
209 - { reg: '$r2', virtual-reg: '' }
210 - { reg: '$r3', virtual-reg: '' }
219 - { id: 0, name: '', type: spill-slot, offset: -4, size: 4, alignment: 4,
220 stack-id: default, callee-saved-register: '$lr', callee-saved-restored: false,
221 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
222 - { id: 1, name: '', type: spill-slot, offset: -8, size: 4, alignment: 4,
223 stack-id: default, callee-saved-register: '$r7', callee-saved-restored: true,
224 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
227 machineFunctionInfo: {}
229 ; CHECK-LABEL: name: it_block_store_count_after_start
231 ; CHECK: successors: %bb.1(0x80000000)
232 ; CHECK: liveins: $lr, $r0, $r1, $r2, $r3, $r7
233 ; CHECK: frame-setup tPUSH 14 /* CC::al */, $noreg, killed $r7, killed $lr, implicit-def $sp, implicit $sp
234 ; CHECK: frame-setup CFI_INSTRUCTION def_cfa_offset 8
235 ; CHECK: frame-setup CFI_INSTRUCTION offset $lr, -4
236 ; CHECK: frame-setup CFI_INSTRUCTION offset $r7, -8
237 ; CHECK: renamable $lr = t2MOVi 4, 14 /* CC::al */, $noreg, $noreg
238 ; CHECK: renamable $r12 = t2LSLri renamable $r2, 1, 14 /* CC::al */, $noreg, $noreg
239 ; CHECK: t2CMPri renamable $r12, 4, 14 /* CC::al */, $noreg, implicit-def $cpsr
240 ; CHECK: t2IT 11, 8, implicit-def $itstate
241 ; CHECK: $lr = t2LSLri renamable $r2, 1, 11 /* CC::lt */, killed $cpsr, $noreg, implicit killed renamable $lr, implicit killed $itstate
242 ; CHECK: renamable $r2 = t2RSBrs killed renamable $lr, killed renamable $r2, 10, 14 /* CC::al */, $noreg, $noreg
243 ; CHECK: renamable $lr = t2ADDri killed renamable $r2, 3, 14 /* CC::al */, $noreg, $noreg
244 ; CHECK: renamable $r2, dead $cpsr = tMOVi8 1, 14 /* CC::al */, $noreg
245 ; CHECK: renamable $lr = nuw nsw t2ADDrs killed renamable $r2, killed renamable $lr, 19, 14 /* CC::al */, $noreg, $noreg
246 ; CHECK: t2STRi12 killed renamable $lr, killed renamable $r3, 0, 14 /* CC::al */, $noreg :: (store (s32) into %ir.iter.addr)
247 ; CHECK: $lr = MVE_DLSTP_32 killed renamable $r12
248 ; CHECK: $r2 = tMOVr killed $lr, 14 /* CC::al */, $noreg
249 ; CHECK: bb.1.do.body:
250 ; CHECK: successors: %bb.1(0x7c000000), %bb.2(0x04000000)
251 ; CHECK: liveins: $r0, $r1, $r2
252 ; CHECK: $lr = tMOVr $r2, 14 /* CC::al */, $noreg
253 ; CHECK: renamable $r2, dead $cpsr = nsw tSUBi8 killed $r2, 1, 14 /* CC::al */, $noreg
254 ; CHECK: renamable $r0, renamable $q0 = MVE_VLDRWU32_post killed renamable $r0, 16, 0, $noreg :: (load (s128) from %ir.pSrc.addr.02, align 4)
255 ; CHECK: renamable $q0 = MVE_VMULf32 killed renamable $q0, killed renamable $q0, 0, $noreg, undef renamable $q0
256 ; CHECK: renamable $r1 = MVE_VSTRWU32_post killed renamable $q0, killed renamable $r1, 16, 0, killed $noreg :: (store (s128) into %ir.pDst.addr.01, align 4)
257 ; CHECK: dead $lr = MVE_LETP killed renamable $lr, %bb.1
258 ; CHECK: bb.2.do.end:
259 ; CHECK: frame-destroy tPOP_RET 14 /* CC::al */, $noreg, def $r7, def $pc
261 successors: %bb.1(0x80000000)
262 liveins: $r0, $r1, $r2, $r3, $r7, $lr
264 frame-setup tPUSH 14 /* CC::al */, $noreg, killed $r7, killed $lr, implicit-def $sp, implicit $sp
265 frame-setup CFI_INSTRUCTION def_cfa_offset 8
266 frame-setup CFI_INSTRUCTION offset $lr, -4
267 frame-setup CFI_INSTRUCTION offset $r7, -8
268 renamable $lr = t2MOVi 4, 14 /* CC::al */, $noreg, $noreg
269 renamable $r12 = t2LSLri renamable $r2, 1, 14 /* CC::al */, $noreg, $noreg
270 t2CMPri renamable $r12, 4, 14 /* CC::al */, $noreg, implicit-def $cpsr
271 t2IT 11, 8, implicit-def $itstate
272 $lr = t2LSLri renamable $r2, 1, 11 /* CC::lt */, killed $cpsr, $noreg, implicit killed renamable $lr, implicit killed $itstate
273 renamable $r2 = t2RSBrs killed renamable $lr, killed renamable $r2, 10, 14 /* CC::al */, $noreg, $noreg
274 renamable $lr = t2ADDri killed renamable $r2, 3, 14 /* CC::al */, $noreg, $noreg
275 renamable $r2, dead $cpsr = tMOVi8 1, 14 /* CC::al */, $noreg
276 renamable $lr = nuw nsw t2ADDrs killed renamable $r2, killed renamable $lr, 19, 14 /* CC::al */, $noreg, $noreg
277 t2STRi12 renamable $lr, killed renamable $r3, 0, 14 /* CC::al */, $noreg :: (store (s32) into %ir.iter.addr)
278 $lr = t2DoLoopStart renamable $lr
279 $r2 = tMOVr killed $lr, 14 /* CC::al */, $noreg
282 successors: %bb.1(0x7c000000), %bb.2(0x04000000)
283 liveins: $r0, $r1, $r2, $r12
285 $lr = tMOVr $r2, 14 /* CC::al */, $noreg
286 renamable $vpr = MVE_VCTP32 renamable $r12, 0, $noreg
287 renamable $r2, dead $cpsr = nsw tSUBi8 killed $r2, 1, 14 /* CC::al */, $noreg
288 renamable $r12 = nsw t2SUBri killed renamable $r12, 4, 14 /* CC::al */, $noreg, $noreg
289 MVE_VPST 8, implicit $vpr
290 renamable $r0, renamable $q0 = MVE_VLDRWU32_post killed renamable $r0, 16, 1, renamable $vpr :: (load (s128) from %ir.pSrc.addr.02, align 4)
291 renamable $lr = t2LoopDec killed renamable $lr, 1
292 renamable $q0 = MVE_VMULf32 killed renamable $q0, renamable $q0, 0, $noreg, undef renamable $q0
293 MVE_VPST 8, implicit $vpr
294 renamable $r1 = MVE_VSTRWU32_post killed renamable $q0, killed renamable $r1, 16, 1, killed renamable $vpr :: (store (s128) into %ir.pDst.addr.01, align 4)
295 t2LoopEnd killed renamable $lr, %bb.1, implicit-def dead $cpsr
296 tB %bb.2, 14 /* CC::al */, $noreg
299 frame-destroy tPOP_RET 14 /* CC::al */, $noreg, def $r7, def $pc