blob: befada61caf8341e8e09c1c0f92c7970cbab7cfa [file] [log] [blame]
David Green9cf920e2020-03-20 08:25:19 +00001; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=thumbv8.1m.main-arm-none-eabi -mattr=+mve.fp -verify-machineinstrs %s -o - | FileCheck %s
3
4define arm_aapcs_vfpcc void @test_fadd(float* noalias nocapture readonly %A, float %B, float* noalias nocapture %C, i32 %n) {
5; CHECK-LABEL: test_fadd:
6; CHECK: @ %bb.0: @ %entry
7; CHECK-NEXT: cmp r2, #1
8; CHECK-NEXT: it lt
9; CHECK-NEXT: bxlt lr
10; CHECK-NEXT: vmov r3, s0
11; CHECK-NEXT: vdup.32 q0, r3
12; CHECK-NEXT: .LBB0_1: @ %vector.body
13; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
14; CHECK-NEXT: vldrw.u32 q1, [r0], #16
15; CHECK-NEXT: subs r2, #4
16; CHECK-NEXT: vadd.f32 q1, q1, q0
17; CHECK-NEXT: vstrb.8 q1, [r1], #16
18; CHECK-NEXT: bne .LBB0_1
19; CHECK-NEXT: @ %bb.2: @ %for.cond.cleanup
20; CHECK-NEXT: bx lr
21entry:
22 %0 = and i32 %n, 7
23 %cmp = icmp eq i32 %0, 0
24 tail call void @llvm.assume(i1 %cmp)
25 %cmp18 = icmp sgt i32 %n, 0
26 br i1 %cmp18, label %vector.ph, label %for.cond.cleanup
27
28vector.ph: ; preds = %entry
29 %broadcast.splatinsert10 = insertelement <4 x float> undef, float %B, i32 0
30 %broadcast.splat11 = shufflevector <4 x float> %broadcast.splatinsert10, <4 x float> undef, <4 x i32> zeroinitializer
31 br label %vector.body
32
33vector.body: ; preds = %vector.body, %vector.ph
34 %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
35 %1 = getelementptr inbounds float, float* %A, i32 %index
36 %2 = bitcast float* %1 to <4 x float>*
37 %wide.load = load <4 x float>, <4 x float>* %2, align 4
38 %3 = fadd fast <4 x float> %wide.load, %broadcast.splat11
39 %4 = getelementptr inbounds float, float* %C, i32 %index
40 %5 = bitcast float* %4 to <4 x float>*
41 store <4 x float> %3, <4 x float>* %5, align 4
42 %index.next = add i32 %index, 4
43 %6 = icmp eq i32 %index.next, %n
44 br i1 %6, label %for.cond.cleanup, label %vector.body
45
46for.cond.cleanup: ; preds = %vector.body, %entry
47 ret void
48}
49
50define arm_aapcs_vfpcc void @test_fadd_r(float* noalias nocapture readonly %A, float %B, float* noalias nocapture %C, i32 %n) {
51; CHECK-LABEL: test_fadd_r:
52; CHECK: @ %bb.0: @ %entry
53; CHECK-NEXT: cmp r2, #1
54; CHECK-NEXT: it lt
55; CHECK-NEXT: bxlt lr
56; CHECK-NEXT: vmov r3, s0
57; CHECK-NEXT: vdup.32 q0, r3
58; CHECK-NEXT: .LBB1_1: @ %vector.body
59; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
60; CHECK-NEXT: vldrw.u32 q1, [r0], #16
61; CHECK-NEXT: subs r2, #4
62; CHECK-NEXT: vadd.f32 q1, q0, q1
63; CHECK-NEXT: vstrb.8 q1, [r1], #16
64; CHECK-NEXT: bne .LBB1_1
65; CHECK-NEXT: @ %bb.2: @ %for.cond.cleanup
66; CHECK-NEXT: bx lr
67entry:
68 %0 = and i32 %n, 7
69 %cmp = icmp eq i32 %0, 0
70 tail call void @llvm.assume(i1 %cmp)
71 %cmp18 = icmp sgt i32 %n, 0
72 br i1 %cmp18, label %vector.ph, label %for.cond.cleanup
73
74vector.ph: ; preds = %entry
75 %broadcast.splatinsert10 = insertelement <4 x float> undef, float %B, i32 0
76 %broadcast.splat11 = shufflevector <4 x float> %broadcast.splatinsert10, <4 x float> undef, <4 x i32> zeroinitializer
77 br label %vector.body
78
79vector.body: ; preds = %vector.body, %vector.ph
80 %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
81 %1 = getelementptr inbounds float, float* %A, i32 %index
82 %2 = bitcast float* %1 to <4 x float>*
83 %wide.load = load <4 x float>, <4 x float>* %2, align 4
84 %3 = fadd fast <4 x float> %broadcast.splat11, %wide.load
85 %4 = getelementptr inbounds float, float* %C, i32 %index
86 %5 = bitcast float* %4 to <4 x float>*
87 store <4 x float> %3, <4 x float>* %5, align 4
88 %index.next = add i32 %index, 4
89 %6 = icmp eq i32 %index.next, %n
90 br i1 %6, label %for.cond.cleanup, label %vector.body
91
92for.cond.cleanup: ; preds = %vector.body, %entry
93 ret void
94}
95
96define arm_aapcs_vfpcc void @test_fmul(float* noalias nocapture readonly %A, float %B, float* noalias nocapture %C, i32 %n) {
97; CHECK-LABEL: test_fmul:
98; CHECK: @ %bb.0: @ %entry
99; CHECK-NEXT: cmp r2, #1
100; CHECK-NEXT: it lt
101; CHECK-NEXT: bxlt lr
102; CHECK-NEXT: vmov r3, s0
103; CHECK-NEXT: vdup.32 q0, r3
104; CHECK-NEXT: .LBB2_1: @ %vector.body
105; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
106; CHECK-NEXT: vldrw.u32 q1, [r0], #16
107; CHECK-NEXT: subs r2, #4
108; CHECK-NEXT: vmul.f32 q1, q1, q0
109; CHECK-NEXT: vstrb.8 q1, [r1], #16
110; CHECK-NEXT: bne .LBB2_1
111; CHECK-NEXT: @ %bb.2: @ %for.cond.cleanup
112; CHECK-NEXT: bx lr
113entry:
114 %0 = and i32 %n, 7
115 %cmp = icmp eq i32 %0, 0
116 tail call void @llvm.assume(i1 %cmp)
117 %cmp18 = icmp sgt i32 %n, 0
118 br i1 %cmp18, label %vector.ph, label %for.cond.cleanup
119
120vector.ph: ; preds = %entry
121 %broadcast.splatinsert10 = insertelement <4 x float> undef, float %B, i32 0
122 %broadcast.splat11 = shufflevector <4 x float> %broadcast.splatinsert10, <4 x float> undef, <4 x i32> zeroinitializer
123 br label %vector.body
124
125vector.body: ; preds = %vector.body, %vector.ph
126 %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
127 %1 = getelementptr inbounds float, float* %A, i32 %index
128 %2 = bitcast float* %1 to <4 x float>*
129 %wide.load = load <4 x float>, <4 x float>* %2, align 4
130 %3 = fmul fast <4 x float> %wide.load, %broadcast.splat11
131 %4 = getelementptr inbounds float, float* %C, i32 %index
132 %5 = bitcast float* %4 to <4 x float>*
133 store <4 x float> %3, <4 x float>* %5, align 4
134 %index.next = add i32 %index, 4
135 %6 = icmp eq i32 %index.next, %n
136 br i1 %6, label %for.cond.cleanup, label %vector.body
137
138for.cond.cleanup: ; preds = %vector.body, %entry
139 ret void
140}
141
142define arm_aapcs_vfpcc void @test_fmul_r(float* noalias nocapture readonly %A, float %B, float* noalias nocapture %C, i32 %n) {
143; CHECK-LABEL: test_fmul_r:
144; CHECK: @ %bb.0: @ %entry
145; CHECK-NEXT: cmp r2, #1
146; CHECK-NEXT: it lt
147; CHECK-NEXT: bxlt lr
148; CHECK-NEXT: vmov r3, s0
149; CHECK-NEXT: vdup.32 q0, r3
150; CHECK-NEXT: .LBB3_1: @ %vector.body
151; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
152; CHECK-NEXT: vldrw.u32 q1, [r0], #16
153; CHECK-NEXT: subs r2, #4
154; CHECK-NEXT: vmul.f32 q1, q0, q1
155; CHECK-NEXT: vstrb.8 q1, [r1], #16
156; CHECK-NEXT: bne .LBB3_1
157; CHECK-NEXT: @ %bb.2: @ %for.cond.cleanup
158; CHECK-NEXT: bx lr
159entry:
160 %0 = and i32 %n, 7
161 %cmp = icmp eq i32 %0, 0
162 tail call void @llvm.assume(i1 %cmp)
163 %cmp18 = icmp sgt i32 %n, 0
164 br i1 %cmp18, label %vector.ph, label %for.cond.cleanup
165
166vector.ph: ; preds = %entry
167 %broadcast.splatinsert10 = insertelement <4 x float> undef, float %B, i32 0
168 %broadcast.splat11 = shufflevector <4 x float> %broadcast.splatinsert10, <4 x float> undef, <4 x i32> zeroinitializer
169 br label %vector.body
170
171vector.body: ; preds = %vector.body, %vector.ph
172 %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
173 %1 = getelementptr inbounds float, float* %A, i32 %index
174 %2 = bitcast float* %1 to <4 x float>*
175 %wide.load = load <4 x float>, <4 x float>* %2, align 4
176 %3 = fmul fast <4 x float> %broadcast.splat11, %wide.load
177 %4 = getelementptr inbounds float, float* %C, i32 %index
178 %5 = bitcast float* %4 to <4 x float>*
179 store <4 x float> %3, <4 x float>* %5, align 4
180 %index.next = add i32 %index, 4
181 %6 = icmp eq i32 %index.next, %n
182 br i1 %6, label %for.cond.cleanup, label %vector.body
183
184for.cond.cleanup: ; preds = %vector.body, %entry
185 ret void
186}
187
188define arm_aapcs_vfpcc void @test_fsub(float* noalias nocapture readonly %A, float %B, float* noalias nocapture %C, i32 %n) {
189; CHECK-LABEL: test_fsub:
190; CHECK: @ %bb.0: @ %entry
191; CHECK-NEXT: cmp r2, #1
192; CHECK-NEXT: it lt
193; CHECK-NEXT: bxlt lr
194; CHECK-NEXT: vmov r3, s0
195; CHECK-NEXT: vdup.32 q0, r3
196; CHECK-NEXT: .LBB4_1: @ %vector.body
197; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
198; CHECK-NEXT: vldrw.u32 q1, [r0], #16
199; CHECK-NEXT: subs r2, #4
200; CHECK-NEXT: vsub.f32 q1, q1, q0
201; CHECK-NEXT: vstrb.8 q1, [r1], #16
202; CHECK-NEXT: bne .LBB4_1
203; CHECK-NEXT: @ %bb.2: @ %for.cond.cleanup
204; CHECK-NEXT: bx lr
205entry:
206 %0 = and i32 %n, 7
207 %cmp = icmp eq i32 %0, 0
208 tail call void @llvm.assume(i1 %cmp)
209 %cmp18 = icmp sgt i32 %n, 0
210 br i1 %cmp18, label %vector.ph, label %for.cond.cleanup
211
212vector.ph: ; preds = %entry
213 %broadcast.splatinsert10 = insertelement <4 x float> undef, float %B, i32 0
214 %broadcast.splat11 = shufflevector <4 x float> %broadcast.splatinsert10, <4 x float> undef, <4 x i32> zeroinitializer
215 br label %vector.body
216
217vector.body: ; preds = %vector.body, %vector.ph
218 %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
219 %1 = getelementptr inbounds float, float* %A, i32 %index
220 %2 = bitcast float* %1 to <4 x float>*
221 %wide.load = load <4 x float>, <4 x float>* %2, align 4
222 %3 = fsub fast <4 x float> %wide.load, %broadcast.splat11
223 %4 = getelementptr inbounds float, float* %C, i32 %index
224 %5 = bitcast float* %4 to <4 x float>*
225 store <4 x float> %3, <4 x float>* %5, align 4
226 %index.next = add i32 %index, 4
227 %6 = icmp eq i32 %index.next, %n
228 br i1 %6, label %for.cond.cleanup, label %vector.body
229
230for.cond.cleanup: ; preds = %vector.body, %entry
231 ret void
232}
233
234define arm_aapcs_vfpcc void @test_fsub_r(float* noalias nocapture readonly %A, float %B, float* noalias nocapture %C, i32 %n) {
235; CHECK-LABEL: test_fsub_r:
236; CHECK: @ %bb.0: @ %entry
237; CHECK-NEXT: cmp r2, #1
238; CHECK-NEXT: it lt
239; CHECK-NEXT: bxlt lr
240; CHECK-NEXT: vmov r3, s0
241; CHECK-NEXT: vdup.32 q0, r3
242; CHECK-NEXT: .LBB5_1: @ %vector.body
243; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
244; CHECK-NEXT: vldrw.u32 q1, [r0], #16
245; CHECK-NEXT: subs r2, #4
246; CHECK-NEXT: vsub.f32 q1, q0, q1
247; CHECK-NEXT: vstrb.8 q1, [r1], #16
248; CHECK-NEXT: bne .LBB5_1
249; CHECK-NEXT: @ %bb.2: @ %for.cond.cleanup
250; CHECK-NEXT: bx lr
251entry:
252 %0 = and i32 %n, 7
253 %cmp = icmp eq i32 %0, 0
254 tail call void @llvm.assume(i1 %cmp)
255 %cmp18 = icmp sgt i32 %n, 0
256 br i1 %cmp18, label %vector.ph, label %for.cond.cleanup
257
258vector.ph: ; preds = %entry
259 %broadcast.splatinsert10 = insertelement <4 x float> undef, float %B, i32 0
260 %broadcast.splat11 = shufflevector <4 x float> %broadcast.splatinsert10, <4 x float> undef, <4 x i32> zeroinitializer
261 br label %vector.body
262
263vector.body: ; preds = %vector.body, %vector.ph
264 %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
265 %1 = getelementptr inbounds float, float* %A, i32 %index
266 %2 = bitcast float* %1 to <4 x float>*
267 %wide.load = load <4 x float>, <4 x float>* %2, align 4
268 %3 = fsub fast <4 x float> %broadcast.splat11, %wide.load
269 %4 = getelementptr inbounds float, float* %C, i32 %index
270 %5 = bitcast float* %4 to <4 x float>*
271 store <4 x float> %3, <4 x float>* %5, align 4
272 %index.next = add i32 %index, 4
273 %6 = icmp eq i32 %index.next, %n
274 br i1 %6, label %for.cond.cleanup, label %vector.body
275
276for.cond.cleanup: ; preds = %vector.body, %entry
277 ret void
278}
279
280
281define arm_aapcs_vfpcc void @test_fmas(float* noalias nocapture readonly %A, float* noalias nocapture readonly %B, float %C, float* noalias nocapture %D, i32 %n) {
282; CHECK-LABEL: test_fmas:
283; CHECK: @ %bb.0: @ %entry
284; CHECK-NEXT: cmp r3, #1
285; CHECK-NEXT: it lt
286; CHECK-NEXT: bxlt lr
287; CHECK-NEXT: vmov r12, s0
288; CHECK-NEXT: vdup.32 q0, r12
289; CHECK-NEXT: .LBB6_1: @ %vector.body
290; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
291; CHECK-NEXT: vldrw.u32 q1, [r0], #16
292; CHECK-NEXT: vldrw.u32 q2, [r1], #16
293; CHECK-NEXT: vmov q3, q0
294; CHECK-NEXT: subs r3, #4
295; CHECK-NEXT: vfma.f32 q3, q2, q1
296; CHECK-NEXT: vstrb.8 q3, [r2], #16
297; CHECK-NEXT: bne .LBB6_1
298; CHECK-NEXT: @ %bb.2: @ %for.cond.cleanup
299; CHECK-NEXT: bx lr
300entry:
301 %0 = and i32 %n, 7
302 %cmp = icmp eq i32 %0, 0
303 tail call void @llvm.assume(i1 %cmp)
304 %cmp110 = icmp sgt i32 %n, 0
305 br i1 %cmp110, label %vector.ph, label %for.cond.cleanup
306
307vector.ph: ; preds = %entry
308 %broadcast.splatinsert13 = insertelement <4 x float> undef, float %C, i32 0
309 %broadcast.splat14 = shufflevector <4 x float> %broadcast.splatinsert13, <4 x float> undef, <4 x i32> zeroinitializer
310 br label %vector.body
311
312vector.body: ; preds = %vector.body, %vector.ph
313 %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
314 %1 = getelementptr inbounds float, float* %A, i32 %index
315 %2 = bitcast float* %1 to <4 x float>*
316 %wide.load = load <4 x float>, <4 x float>* %2, align 4
317 %3 = getelementptr inbounds float, float* %B, i32 %index
318 %4 = bitcast float* %3 to <4 x float>*
319 %wide.load12 = load <4 x float>, <4 x float>* %4, align 4
320 %5 = fmul fast <4 x float> %wide.load12, %wide.load
321 %6 = fadd fast <4 x float> %5, %broadcast.splat14
322 %7 = getelementptr inbounds float, float* %D, i32 %index
323 %8 = bitcast float* %7 to <4 x float>*
324 store <4 x float> %6, <4 x float>* %8, align 4
325 %index.next = add i32 %index, 4
326 %9 = icmp eq i32 %index.next, %n
327 br i1 %9, label %for.cond.cleanup, label %vector.body
328
329for.cond.cleanup: ; preds = %vector.body, %entry
330 ret void
331}
332
333define arm_aapcs_vfpcc void @test_fmas_r(float* noalias nocapture readonly %A, float* noalias nocapture readonly %B, float %C, float* noalias nocapture %D, i32 %n) {
334; CHECK-LABEL: test_fmas_r:
335; CHECK: @ %bb.0: @ %entry
336; CHECK-NEXT: cmp r3, #1
337; CHECK-NEXT: it lt
338; CHECK-NEXT: bxlt lr
339; CHECK-NEXT: vmov r12, s0
340; CHECK-NEXT: vdup.32 q0, r12
341; CHECK-NEXT: .LBB7_1: @ %vector.body
342; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
343; CHECK-NEXT: vldrw.u32 q1, [r0], #16
344; CHECK-NEXT: vldrw.u32 q2, [r1], #16
345; CHECK-NEXT: vmov q3, q0
346; CHECK-NEXT: subs r3, #4
347; CHECK-NEXT: vfma.f32 q3, q2, q1
348; CHECK-NEXT: vstrb.8 q3, [r2], #16
349; CHECK-NEXT: bne .LBB7_1
350; CHECK-NEXT: @ %bb.2: @ %for.cond.cleanup
351; CHECK-NEXT: bx lr
352entry:
353 %0 = and i32 %n, 7
354 %cmp = icmp eq i32 %0, 0
355 tail call void @llvm.assume(i1 %cmp)
356 %cmp110 = icmp sgt i32 %n, 0
357 br i1 %cmp110, label %vector.ph, label %for.cond.cleanup
358
359vector.ph: ; preds = %entry
360 %broadcast.splatinsert13 = insertelement <4 x float> undef, float %C, i32 0
361 %broadcast.splat14 = shufflevector <4 x float> %broadcast.splatinsert13, <4 x float> undef, <4 x i32> zeroinitializer
362 br label %vector.body
363
364vector.body: ; preds = %vector.body, %vector.ph
365 %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
366 %1 = getelementptr inbounds float, float* %A, i32 %index
367 %2 = bitcast float* %1 to <4 x float>*
368 %wide.load = load <4 x float>, <4 x float>* %2, align 4
369 %3 = getelementptr inbounds float, float* %B, i32 %index
370 %4 = bitcast float* %3 to <4 x float>*
371 %wide.load12 = load <4 x float>, <4 x float>* %4, align 4
372 %5 = fmul fast <4 x float> %wide.load12, %wide.load
373 %6 = fadd fast <4 x float> %broadcast.splat14, %5
374 %7 = getelementptr inbounds float, float* %D, i32 %index
375 %8 = bitcast float* %7 to <4 x float>*
376 store <4 x float> %6, <4 x float>* %8, align 4
377 %index.next = add i32 %index, 4
378 %9 = icmp eq i32 %index.next, %n
379 br i1 %9, label %for.cond.cleanup, label %vector.body
380
381for.cond.cleanup: ; preds = %vector.body, %entry
382 ret void
383}
384
385define arm_aapcs_vfpcc void @test_fma(float* noalias nocapture readonly %A, float* noalias nocapture readonly %B, float %C, float* noalias nocapture %D, i32 %n) {
386; CHECK-LABEL: test_fma:
387; CHECK: @ %bb.0: @ %entry
388; CHECK-NEXT: cmp r3, #1
389; CHECK-NEXT: it lt
390; CHECK-NEXT: bxlt lr
391; CHECK-NEXT: vmov r12, s0
392; CHECK-NEXT: vdup.32 q0, r12
393; CHECK-NEXT: .LBB8_1: @ %vector.body
394; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
395; CHECK-NEXT: vldrw.u32 q1, [r0], #16
396; CHECK-NEXT: vldrw.u32 q2, [r1], #16
397; CHECK-NEXT: subs r3, #4
398; CHECK-NEXT: vfma.f32 q2, q1, q0
399; CHECK-NEXT: vstrb.8 q2, [r2], #16
400; CHECK-NEXT: bne .LBB8_1
401; CHECK-NEXT: @ %bb.2: @ %for.cond.cleanup
402; CHECK-NEXT: bx lr
403entry:
404 %0 = and i32 %n, 7
405 %cmp = icmp eq i32 %0, 0
406 tail call void @llvm.assume(i1 %cmp)
407 %cmp110 = icmp sgt i32 %n, 0
408 br i1 %cmp110, label %vector.ph, label %for.cond.cleanup
409
410vector.ph: ; preds = %entry
411 %broadcast.splatinsert12 = insertelement <4 x float> undef, float %C, i32 0
412 %broadcast.splat13 = shufflevector <4 x float> %broadcast.splatinsert12, <4 x float> undef, <4 x i32> zeroinitializer
413 br label %vector.body
414
415vector.body: ; preds = %vector.body, %vector.ph
416 %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
417 %1 = getelementptr inbounds float, float* %A, i32 %index
418 %2 = bitcast float* %1 to <4 x float>*
419 %wide.load = load <4 x float>, <4 x float>* %2, align 4
420 %3 = fmul fast <4 x float> %wide.load, %broadcast.splat13
421 %4 = getelementptr inbounds float, float* %B, i32 %index
422 %5 = bitcast float* %4 to <4 x float>*
423 %wide.load14 = load <4 x float>, <4 x float>* %5, align 4
424 %6 = fadd fast <4 x float> %3, %wide.load14
425 %7 = getelementptr inbounds float, float* %D, i32 %index
426 %8 = bitcast float* %7 to <4 x float>*
427 store <4 x float> %6, <4 x float>* %8, align 4
428 %index.next = add i32 %index, 4
429 %9 = icmp eq i32 %index.next, %n
430 br i1 %9, label %for.cond.cleanup, label %vector.body
431
432for.cond.cleanup: ; preds = %vector.body, %entry
433 ret void
434}
435
436define arm_aapcs_vfpcc void @test_fma_r(float* noalias nocapture readonly %A, float* noalias nocapture readonly %B, float %C, float* noalias nocapture %D, i32 %n) {
437; CHECK-LABEL: test_fma_r:
438; CHECK: @ %bb.0: @ %entry
439; CHECK-NEXT: cmp r3, #1
440; CHECK-NEXT: it lt
441; CHECK-NEXT: bxlt lr
442; CHECK-NEXT: vmov r12, s0
443; CHECK-NEXT: vdup.32 q0, r12
444; CHECK-NEXT: .LBB9_1: @ %vector.body
445; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
446; CHECK-NEXT: vldrw.u32 q1, [r0], #16
447; CHECK-NEXT: vldrw.u32 q2, [r1], #16
448; CHECK-NEXT: subs r3, #4
449; CHECK-NEXT: vfma.f32 q2, q0, q1
450; CHECK-NEXT: vstrb.8 q2, [r2], #16
451; CHECK-NEXT: bne .LBB9_1
452; CHECK-NEXT: @ %bb.2: @ %for.cond.cleanup
453; CHECK-NEXT: bx lr
454entry:
455 %0 = and i32 %n, 7
456 %cmp = icmp eq i32 %0, 0
457 tail call void @llvm.assume(i1 %cmp)
458 %cmp110 = icmp sgt i32 %n, 0
459 br i1 %cmp110, label %vector.ph, label %for.cond.cleanup
460
461vector.ph: ; preds = %entry
462 %broadcast.splatinsert12 = insertelement <4 x float> undef, float %C, i32 0
463 %broadcast.splat13 = shufflevector <4 x float> %broadcast.splatinsert12, <4 x float> undef, <4 x i32> zeroinitializer
464 br label %vector.body
465
466vector.body: ; preds = %vector.body, %vector.ph
467 %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
468 %1 = getelementptr inbounds float, float* %A, i32 %index
469 %2 = bitcast float* %1 to <4 x float>*
470 %wide.load = load <4 x float>, <4 x float>* %2, align 4
471 %3 = fmul fast <4 x float> %broadcast.splat13, %wide.load
472 %4 = getelementptr inbounds float, float* %B, i32 %index
473 %5 = bitcast float* %4 to <4 x float>*
474 %wide.load14 = load <4 x float>, <4 x float>* %5, align 4
475 %6 = fadd fast <4 x float> %3, %wide.load14
476 %7 = getelementptr inbounds float, float* %D, i32 %index
477 %8 = bitcast float* %7 to <4 x float>*
478 store <4 x float> %6, <4 x float>* %8, align 4
479 %index.next = add i32 %index, 4
480 %9 = icmp eq i32 %index.next, %n
481 br i1 %9, label %for.cond.cleanup, label %vector.body
482
483for.cond.cleanup: ; preds = %vector.body, %entry
484 ret void
485}
486
487
488define arm_aapcs_vfpcc void @test_fmss(float* noalias nocapture readonly %A, float* noalias nocapture readonly %B, float %C, float* noalias nocapture %D, i32 %n) {
489; CHECK-LABEL: test_fmss:
490; CHECK: @ %bb.0: @ %entry
491; CHECK-NEXT: cmp r3, #1
492; CHECK-NEXT: it lt
493; CHECK-NEXT: bxlt lr
494; CHECK-NEXT: vmov r12, s0
495; CHECK-NEXT: vdup.32 q0, r12
496; CHECK-NEXT: vneg.f32 q0, q0
497; CHECK-NEXT: .LBB10_1: @ %vector.body
498; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
499; CHECK-NEXT: vldrw.u32 q1, [r0], #16
500; CHECK-NEXT: vldrw.u32 q2, [r1], #16
501; CHECK-NEXT: vmov q3, q0
502; CHECK-NEXT: subs r3, #4
503; CHECK-NEXT: vfma.f32 q3, q2, q1
504; CHECK-NEXT: vstrb.8 q3, [r2], #16
505; CHECK-NEXT: bne .LBB10_1
506; CHECK-NEXT: @ %bb.2: @ %for.cond.cleanup
507; CHECK-NEXT: bx lr
508entry:
509 %0 = and i32 %n, 7
510 %cmp = icmp eq i32 %0, 0
511 tail call void @llvm.assume(i1 %cmp)
512 %cmp110 = icmp sgt i32 %n, 0
513 br i1 %cmp110, label %vector.ph, label %for.cond.cleanup
514
515vector.ph: ; preds = %entry
516 %broadcast.splatinsert13 = insertelement <4 x float> undef, float %C, i32 0
517 %broadcast.splat14 = shufflevector <4 x float> %broadcast.splatinsert13, <4 x float> undef, <4 x i32> zeroinitializer
518 br label %vector.body
519
520vector.body: ; preds = %vector.body, %vector.ph
521 %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
522 %1 = getelementptr inbounds float, float* %A, i32 %index
523 %2 = bitcast float* %1 to <4 x float>*
524 %wide.load = load <4 x float>, <4 x float>* %2, align 4
525 %3 = getelementptr inbounds float, float* %B, i32 %index
526 %4 = bitcast float* %3 to <4 x float>*
527 %wide.load12 = load <4 x float>, <4 x float>* %4, align 4
528 %5 = fmul fast <4 x float> %wide.load12, %wide.load
529 %6 = fsub fast <4 x float> %5, %broadcast.splat14
530 %7 = getelementptr inbounds float, float* %D, i32 %index
531 %8 = bitcast float* %7 to <4 x float>*
532 store <4 x float> %6, <4 x float>* %8, align 4
533 %index.next = add i32 %index, 4
534 %9 = icmp eq i32 %index.next, %n
535 br i1 %9, label %for.cond.cleanup, label %vector.body
536
537for.cond.cleanup: ; preds = %vector.body, %entry
538 ret void
539}
540
541define arm_aapcs_vfpcc void @test_fmss_r(float* noalias nocapture readonly %A, float* noalias nocapture readonly %B, float %C, float* noalias nocapture %D, i32 %n) {
542; CHECK-LABEL: test_fmss_r:
543; CHECK: @ %bb.0: @ %entry
544; CHECK-NEXT: cmp r3, #1
545; CHECK-NEXT: it lt
546; CHECK-NEXT: bxlt lr
547; CHECK-NEXT: vmov r12, s0
548; CHECK-NEXT: vdup.32 q0, r12
549; CHECK-NEXT: .LBB11_1: @ %vector.body
550; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
551; CHECK-NEXT: vldrw.u32 q1, [r0], #16
552; CHECK-NEXT: vldrw.u32 q2, [r1], #16
553; CHECK-NEXT: vmov q3, q0
554; CHECK-NEXT: subs r3, #4
555; CHECK-NEXT: vfms.f32 q3, q2, q1
556; CHECK-NEXT: vstrb.8 q3, [r2], #16
557; CHECK-NEXT: bne .LBB11_1
558; CHECK-NEXT: @ %bb.2: @ %for.cond.cleanup
559; CHECK-NEXT: bx lr
560entry:
561 %0 = and i32 %n, 7
562 %cmp = icmp eq i32 %0, 0
563 tail call void @llvm.assume(i1 %cmp)
564 %cmp110 = icmp sgt i32 %n, 0
565 br i1 %cmp110, label %vector.ph, label %for.cond.cleanup
566
567vector.ph: ; preds = %entry
568 %broadcast.splatinsert13 = insertelement <4 x float> undef, float %C, i32 0
569 %broadcast.splat14 = shufflevector <4 x float> %broadcast.splatinsert13, <4 x float> undef, <4 x i32> zeroinitializer
570 br label %vector.body
571
572vector.body: ; preds = %vector.body, %vector.ph
573 %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
574 %1 = getelementptr inbounds float, float* %A, i32 %index
575 %2 = bitcast float* %1 to <4 x float>*
576 %wide.load = load <4 x float>, <4 x float>* %2, align 4
577 %3 = getelementptr inbounds float, float* %B, i32 %index
578 %4 = bitcast float* %3 to <4 x float>*
579 %wide.load12 = load <4 x float>, <4 x float>* %4, align 4
580 %5 = fmul fast <4 x float> %wide.load12, %wide.load
581 %6 = fsub fast <4 x float> %broadcast.splat14, %5
582 %7 = getelementptr inbounds float, float* %D, i32 %index
583 %8 = bitcast float* %7 to <4 x float>*
584 store <4 x float> %6, <4 x float>* %8, align 4
585 %index.next = add i32 %index, 4
586 %9 = icmp eq i32 %index.next, %n
587 br i1 %9, label %for.cond.cleanup, label %vector.body
588
589for.cond.cleanup: ; preds = %vector.body, %entry
590 ret void
591}
592
593define arm_aapcs_vfpcc void @test_fms(float* noalias nocapture readonly %A, float* noalias nocapture readonly %B, float %C, float* noalias nocapture %D, i32 %n) {
594; CHECK-LABEL: test_fms:
595; CHECK: @ %bb.0: @ %entry
596; CHECK-NEXT: cmp r3, #1
597; CHECK-NEXT: it lt
598; CHECK-NEXT: bxlt lr
599; CHECK-NEXT: vmov r12, s0
600; CHECK-NEXT: vdup.32 q0, r12
601; CHECK-NEXT: .LBB12_1: @ %vector.body
602; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
603; CHECK-NEXT: vldrw.u32 q1, [r1], #16
604; CHECK-NEXT: vldrw.u32 q2, [r0], #16
605; CHECK-NEXT: subs r3, #4
606; CHECK-NEXT: vneg.f32 q1, q1
607; CHECK-NEXT: vfma.f32 q1, q2, q0
608; CHECK-NEXT: vstrb.8 q1, [r2], #16
609; CHECK-NEXT: bne .LBB12_1
610; CHECK-NEXT: @ %bb.2: @ %for.cond.cleanup
611; CHECK-NEXT: bx lr
612entry:
613 %0 = and i32 %n, 7
614 %cmp = icmp eq i32 %0, 0
615 tail call void @llvm.assume(i1 %cmp)
616 %cmp110 = icmp sgt i32 %n, 0
617 br i1 %cmp110, label %vector.ph, label %for.cond.cleanup
618
619vector.ph: ; preds = %entry
620 %broadcast.splatinsert12 = insertelement <4 x float> undef, float %C, i32 0
621 %broadcast.splat13 = shufflevector <4 x float> %broadcast.splatinsert12, <4 x float> undef, <4 x i32> zeroinitializer
622 br label %vector.body
623
624vector.body: ; preds = %vector.body, %vector.ph
625 %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
626 %1 = getelementptr inbounds float, float* %A, i32 %index
627 %2 = bitcast float* %1 to <4 x float>*
628 %wide.load = load <4 x float>, <4 x float>* %2, align 4
629 %3 = fmul fast <4 x float> %wide.load, %broadcast.splat13
630 %4 = getelementptr inbounds float, float* %B, i32 %index
631 %5 = bitcast float* %4 to <4 x float>*
632 %wide.load14 = load <4 x float>, <4 x float>* %5, align 4
633 %6 = fsub fast <4 x float> %3, %wide.load14
634 %7 = getelementptr inbounds float, float* %D, i32 %index
635 %8 = bitcast float* %7 to <4 x float>*
636 store <4 x float> %6, <4 x float>* %8, align 4
637 %index.next = add i32 %index, 4
638 %9 = icmp eq i32 %index.next, %n
639 br i1 %9, label %for.cond.cleanup, label %vector.body
640
641for.cond.cleanup: ; preds = %vector.body, %entry
642 ret void
643}
644
645define arm_aapcs_vfpcc void @test_fms_r(float* noalias nocapture readonly %A, float* noalias nocapture readonly %B, float %C, float* noalias nocapture %D, i32 %n) {
646; CHECK-LABEL: test_fms_r:
647; CHECK: @ %bb.0: @ %entry
648; CHECK-NEXT: cmp r3, #1
649; CHECK-NEXT: it lt
650; CHECK-NEXT: bxlt lr
651; CHECK-NEXT: vmov r12, s0
652; CHECK-NEXT: vdup.32 q0, r12
653; CHECK-NEXT: .LBB13_1: @ %vector.body
654; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
655; CHECK-NEXT: vldrw.u32 q1, [r1], #16
656; CHECK-NEXT: vldrw.u32 q2, [r0], #16
657; CHECK-NEXT: subs r3, #4
658; CHECK-NEXT: vneg.f32 q1, q1
659; CHECK-NEXT: vfma.f32 q1, q0, q2
660; CHECK-NEXT: vstrb.8 q1, [r2], #16
661; CHECK-NEXT: bne .LBB13_1
662; CHECK-NEXT: @ %bb.2: @ %for.cond.cleanup
663; CHECK-NEXT: bx lr
664entry:
665 %0 = and i32 %n, 7
666 %cmp = icmp eq i32 %0, 0
667 tail call void @llvm.assume(i1 %cmp)
668 %cmp110 = icmp sgt i32 %n, 0
669 br i1 %cmp110, label %vector.ph, label %for.cond.cleanup
670
671vector.ph: ; preds = %entry
672 %broadcast.splatinsert12 = insertelement <4 x float> undef, float %C, i32 0
673 %broadcast.splat13 = shufflevector <4 x float> %broadcast.splatinsert12, <4 x float> undef, <4 x i32> zeroinitializer
674 br label %vector.body
675
676vector.body: ; preds = %vector.body, %vector.ph
677 %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
678 %1 = getelementptr inbounds float, float* %A, i32 %index
679 %2 = bitcast float* %1 to <4 x float>*
680 %wide.load = load <4 x float>, <4 x float>* %2, align 4
681 %3 = fmul fast <4 x float> %broadcast.splat13, %wide.load
682 %4 = getelementptr inbounds float, float* %B, i32 %index
683 %5 = bitcast float* %4 to <4 x float>*
684 %wide.load14 = load <4 x float>, <4 x float>* %5, align 4
685 %6 = fsub fast <4 x float> %3, %wide.load14
686 %7 = getelementptr inbounds float, float* %D, i32 %index
687 %8 = bitcast float* %7 to <4 x float>*
688 store <4 x float> %6, <4 x float>* %8, align 4
689 %index.next = add i32 %index, 4
690 %9 = icmp eq i32 %index.next, %n
691 br i1 %9, label %for.cond.cleanup, label %vector.body
692
693for.cond.cleanup: ; preds = %vector.body, %entry
694 ret void
695}
696
697
698define dso_local void @test_nested(float* noalias nocapture %pInT1, float* noalias nocapture readonly %pOutT1, float* noalias nocapture readonly %pPRT_in, float* noalias nocapture readnone %pPRT_pDst, i32 %numRows, i32 %numCols, i32 %l, float %in) local_unnamed_addr #0 {
699; CHECK-LABEL: test_nested:
700; CHECK: @ %bb.0: @ %for.body.us.preheader
701; CHECK-NEXT: .save {r4, r5, r6, r7, lr}
702; CHECK-NEXT: push {r4, r5, r6, r7, lr}
703; CHECK-NEXT: ldrd lr, r12, [sp, #20]
704; CHECK-NEXT: lsl.w r3, r12, #2
705; CHECK-NEXT: dls lr, lr
706; CHECK-NEXT: .LBB14_1: @ %for.body.us
707; CHECK-NEXT: @ =>This Loop Header: Depth=1
708; CHECK-NEXT: @ Child Loop BB14_2 Depth 2
709; CHECK-NEXT: vldr s0, [r1]
710; CHECK-NEXT: mov r5, r12
711; CHECK-NEXT: vmov r4, s0
712; CHECK-NEXT: vdup.32 q0, r4
713; CHECK-NEXT: movs r4, #0
714; CHECK-NEXT: .LBB14_2: @ %vector.body
715; CHECK-NEXT: @ Parent Loop BB14_1 Depth=1
716; CHECK-NEXT: @ => This Inner Loop Header: Depth=2
717; CHECK-NEXT: adds r6, r0, r4
718; CHECK-NEXT: adds r7, r2, r4
719; CHECK-NEXT: vldrw.u32 q1, [r7]
720; CHECK-NEXT: vldrw.u32 q2, [r6]
721; CHECK-NEXT: adds r4, #16
722; CHECK-NEXT: subs r5, #4
723; CHECK-NEXT: vfms.f32 q2, q1, q0
724; CHECK-NEXT: vstrw.32 q2, [r6]
725; CHECK-NEXT: bne .LBB14_2
726; CHECK-NEXT: @ %bb.3: @ %for.cond6.for.end_crit_edge.us
727; CHECK-NEXT: @ in Loop: Header=BB14_1 Depth=1
728; CHECK-NEXT: add r0, r3
729; CHECK-NEXT: add r2, r3
730; CHECK-NEXT: adds r1, #4
731; CHECK-NEXT: le lr, .LBB14_1
732; CHECK-NEXT: @ %bb.4: @ %for.end14
733; CHECK-NEXT: pop {r4, r5, r6, r7, pc}
734for.body.us.preheader:
735 %cmp = icmp sgt i32 %numRows, 0
736 tail call void @llvm.assume(i1 %cmp)
737 %cmp1 = icmp sgt i32 %numCols, 0
738 tail call void @llvm.assume(i1 %cmp1)
739 %rem = and i32 %numCols, 7
740 %cmp2 = icmp eq i32 %rem, 0
741 tail call void @llvm.assume(i1 %cmp2)
742 %cmp3 = icmp slt i32 %l, %numCols
743 tail call void @llvm.assume(i1 %cmp3)
744 br label %for.body.us
745
746for.body.us: ; preds = %for.cond6.for.end_crit_edge.us, %for.body.us.preheader
747 %pInT1.addr.038.us = phi float* [ %scevgep40, %for.cond6.for.end_crit_edge.us ], [ %pInT1, %for.body.us.preheader ]
748 %i.037.us = phi i32 [ %inc13.us, %for.cond6.for.end_crit_edge.us ], [ 0, %for.body.us.preheader ]
749 %pOutT1.addr.036.us = phi float* [ %incdec.ptr.us, %for.cond6.for.end_crit_edge.us ], [ %pOutT1, %for.body.us.preheader ]
750 %pPRT_in.addr.035.us = phi float* [ %scevgep, %for.cond6.for.end_crit_edge.us ], [ %pPRT_in, %for.body.us.preheader ]
751 %scevgep = getelementptr float, float* %pPRT_in.addr.035.us, i32 %numCols
752 %0 = load float, float* %pOutT1.addr.036.us, align 4
753 %broadcast.splatinsert47 = insertelement <4 x float> undef, float %0, i32 0
754 %broadcast.splat48 = shufflevector <4 x float> %broadcast.splatinsert47, <4 x float> undef, <4 x i32> zeroinitializer
755 br label %vector.body
756
757vector.body: ; preds = %vector.body, %for.body.us
758 %index = phi i32 [ 0, %for.body.us ], [ %index.next, %vector.body ]
759 %next.gep = getelementptr float, float* %pInT1.addr.038.us, i32 %index
760 %next.gep45 = getelementptr float, float* %pPRT_in.addr.035.us, i32 %index
761 %1 = bitcast float* %next.gep to <4 x float>*
762 %wide.load = load <4 x float>, <4 x float>* %1, align 4
763 %2 = bitcast float* %next.gep45 to <4 x float>*
764 %wide.load46 = load <4 x float>, <4 x float>* %2, align 4
765 %3 = fmul fast <4 x float> %wide.load46, %broadcast.splat48
766 %4 = fsub fast <4 x float> %wide.load, %3
767 store <4 x float> %4, <4 x float>* %1, align 4
768 %index.next = add i32 %index, 4
769 %5 = icmp eq i32 %index.next, %numCols
770 br i1 %5, label %for.cond6.for.end_crit_edge.us, label %vector.body
771
772for.cond6.for.end_crit_edge.us: ; preds = %vector.body
773 %incdec.ptr.us = getelementptr inbounds float, float* %pOutT1.addr.036.us, i32 1
774 %scevgep40 = getelementptr float, float* %pInT1.addr.038.us, i32 %numCols
775 %inc13.us = add nuw nsw i32 %i.037.us, 1
776 %exitcond41 = icmp eq i32 %inc13.us, %numRows
777 br i1 %exitcond41, label %for.end14, label %for.body.us
778
779for.end14: ; preds = %for.cond6.for.end_crit_edge.us
780 ret void
781}
782
783%struct.arm_fir_instance_f32 = type { i16, float*, float* }
784define void @arm_fir_f32_1_4_mve(%struct.arm_fir_instance_f32* nocapture readonly %S, float* nocapture readonly %pSrc, float* %pDst, i32 %blockSize) {
785; CHECK-LABEL: arm_fir_f32_1_4_mve:
786; CHECK: @ %bb.0: @ %entry
787; CHECK-NEXT: .save {r4, r5, r6, r7, r8, r9, r10, lr}
788; CHECK-NEXT: push.w {r4, r5, r6, r7, r8, r9, r10, lr}
789; CHECK-NEXT: .vsave {d8, d9, d10, d11, d12, d13}
790; CHECK-NEXT: vpush {d8, d9, d10, d11, d12, d13}
791; CHECK-NEXT: ldrh.w r10, [r0]
792; CHECK-NEXT: ldr.w r12, [r0, #4]
793; CHECK-NEXT: sub.w r7, r10, #1
794; CHECK-NEXT: cmp r7, #3
795; CHECK-NEXT: bhi .LBB15_6
796; CHECK-NEXT: @ %bb.1: @ %if.then
797; CHECK-NEXT: ldr r6, [r0, #8]
798; CHECK-NEXT: add.w r4, r12, r7, lsl #2
799; CHECK-NEXT: lsr.w lr, r3, #2
800; CHECK-NEXT: vldr s0, [r6, #12]
801; CHECK-NEXT: vldr s4, [r6, #8]
802; CHECK-NEXT: vmov r7, s0
803; CHECK-NEXT: vldr s8, [r6, #4]
804; CHECK-NEXT: vdup.32 q0, r7
805; CHECK-NEXT: vmov r7, s4
806; CHECK-NEXT: vldr s12, [r6]
807; CHECK-NEXT: vdup.32 q1, r7
808; CHECK-NEXT: vmov r7, s8
809; CHECK-NEXT: vdup.32 q2, r7
810; CHECK-NEXT: vmov r7, s12
811; CHECK-NEXT: vdup.32 q3, r7
812; CHECK-NEXT: wls lr, lr, .LBB15_5
813; CHECK-NEXT: @ %bb.2: @ %while.body.lr.ph
814; CHECK-NEXT: bic r9, r3, #3
815; CHECK-NEXT: movs r6, #0
816; CHECK-NEXT: add.w r8, r2, r9, lsl #2
817; CHECK-NEXT: .LBB15_3: @ %while.body
818; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
819; CHECK-NEXT: adds r5, r1, r6
820; CHECK-NEXT: adds r7, r2, r6
821; CHECK-NEXT: vldrw.u32 q4, [r5]
822; CHECK-NEXT: adds r5, r4, r6
823; CHECK-NEXT: vstrw.32 q4, [r5]
824; CHECK-NEXT: add.w r5, r12, r6
825; CHECK-NEXT: vldrw.u32 q4, [r5]
826; CHECK-NEXT: vldrw.u32 q5, [r5, #4]
827; CHECK-NEXT: vldrw.u32 q6, [r5, #12]
828; CHECK-NEXT: adds r6, #16
829; CHECK-NEXT: vmul.f32 q4, q4, q3
830; CHECK-NEXT: vfma.f32 q4, q5, q2
831; CHECK-NEXT: vldrw.u32 q5, [r5, #8]
832; CHECK-NEXT: vfma.f32 q4, q5, q1
833; CHECK-NEXT: vfma.f32 q4, q6, q0
834; CHECK-NEXT: vstrw.32 q4, [r7]
835; CHECK-NEXT: le lr, .LBB15_3
836; CHECK-NEXT: @ %bb.4: @ %while.end.loopexit
837; CHECK-NEXT: add r4, r6
838; CHECK-NEXT: add.w r12, r12, r9, lsl #2
839; CHECK-NEXT: add.w r1, r1, r9, lsl #2
840; CHECK-NEXT: mov r2, r8
841; CHECK-NEXT: .LBB15_5: @ %while.end
842; CHECK-NEXT: and r7, r3, #3
843; CHECK-NEXT: vldrw.u32 q4, [r1]
844; CHECK-NEXT: vctp.32 r7
845; CHECK-NEXT: vpst
846; CHECK-NEXT: vstrwt.32 q4, [r4]
847; CHECK-NEXT: vldrw.u32 q4, [r12]
848; CHECK-NEXT: vmul.f32 q3, q4, q3
849; CHECK-NEXT: vldrw.u32 q4, [r12, #4]
850; CHECK-NEXT: vfma.f32 q3, q4, q2
851; CHECK-NEXT: vldrw.u32 q2, [r12, #8]
852; CHECK-NEXT: vfma.f32 q3, q2, q1
853; CHECK-NEXT: vldrw.u32 q1, [r12, #12]
854; CHECK-NEXT: vfma.f32 q3, q1, q0
855; CHECK-NEXT: vpst
856; CHECK-NEXT: vstrwt.32 q3, [r2]
857; CHECK-NEXT: ldr.w r12, [r0, #4]
858; CHECK-NEXT: .LBB15_6: @ %if.end
859; CHECK-NEXT: add.w r0, r12, r3, lsl #2
860; CHECK-NEXT: lsr.w lr, r10, #2
861; CHECK-NEXT: wls lr, lr, .LBB15_10
862; CHECK-NEXT: @ %bb.7: @ %while.body51.preheader
863; CHECK-NEXT: bic r2, r10, #3
864; CHECK-NEXT: adds r1, r2, r3
865; CHECK-NEXT: mov r3, r12
866; CHECK-NEXT: add.w r1, r12, r1, lsl #2
867; CHECK-NEXT: .LBB15_8: @ %while.body51
868; CHECK-NEXT: @ =>This Inner Loop Header: Depth=1
869; CHECK-NEXT: vldrw.u32 q0, [r0], #16
870; CHECK-NEXT: vstrb.8 q0, [r3], #16
871; CHECK-NEXT: le lr, .LBB15_8
872; CHECK-NEXT: @ %bb.9: @ %while.end55.loopexit
873; CHECK-NEXT: add.w r12, r12, r2, lsl #2
874; CHECK-NEXT: mov r0, r1
875; CHECK-NEXT: .LBB15_10: @ %while.end55
876; CHECK-NEXT: ands r1, r10, #3
877; CHECK-NEXT: beq .LBB15_12
878; CHECK-NEXT: @ %bb.11: @ %if.then59
879; CHECK-NEXT: vldrw.u32 q0, [r0]
880; CHECK-NEXT: vctp.32 r1
881; CHECK-NEXT: vpst
882; CHECK-NEXT: vstrwt.32 q0, [r12]
883; CHECK-NEXT: .LBB15_12: @ %if.end61
884; CHECK-NEXT: vpop {d8, d9, d10, d11, d12, d13}
885; CHECK-NEXT: pop.w {r4, r5, r6, r7, r8, r9, r10, pc}
886entry:
887 %pState1 = getelementptr inbounds %struct.arm_fir_instance_f32, %struct.arm_fir_instance_f32* %S, i32 0, i32 1
888 %0 = load float*, float** %pState1, align 4
889 %pCoeffs2 = getelementptr inbounds %struct.arm_fir_instance_f32, %struct.arm_fir_instance_f32* %S, i32 0, i32 2
890 %1 = load float*, float** %pCoeffs2, align 4
891 %numTaps3 = getelementptr inbounds %struct.arm_fir_instance_f32, %struct.arm_fir_instance_f32* %S, i32 0, i32 0
892 %2 = load i16, i16* %numTaps3, align 4
893 %conv = zext i16 %2 to i32
894 %sub = add nsw i32 %conv, -1
895 %cmp = icmp ult i32 %sub, 4
896 br i1 %cmp, label %if.then, label %if.end
897
898if.then: ; preds = %entry
899 %arrayidx = getelementptr inbounds float, float* %0, i32 %sub
900 %incdec.ptr = getelementptr inbounds float, float* %1, i32 1
901 %3 = load float, float* %1, align 4
902 %incdec.ptr6 = getelementptr inbounds float, float* %1, i32 2
903 %4 = load float, float* %incdec.ptr, align 4
904 %incdec.ptr7 = getelementptr inbounds float, float* %1, i32 3
905 %5 = load float, float* %incdec.ptr6, align 4
906 %6 = load float, float* %incdec.ptr7, align 4
907 %shr = lshr i32 %blockSize, 2
908 %cmp9146 = icmp eq i32 %shr, 0
909 %.pre161 = insertelement <4 x float> undef, float %3, i32 0
910 %.pre162 = shufflevector <4 x float> %.pre161, <4 x float> undef, <4 x i32> zeroinitializer
911 %.pre163 = insertelement <4 x float> undef, float %4, i32 0
912 %.pre164 = shufflevector <4 x float> %.pre163, <4 x float> undef, <4 x i32> zeroinitializer
913 %.pre165 = insertelement <4 x float> undef, float %5, i32 0
914 %.pre166 = shufflevector <4 x float> %.pre165, <4 x float> undef, <4 x i32> zeroinitializer
915 %.pre167 = insertelement <4 x float> undef, float %6, i32 0
916 %.pre168 = shufflevector <4 x float> %.pre167, <4 x float> undef, <4 x i32> zeroinitializer
917 br i1 %cmp9146, label %while.end, label %while.body.lr.ph
918
919while.body.lr.ph: ; preds = %if.then
920 %7 = and i32 %blockSize, -4
921 %scevgep158 = getelementptr float, float* %pDst, i32 %7
922 br label %while.body
923
924while.body: ; preds = %while.body.lr.ph, %while.body
925 %pStateCur.0151 = phi float* [ %arrayidx, %while.body.lr.ph ], [ %add.ptr, %while.body ]
926 %pSamples.0150 = phi float* [ %0, %while.body.lr.ph ], [ %add.ptr24, %while.body ]
927 %pOutput.0149 = phi float* [ %pDst, %while.body.lr.ph ], [ %add.ptr23, %while.body ]
928 %pTempSrc.0148 = phi float* [ %pSrc, %while.body.lr.ph ], [ %add.ptr11, %while.body ]
929 %blkCnt.0147 = phi i32 [ %shr, %while.body.lr.ph ], [ %dec, %while.body ]
930 %8 = bitcast float* %pTempSrc.0148 to <4 x float>*
931 %9 = load <4 x float>, <4 x float>* %8, align 4
932 %10 = bitcast float* %pStateCur.0151 to <4 x float>*
933 store <4 x float> %9, <4 x float>* %10, align 4
934 %add.ptr = getelementptr inbounds float, float* %pStateCur.0151, i32 4
935 %add.ptr11 = getelementptr inbounds float, float* %pTempSrc.0148, i32 4
936 %11 = bitcast float* %pSamples.0150 to <4 x float>*
937 %12 = load <4 x float>, <4 x float>* %11, align 4
938 %13 = fmul fast <4 x float> %12, %.pre162
939 %arrayidx12 = getelementptr inbounds float, float* %pSamples.0150, i32 1
940 %14 = bitcast float* %arrayidx12 to <4 x float>*
941 %15 = load <4 x float>, <4 x float>* %14, align 4
942 %mul = fmul fast <4 x float> %15, %.pre164
943 %add = fadd fast <4 x float> %mul, %13
944 %arrayidx13 = getelementptr inbounds float, float* %pSamples.0150, i32 2
945 %16 = bitcast float* %arrayidx13 to <4 x float>*
946 %17 = load <4 x float>, <4 x float>* %16, align 4
947 %mul16 = fmul fast <4 x float> %17, %.pre166
948 %add17 = fadd fast <4 x float> %add, %mul16
949 %arrayidx18 = getelementptr inbounds float, float* %pSamples.0150, i32 3
950 %18 = bitcast float* %arrayidx18 to <4 x float>*
951 %19 = load <4 x float>, <4 x float>* %18, align 4
952 %mul21 = fmul fast <4 x float> %19, %.pre168
953 %add22 = fadd fast <4 x float> %add17, %mul21
954 %20 = bitcast float* %pOutput.0149 to <4 x float>*
955 store <4 x float> %add22, <4 x float>* %20, align 4
956 %add.ptr23 = getelementptr inbounds float, float* %pOutput.0149, i32 4
957 %add.ptr24 = getelementptr inbounds float, float* %pSamples.0150, i32 4
958 %dec = add nsw i32 %blkCnt.0147, -1
959 %cmp9 = icmp eq i32 %dec, 0
960 br i1 %cmp9, label %while.end.loopexit, label %while.body
961
962while.end.loopexit: ; preds = %while.body
963 %scevgep157 = getelementptr float, float* %pSrc, i32 %7
964 %scevgep159 = getelementptr float, float* %0, i32 %7
965 br label %while.end
966
967while.end: ; preds = %if.then, %while.end.loopexit
968 %pTempSrc.0.lcssa = phi float* [ %scevgep157, %while.end.loopexit ], [ %pSrc, %if.then ]
969 %pOutput.0.lcssa = phi float* [ %scevgep158, %while.end.loopexit ], [ %pDst, %if.then ]
970 %pSamples.0.lcssa = phi float* [ %scevgep159, %while.end.loopexit ], [ %0, %if.then ]
971 %pStateCur.0.lcssa = phi float* [ %add.ptr, %while.end.loopexit ], [ %arrayidx, %if.then ]
972 %and = and i32 %blockSize, 3
973 %21 = tail call <4 x i1> @llvm.arm.mve.vctp32(i32 %and)
974 %22 = bitcast float* %pTempSrc.0.lcssa to <4 x float>*
975 %23 = load <4 x float>, <4 x float>* %22, align 4
976 %24 = bitcast float* %pStateCur.0.lcssa to <4 x float>*
977 tail call void @llvm.masked.store.v4f32.p0v4f32(<4 x float> %23, <4 x float>* %24, i32 4, <4 x i1> %21)
978 %25 = bitcast float* %pSamples.0.lcssa to <4 x float>*
979 %26 = load <4 x float>, <4 x float>* %25, align 4
980 %27 = fmul fast <4 x float> %26, %.pre162
981 %arrayidx29 = getelementptr inbounds float, float* %pSamples.0.lcssa, i32 1
982 %28 = bitcast float* %arrayidx29 to <4 x float>*
983 %29 = load <4 x float>, <4 x float>* %28, align 4
984 %mul32 = fmul fast <4 x float> %29, %.pre164
985 %add33 = fadd fast <4 x float> %mul32, %27
986 %arrayidx34 = getelementptr inbounds float, float* %pSamples.0.lcssa, i32 2
987 %30 = bitcast float* %arrayidx34 to <4 x float>*
988 %31 = load <4 x float>, <4 x float>* %30, align 4
989 %mul37 = fmul fast <4 x float> %31, %.pre166
990 %add38 = fadd fast <4 x float> %add33, %mul37
991 %arrayidx39 = getelementptr inbounds float, float* %pSamples.0.lcssa, i32 3
992 %32 = bitcast float* %arrayidx39 to <4 x float>*
993 %33 = load <4 x float>, <4 x float>* %32, align 4
994 %mul42 = fmul fast <4 x float> %33, %.pre168
995 %add43 = fadd fast <4 x float> %add38, %mul42
996 %34 = bitcast float* %pOutput.0.lcssa to <4 x float>*
997 tail call void @llvm.masked.store.v4f32.p0v4f32(<4 x float> %add43, <4 x float>* %34, i32 4, <4 x i1> %21)
998 %.pre = load float*, float** %pState1, align 4
999 br label %if.end
1000
1001if.end: ; preds = %while.end, %entry
1002 %35 = phi float* [ %.pre, %while.end ], [ %0, %entry ]
1003 %arrayidx45 = getelementptr inbounds float, float* %35, i32 %blockSize
1004 %shr47 = lshr i32 %conv, 2
1005 %cmp49141 = icmp eq i32 %shr47, 0
1006 br i1 %cmp49141, label %while.end55, label %while.body51.preheader
1007
1008while.body51.preheader: ; preds = %if.end
1009 %36 = and i32 %conv, 65532
1010 %37 = add i32 %36, %blockSize
1011 %scevgep = getelementptr float, float* %35, i32 %37
1012 br label %while.body51
1013
1014while.body51: ; preds = %while.body51.preheader, %while.body51
1015 %pTempSrc.1144 = phi float* [ %add.ptr52, %while.body51 ], [ %arrayidx45, %while.body51.preheader ]
1016 %pTempDest.0143 = phi float* [ %add.ptr53, %while.body51 ], [ %35, %while.body51.preheader ]
1017 %blkCnt.1142 = phi i32 [ %dec54, %while.body51 ], [ %shr47, %while.body51.preheader ]
1018 %38 = bitcast float* %pTempSrc.1144 to <4 x float>*
1019 %39 = load <4 x float>, <4 x float>* %38, align 4
1020 %40 = bitcast float* %pTempDest.0143 to <4 x float>*
1021 store <4 x float> %39, <4 x float>* %40, align 4
1022 %add.ptr52 = getelementptr inbounds float, float* %pTempSrc.1144, i32 4
1023 %add.ptr53 = getelementptr inbounds float, float* %pTempDest.0143, i32 4
1024 %dec54 = add nsw i32 %blkCnt.1142, -1
1025 %cmp49 = icmp eq i32 %dec54, 0
1026 br i1 %cmp49, label %while.end55.loopexit, label %while.body51
1027
1028while.end55.loopexit: ; preds = %while.body51
1029 %scevgep156 = getelementptr float, float* %35, i32 %36
1030 br label %while.end55
1031
1032while.end55: ; preds = %while.end55.loopexit, %if.end
1033 %pTempDest.0.lcssa = phi float* [ %35, %if.end ], [ %scevgep156, %while.end55.loopexit ]
1034 %pTempSrc.1.lcssa = phi float* [ %arrayidx45, %if.end ], [ %scevgep, %while.end55.loopexit ]
1035 %and56 = and i32 %conv, 3
1036 %cmp57 = icmp eq i32 %and56, 0
1037 br i1 %cmp57, label %if.end61, label %if.then59
1038
1039if.then59: ; preds = %while.end55
1040 %41 = tail call <4 x i1> @llvm.arm.mve.vctp32(i32 %and56)
1041 %42 = bitcast float* %pTempSrc.1.lcssa to <4 x float>*
1042 %43 = load <4 x float>, <4 x float>* %42, align 4
1043 %44 = bitcast float* %pTempDest.0.lcssa to <4 x float>*
1044 tail call void @llvm.masked.store.v4f32.p0v4f32(<4 x float> %43, <4 x float>* %44, i32 4, <4 x i1> %41)
1045 br label %if.end61
1046
1047if.end61: ; preds = %while.end55, %if.then59
1048 ret void
1049}
1050
1051
1052define void @fir(%struct.arm_fir_instance_f32* nocapture readonly %S, float* nocapture readonly %pSrc, float* nocapture %pDst, i32 %blockSize) {
1053; CHECK-LABEL: fir:
1054; CHECK: @ %bb.0: @ %entry
1055; CHECK-NEXT: .save {r4, r5, r6, r7, r8, r9, r10, r11, lr}
1056; CHECK-NEXT: push.w {r4, r5, r6, r7, r8, r9, r10, r11, lr}
1057; CHECK-NEXT: .pad #4
1058; CHECK-NEXT: sub sp, #4
1059; CHECK-NEXT: .vsave {d8, d9, d10, d11, d12, d13, d14, d15}
1060; CHECK-NEXT: vpush {d8, d9, d10, d11, d12, d13, d14, d15}
1061; CHECK-NEXT: .pad #88
1062; CHECK-NEXT: sub sp, #88
1063; CHECK-NEXT: cmp r3, #8
1064; CHECK-NEXT: blo.w .LBB16_12
1065; CHECK-NEXT: @ %bb.1: @ %if.then
1066; CHECK-NEXT: movs r7, #0
1067; CHECK-NEXT: cmp.w r7, r3, lsr #2
1068; CHECK-NEXT: beq.w .LBB16_12
1069; CHECK-NEXT: @ %bb.2: @ %while.body.lr.ph
1070; CHECK-NEXT: ldrh r4, [r0]
1071; CHECK-NEXT: lsr.w r8, r3, #2
1072; CHECK-NEXT: ldrd r5, r12, [r0, #4]
1073; CHECK-NEXT: movs r3, #1
1074; CHECK-NEXT: sub.w r0, r4, #8
1075; CHECK-NEXT: and r10, r0, #7
1076; CHECK-NEXT: add.w r7, r0, r0, lsr #29
1077; CHECK-NEXT: add.w r0, r10, #1
1078; CHECK-NEXT: asrs r6, r7, #3
1079; CHECK-NEXT: cmp r6, #1
1080; CHECK-NEXT: it gt
1081; CHECK-NEXT: asrgt r3, r7, #3
1082; CHECK-NEXT: add.w r7, r5, r4, lsl #2
1083; CHECK-NEXT: sub.w r11, r7, #4
1084; CHECK-NEXT: str r3, [sp, #12] @ 4-byte Spill
1085; CHECK-NEXT: rsbs r3, r4, #0
1086; CHECK-NEXT: str r3, [sp, #24] @ 4-byte Spill
1087; CHECK-NEXT: add.w r3, r12, #32
1088; CHECK-NEXT: str r4, [sp, #28] @ 4-byte Spill
1089; CHECK-NEXT: str r3, [sp, #20] @ 4-byte Spill
1090; CHECK-NEXT: str r0, [sp, #16] @ 4-byte Spill
1091; CHECK-NEXT: b .LBB16_4
1092; CHECK-NEXT: .LBB16_3: @ %while.end
1093; CHECK-NEXT: @ in Loop: Header=BB16_4 Depth=1
1094; CHECK-NEXT: ldr r0, [sp, #24] @ 4-byte Reload
1095; CHECK-NEXT: subs.w r8, r8, #1
1096; CHECK-NEXT: vstrb.8 q0, [r2], #16
1097; CHECK-NEXT: add.w r0, r9, r0, lsl #2
1098; CHECK-NEXT: add.w r5, r0, #16
1099; CHECK-NEXT: beq.w .LBB16_12
1100; CHECK-NEXT: .LBB16_4: @ %while.body
1101; CHECK-NEXT: @ =>This Loop Header: Depth=1
1102; CHECK-NEXT: @ Child Loop BB16_6 Depth 2
1103; CHECK-NEXT: @ Child Loop BB16_10 Depth 2
1104; CHECK-NEXT: vldr s2, [r12, #12]
1105; CHECK-NEXT: vldrw.u32 q3, [r1], #16
1106; CHECK-NEXT: vldr s8, [r12, #28]
1107; CHECK-NEXT: add.w r9, r5, #32
1108; CHECK-NEXT: vldr s0, [r12]
1109; CHECK-NEXT: vstr s2, [sp, #64] @ 4-byte Spill
1110; CHECK-NEXT: vmov r6, s8
1111; CHECK-NEXT: vldr s2, [r12, #16]
1112; CHECK-NEXT: vmov r3, s0
1113; CHECK-NEXT: vldr s4, [r12, #20]
1114; CHECK-NEXT: vldr s6, [r12, #24]
1115; CHECK-NEXT: vmov r4, s2
1116; CHECK-NEXT: vldr s5, [r12, #4]
1117; CHECK-NEXT: vmov r0, s4
1118; CHECK-NEXT: vldr s7, [r12, #8]
1119; CHECK-NEXT: vstrb.8 q3, [r11], #16
1120; CHECK-NEXT: vldrw.u32 q2, [r5, #28]
1121; CHECK-NEXT: vldrw.u32 q4, [r5]
1122; CHECK-NEXT: vldrw.u32 q5, [r5, #4]
1123; CHECK-NEXT: vldrw.u32 q3, [r5, #20]
1124; CHECK-NEXT: vstrw.32 q2, [sp, #48] @ 16-byte Spill
1125; CHECK-NEXT: vldrw.u32 q2, [r5, #24]
1126; CHECK-NEXT: vldrw.u32 q6, [r5, #12]
1127; CHECK-NEXT: vldrw.u32 q7, [r5, #16]
1128; CHECK-NEXT: vmul.f32 q0, q4, r3
1129; CHECK-NEXT: vldrw.u32 q4, [r5, #8]
1130; CHECK-NEXT: vmov r3, s5
1131; CHECK-NEXT: vfma.f32 q0, q5, r3
1132; CHECK-NEXT: vmov r3, s7
1133; CHECK-NEXT: vfma.f32 q0, q4, r3
1134; CHECK-NEXT: vldr s4, [sp, #64] @ 4-byte Reload
1135; CHECK-NEXT: vmov r7, s6
1136; CHECK-NEXT: vmov r3, s4
1137; CHECK-NEXT: vfma.f32 q0, q6, r3
1138; CHECK-NEXT: vfma.f32 q0, q7, r4
1139; CHECK-NEXT: vfma.f32 q0, q3, r0
1140; CHECK-NEXT: vfma.f32 q0, q2, r7
1141; CHECK-NEXT: vldrw.u32 q1, [sp, #48] @ 16-byte Reload
1142; CHECK-NEXT: vfma.f32 q0, q1, r6
1143; CHECK-NEXT: ldr r0, [sp, #28] @ 4-byte Reload
1144; CHECK-NEXT: cmp r0, #16
1145; CHECK-NEXT: blo .LBB16_8
1146; CHECK-NEXT: @ %bb.5: @ %for.body.preheader
1147; CHECK-NEXT: @ in Loop: Header=BB16_4 Depth=1
1148; CHECK-NEXT: ldr.w lr, [sp, #12] @ 4-byte Reload
1149; CHECK-NEXT: dls lr, lr
1150; CHECK-NEXT: ldr r6, [sp, #20] @ 4-byte Reload
1151; CHECK-NEXT: .LBB16_6: @ %for.body
1152; CHECK-NEXT: @ Parent Loop BB16_4 Depth=1
1153; CHECK-NEXT: @ => This Inner Loop Header: Depth=2
1154; CHECK-NEXT: vldrw.u32 q1, [r9, #28]
1155; CHECK-NEXT: vldr s24, [r6]
1156; CHECK-NEXT: vldr s26, [r6, #4]
1157; CHECK-NEXT: vldrw.u32 q3, [r9, #4]
1158; CHECK-NEXT: vstrw.32 q1, [sp, #64] @ 16-byte Spill
1159; CHECK-NEXT: vldrw.u32 q1, [r9, #20]
1160; CHECK-NEXT: vldr s28, [r6, #8]
1161; CHECK-NEXT: vmov r7, s24
1162; CHECK-NEXT: vstrw.32 q1, [sp, #32] @ 16-byte Spill
1163; CHECK-NEXT: vldrw.u32 q1, [r9, #24]
1164; CHECK-NEXT: vldr s25, [r6, #16]
1165; CHECK-NEXT: vldrw.u32 q5, [r9, #12]
1166; CHECK-NEXT: vstrw.32 q1, [sp, #48] @ 16-byte Spill
1167; CHECK-NEXT: vldrw.u32 q1, [r9]
1168; CHECK-NEXT: vldr s27, [r6, #20]
1169; CHECK-NEXT: vldrw.u32 q4, [r9, #16]
1170; CHECK-NEXT: vldr s29, [r6, #24]
1171; CHECK-NEXT: vldrw.u32 q2, [r9, #8]
1172; CHECK-NEXT: vldr s31, [r6, #28]
1173; CHECK-NEXT: vmov r5, s25
1174; CHECK-NEXT: vldr s30, [r6, #12]
1175; CHECK-NEXT: vfma.f32 q0, q1, r7
1176; CHECK-NEXT: vmov r7, s26
1177; CHECK-NEXT: add.w r9, r9, #32
1178; CHECK-NEXT: vfma.f32 q0, q3, r7
1179; CHECK-NEXT: vmov r7, s28
1180; CHECK-NEXT: vfma.f32 q0, q2, r7
1181; CHECK-NEXT: vmov r7, s30
1182; CHECK-NEXT: vfma.f32 q0, q5, r7
1183; CHECK-NEXT: vmov r3, s27
1184; CHECK-NEXT: vfma.f32 q0, q4, r5
1185; CHECK-NEXT: vldrw.u32 q1, [sp, #32] @ 16-byte Reload
1186; CHECK-NEXT: vmov r4, s29
1187; CHECK-NEXT: adds r6, #32
1188; CHECK-NEXT: vfma.f32 q0, q1, r3
1189; CHECK-NEXT: vldrw.u32 q1, [sp, #48] @ 16-byte Reload
1190; CHECK-NEXT: vmov r0, s31
1191; CHECK-NEXT: vfma.f32 q0, q1, r4
1192; CHECK-NEXT: vldrw.u32 q1, [sp, #64] @ 16-byte Reload
1193; CHECK-NEXT: vfma.f32 q0, q1, r0
1194; CHECK-NEXT: le lr, .LBB16_6
1195; CHECK-NEXT: @ %bb.7: @ %for.end
1196; CHECK-NEXT: @ in Loop: Header=BB16_4 Depth=1
1197; CHECK-NEXT: cmp.w r10, #0
1198; CHECK-NEXT: bne .LBB16_9
1199; CHECK-NEXT: b .LBB16_3
1200; CHECK-NEXT: .LBB16_8: @ in Loop: Header=BB16_4 Depth=1
1201; CHECK-NEXT: ldr r6, [sp, #20] @ 4-byte Reload
1202; CHECK-NEXT: cmp.w r10, #0
1203; CHECK-NEXT: beq.w .LBB16_3
1204; CHECK-NEXT: .LBB16_9: @ %while.body76.preheader
1205; CHECK-NEXT: @ in Loop: Header=BB16_4 Depth=1
1206; CHECK-NEXT: ldr r0, [sp, #16] @ 4-byte Reload
1207; CHECK-NEXT: mov r5, r9
1208; CHECK-NEXT: .LBB16_10: @ %while.body76
1209; CHECK-NEXT: @ Parent Loop BB16_4 Depth=1
1210; CHECK-NEXT: @ => This Inner Loop Header: Depth=2
1211; CHECK-NEXT: vldr s4, [r6]
1212; CHECK-NEXT: vldrw.u32 q2, [r5], #4
1213; CHECK-NEXT: subs r0, #1
1214; CHECK-NEXT: adds r6, #4
1215; CHECK-NEXT: vmov r3, s4
1216; CHECK-NEXT: cmp r0, #1
1217; CHECK-NEXT: vfma.f32 q0, q2, r3
1218; CHECK-NEXT: bgt .LBB16_10
1219; CHECK-NEXT: @ %bb.11: @ %while.end.loopexit
1220; CHECK-NEXT: @ in Loop: Header=BB16_4 Depth=1
1221; CHECK-NEXT: add.w r9, r9, r10, lsl #2
1222; CHECK-NEXT: b .LBB16_3
1223; CHECK-NEXT: .LBB16_12: @ %if.end
1224; CHECK-NEXT: add sp, #88
1225; CHECK-NEXT: vpop {d8, d9, d10, d11, d12, d13, d14, d15}
1226; CHECK-NEXT: add sp, #4
1227; CHECK-NEXT: pop.w {r4, r5, r6, r7, r8, r9, r10, r11, pc}
1228entry:
1229 %pState1 = getelementptr inbounds %struct.arm_fir_instance_f32, %struct.arm_fir_instance_f32* %S, i32 0, i32 1
1230 %0 = load float*, float** %pState1, align 4
1231 %pCoeffs2 = getelementptr inbounds %struct.arm_fir_instance_f32, %struct.arm_fir_instance_f32* %S, i32 0, i32 2
1232 %1 = load float*, float** %pCoeffs2, align 4
1233 %numTaps3 = getelementptr inbounds %struct.arm_fir_instance_f32, %struct.arm_fir_instance_f32* %S, i32 0, i32 0
1234 %2 = load i16, i16* %numTaps3, align 4
1235 %conv = zext i16 %2 to i32
1236 %cmp = icmp ugt i32 %blockSize, 7
1237 br i1 %cmp, label %if.then, label %if.end
1238
1239if.then: ; preds = %entry
1240 %shr = lshr i32 %blockSize, 2
1241 %cmp5217 = icmp eq i32 %shr, 0
1242 br i1 %cmp5217, label %if.end, label %while.body.lr.ph
1243
1244while.body.lr.ph: ; preds = %if.then
1245 %sub = add nsw i32 %conv, -1
1246 %arrayidx = getelementptr inbounds float, float* %0, i32 %sub
1247 %incdec.ptr = getelementptr inbounds float, float* %1, i32 1
1248 %incdec.ptr7 = getelementptr inbounds float, float* %1, i32 2
1249 %incdec.ptr8 = getelementptr inbounds float, float* %1, i32 3
1250 %incdec.ptr9 = getelementptr inbounds float, float* %1, i32 4
1251 %incdec.ptr10 = getelementptr inbounds float, float* %1, i32 5
1252 %incdec.ptr11 = getelementptr inbounds float, float* %1, i32 6
1253 %incdec.ptr12 = getelementptr inbounds float, float* %1, i32 7
1254 %sub37 = add nsw i32 %conv, -8
1255 %div = sdiv i32 %sub37, 8
1256 %pCoeffsCur.0199 = getelementptr inbounds float, float* %1, i32 8
1257 %cmp38201 = icmp ugt i16 %2, 15
1258 %and = and i32 %sub37, 7
1259 %cmp74210 = icmp eq i32 %and, 0
1260 %idx.neg = sub nsw i32 0, %conv
1261 %3 = icmp sgt i32 %div, 1
1262 %smax = select i1 %3, i32 %div, i32 1
1263 br label %while.body
1264
1265while.body: ; preds = %while.body.lr.ph, %while.end
1266 %blkCnt.0222 = phi i32 [ %shr, %while.body.lr.ph ], [ %dec84, %while.end ]
1267 %pStateCur.0221 = phi float* [ %arrayidx, %while.body.lr.ph ], [ %add.ptr, %while.end ]
1268 %pSamples.0220 = phi float* [ %0, %while.body.lr.ph ], [ %add.ptr83, %while.end ]
1269 %pTempSrc.0219 = phi float* [ %pSrc, %while.body.lr.ph ], [ %add.ptr14, %while.end ]
1270 %pOutput.0218 = phi float* [ %pDst, %while.body.lr.ph ], [ %add.ptr81, %while.end ]
1271 %4 = load float, float* %1, align 4
1272 %5 = load float, float* %incdec.ptr, align 4
1273 %6 = load float, float* %incdec.ptr7, align 4
1274 %7 = load float, float* %incdec.ptr8, align 4
1275 %8 = load float, float* %incdec.ptr9, align 4
1276 %9 = load float, float* %incdec.ptr10, align 4
1277 %10 = load float, float* %incdec.ptr11, align 4
1278 %11 = load float, float* %incdec.ptr12, align 4
1279 %12 = bitcast float* %pTempSrc.0219 to <4 x float>*
1280 %13 = load <4 x float>, <4 x float>* %12, align 4
1281 %14 = bitcast float* %pStateCur.0221 to <4 x float>*
1282 store <4 x float> %13, <4 x float>* %14, align 4
1283 %add.ptr = getelementptr inbounds float, float* %pStateCur.0221, i32 4
1284 %add.ptr14 = getelementptr inbounds float, float* %pTempSrc.0219, i32 4
1285 %15 = bitcast float* %pSamples.0220 to <4 x float>*
1286 %16 = load <4 x float>, <4 x float>* %15, align 4
1287 %.splatinsert = insertelement <4 x float> undef, float %4, i32 0
1288 %.splat = shufflevector <4 x float> %.splatinsert, <4 x float> undef, <4 x i32> zeroinitializer
1289 %17 = fmul fast <4 x float> %16, %.splat
1290 %arrayidx15 = getelementptr inbounds float, float* %pSamples.0220, i32 1
1291 %18 = bitcast float* %arrayidx15 to <4 x float>*
1292 %19 = load <4 x float>, <4 x float>* %18, align 4
1293 %.splatinsert16 = insertelement <4 x float> undef, float %5, i32 0
1294 %.splat17 = shufflevector <4 x float> %.splatinsert16, <4 x float> undef, <4 x i32> zeroinitializer
1295 %20 = tail call fast <4 x float> @llvm.fma.v4f32(<4 x float> %19, <4 x float> %.splat17, <4 x float> %17)
1296 %arrayidx18 = getelementptr inbounds float, float* %pSamples.0220, i32 2
1297 %21 = bitcast float* %arrayidx18 to <4 x float>*
1298 %22 = load <4 x float>, <4 x float>* %21, align 4
1299 %.splatinsert19 = insertelement <4 x float> undef, float %6, i32 0
1300 %.splat20 = shufflevector <4 x float> %.splatinsert19, <4 x float> undef, <4 x i32> zeroinitializer
1301 %23 = tail call fast <4 x float> @llvm.fma.v4f32(<4 x float> %22, <4 x float> %.splat20, <4 x float> %20)
1302 %arrayidx21 = getelementptr inbounds float, float* %pSamples.0220, i32 3
1303 %24 = bitcast float* %arrayidx21 to <4 x float>*
1304 %25 = load <4 x float>, <4 x float>* %24, align 4
1305 %.splatinsert22 = insertelement <4 x float> undef, float %7, i32 0
1306 %.splat23 = shufflevector <4 x float> %.splatinsert22, <4 x float> undef, <4 x i32> zeroinitializer
1307 %26 = tail call fast <4 x float> @llvm.fma.v4f32(<4 x float> %25, <4 x float> %.splat23, <4 x float> %23)
1308 %arrayidx24 = getelementptr inbounds float, float* %pSamples.0220, i32 4
1309 %27 = bitcast float* %arrayidx24 to <4 x float>*
1310 %28 = load <4 x float>, <4 x float>* %27, align 4
1311 %.splatinsert25 = insertelement <4 x float> undef, float %8, i32 0
1312 %.splat26 = shufflevector <4 x float> %.splatinsert25, <4 x float> undef, <4 x i32> zeroinitializer
1313 %29 = tail call fast <4 x float> @llvm.fma.v4f32(<4 x float> %28, <4 x float> %.splat26, <4 x float> %26)
1314 %arrayidx27 = getelementptr inbounds float, float* %pSamples.0220, i32 5
1315 %30 = bitcast float* %arrayidx27 to <4 x float>*
1316 %31 = load <4 x float>, <4 x float>* %30, align 4
1317 %.splatinsert28 = insertelement <4 x float> undef, float %9, i32 0
1318 %.splat29 = shufflevector <4 x float> %.splatinsert28, <4 x float> undef, <4 x i32> zeroinitializer
1319 %32 = tail call fast <4 x float> @llvm.fma.v4f32(<4 x float> %31, <4 x float> %.splat29, <4 x float> %29)
1320 %arrayidx30 = getelementptr inbounds float, float* %pSamples.0220, i32 6
1321 %33 = bitcast float* %arrayidx30 to <4 x float>*
1322 %34 = load <4 x float>, <4 x float>* %33, align 4
1323 %.splatinsert31 = insertelement <4 x float> undef, float %10, i32 0
1324 %.splat32 = shufflevector <4 x float> %.splatinsert31, <4 x float> undef, <4 x i32> zeroinitializer
1325 %35 = tail call fast <4 x float> @llvm.fma.v4f32(<4 x float> %34, <4 x float> %.splat32, <4 x float> %32)
1326 %arrayidx33 = getelementptr inbounds float, float* %pSamples.0220, i32 7
1327 %36 = bitcast float* %arrayidx33 to <4 x float>*
1328 %37 = load <4 x float>, <4 x float>* %36, align 4
1329 %.splatinsert34 = insertelement <4 x float> undef, float %11, i32 0
1330 %.splat35 = shufflevector <4 x float> %.splatinsert34, <4 x float> undef, <4 x i32> zeroinitializer
1331 %38 = tail call fast <4 x float> @llvm.fma.v4f32(<4 x float> %37, <4 x float> %.splat35, <4 x float> %35)
1332 %pSamples.1200 = getelementptr inbounds float, float* %pSamples.0220, i32 8
1333 br i1 %cmp38201, label %for.body, label %for.end
1334
1335for.body: ; preds = %while.body, %for.body
1336 %pSamples.1207 = phi float* [ %pSamples.1, %for.body ], [ %pSamples.1200, %while.body ]
1337 %pCoeffsCur.0206 = phi float* [ %pCoeffsCur.0, %for.body ], [ %pCoeffsCur.0199, %while.body ]
1338 %.pn205 = phi float* [ %pCoeffsCur.0206, %for.body ], [ %1, %while.body ]
1339 %i.0204 = phi i32 [ %inc, %for.body ], [ 0, %while.body ]
1340 %vecAcc0.0203 = phi <4 x float> [ %70, %for.body ], [ %38, %while.body ]
1341 %pSamples.0.pn202 = phi float* [ %pSamples.1207, %for.body ], [ %pSamples.0220, %while.body ]
1342 %incdec.ptr40 = getelementptr inbounds float, float* %.pn205, i32 9
1343 %39 = load float, float* %pCoeffsCur.0206, align 4
1344 %incdec.ptr41 = getelementptr inbounds float, float* %.pn205, i32 10
1345 %40 = load float, float* %incdec.ptr40, align 4
1346 %incdec.ptr42 = getelementptr inbounds float, float* %.pn205, i32 11
1347 %41 = load float, float* %incdec.ptr41, align 4
1348 %incdec.ptr43 = getelementptr inbounds float, float* %.pn205, i32 12
1349 %42 = load float, float* %incdec.ptr42, align 4
1350 %incdec.ptr44 = getelementptr inbounds float, float* %.pn205, i32 13
1351 %43 = load float, float* %incdec.ptr43, align 4
1352 %incdec.ptr45 = getelementptr inbounds float, float* %.pn205, i32 14
1353 %44 = load float, float* %incdec.ptr44, align 4
1354 %incdec.ptr46 = getelementptr inbounds float, float* %.pn205, i32 15
1355 %45 = load float, float* %incdec.ptr45, align 4
1356 %46 = load float, float* %incdec.ptr46, align 4
1357 %47 = bitcast float* %pSamples.1207 to <4 x float>*
1358 %48 = load <4 x float>, <4 x float>* %47, align 4
1359 %.splatinsert48 = insertelement <4 x float> undef, float %39, i32 0
1360 %.splat49 = shufflevector <4 x float> %.splatinsert48, <4 x float> undef, <4 x i32> zeroinitializer
1361 %49 = tail call fast <4 x float> @llvm.fma.v4f32(<4 x float> %48, <4 x float> %.splat49, <4 x float> %vecAcc0.0203)
1362 %arrayidx50 = getelementptr inbounds float, float* %pSamples.0.pn202, i32 9
1363 %50 = bitcast float* %arrayidx50 to <4 x float>*
1364 %51 = load <4 x float>, <4 x float>* %50, align 4
1365 %.splatinsert51 = insertelement <4 x float> undef, float %40, i32 0
1366 %.splat52 = shufflevector <4 x float> %.splatinsert51, <4 x float> undef, <4 x i32> zeroinitializer
1367 %52 = tail call fast <4 x float> @llvm.fma.v4f32(<4 x float> %51, <4 x float> %.splat52, <4 x float> %49)
1368 %arrayidx53 = getelementptr inbounds float, float* %pSamples.0.pn202, i32 10
1369 %53 = bitcast float* %arrayidx53 to <4 x float>*
1370 %54 = load <4 x float>, <4 x float>* %53, align 4
1371 %.splatinsert54 = insertelement <4 x float> undef, float %41, i32 0
1372 %.splat55 = shufflevector <4 x float> %.splatinsert54, <4 x float> undef, <4 x i32> zeroinitializer
1373 %55 = tail call fast <4 x float> @llvm.fma.v4f32(<4 x float> %54, <4 x float> %.splat55, <4 x float> %52)
1374 %arrayidx56 = getelementptr inbounds float, float* %pSamples.0.pn202, i32 11
1375 %56 = bitcast float* %arrayidx56 to <4 x float>*
1376 %57 = load <4 x float>, <4 x float>* %56, align 4
1377 %.splatinsert57 = insertelement <4 x float> undef, float %42, i32 0
1378 %.splat58 = shufflevector <4 x float> %.splatinsert57, <4 x float> undef, <4 x i32> zeroinitializer
1379 %58 = tail call fast <4 x float> @llvm.fma.v4f32(<4 x float> %57, <4 x float> %.splat58, <4 x float> %55)
1380 %arrayidx59 = getelementptr inbounds float, float* %pSamples.0.pn202, i32 12
1381 %59 = bitcast float* %arrayidx59 to <4 x float>*
1382 %60 = load <4 x float>, <4 x float>* %59, align 4
1383 %.splatinsert60 = insertelement <4 x float> undef, float %43, i32 0
1384 %.splat61 = shufflevector <4 x float> %.splatinsert60, <4 x float> undef, <4 x i32> zeroinitializer
1385 %61 = tail call fast <4 x float> @llvm.fma.v4f32(<4 x float> %60, <4 x float> %.splat61, <4 x float> %58)
1386 %arrayidx62 = getelementptr inbounds float, float* %pSamples.0.pn202, i32 13
1387 %62 = bitcast float* %arrayidx62 to <4 x float>*
1388 %63 = load <4 x float>, <4 x float>* %62, align 4
1389 %.splatinsert63 = insertelement <4 x float> undef, float %44, i32 0
1390 %.splat64 = shufflevector <4 x float> %.splatinsert63, <4 x float> undef, <4 x i32> zeroinitializer
1391 %64 = tail call fast <4 x float> @llvm.fma.v4f32(<4 x float> %63, <4 x float> %.splat64, <4 x float> %61)
1392 %arrayidx65 = getelementptr inbounds float, float* %pSamples.0.pn202, i32 14
1393 %65 = bitcast float* %arrayidx65 to <4 x float>*
1394 %66 = load <4 x float>, <4 x float>* %65, align 4
1395 %.splatinsert66 = insertelement <4 x float> undef, float %45, i32 0
1396 %.splat67 = shufflevector <4 x float> %.splatinsert66, <4 x float> undef, <4 x i32> zeroinitializer
1397 %67 = tail call fast <4 x float> @llvm.fma.v4f32(<4 x float> %66, <4 x float> %.splat67, <4 x float> %64)
1398 %arrayidx68 = getelementptr inbounds float, float* %pSamples.0.pn202, i32 15
1399 %68 = bitcast float* %arrayidx68 to <4 x float>*
1400 %69 = load <4 x float>, <4 x float>* %68, align 4
1401 %.splatinsert69 = insertelement <4 x float> undef, float %46, i32 0
1402 %.splat70 = shufflevector <4 x float> %.splatinsert69, <4 x float> undef, <4 x i32> zeroinitializer
1403 %70 = tail call fast <4 x float> @llvm.fma.v4f32(<4 x float> %69, <4 x float> %.splat70, <4 x float> %67)
1404 %inc = add nuw nsw i32 %i.0204, 1
1405 %pCoeffsCur.0 = getelementptr inbounds float, float* %pCoeffsCur.0206, i32 8
1406 %pSamples.1 = getelementptr inbounds float, float* %pSamples.1207, i32 8
1407 %exitcond = icmp eq i32 %inc, %smax
1408 br i1 %exitcond, label %for.end, label %for.body
1409
1410for.end: ; preds = %for.body, %while.body
1411 %vecAcc0.0.lcssa = phi <4 x float> [ %38, %while.body ], [ %70, %for.body ]
1412 %pCoeffsCur.0.lcssa = phi float* [ %pCoeffsCur.0199, %while.body ], [ %pCoeffsCur.0, %for.body ]
1413 %pSamples.1.lcssa = phi float* [ %pSamples.1200, %while.body ], [ %pSamples.1, %for.body ]
1414 br i1 %cmp74210, label %while.end, label %while.body76
1415
1416while.body76: ; preds = %for.end, %while.body76
1417 %pCoeffsCur.1214 = phi float* [ %incdec.ptr77, %while.body76 ], [ %pCoeffsCur.0.lcssa, %for.end ]
1418 %vecAcc0.1213 = phi <4 x float> [ %74, %while.body76 ], [ %vecAcc0.0.lcssa, %for.end ]
1419 %numCnt.0212 = phi i32 [ %dec, %while.body76 ], [ %and, %for.end ]
1420 %pSamples.2211 = phi float* [ %incdec.ptr80, %while.body76 ], [ %pSamples.1.lcssa, %for.end ]
1421 %incdec.ptr77 = getelementptr inbounds float, float* %pCoeffsCur.1214, i32 1
1422 %71 = load float, float* %pCoeffsCur.1214, align 4
1423 %72 = bitcast float* %pSamples.2211 to <4 x float>*
1424 %73 = load <4 x float>, <4 x float>* %72, align 4
1425 %.splatinsert78 = insertelement <4 x float> undef, float %71, i32 0
1426 %.splat79 = shufflevector <4 x float> %.splatinsert78, <4 x float> undef, <4 x i32> zeroinitializer
1427 %74 = tail call fast <4 x float> @llvm.fma.v4f32(<4 x float> %73, <4 x float> %.splat79, <4 x float> %vecAcc0.1213)
1428 %incdec.ptr80 = getelementptr inbounds float, float* %pSamples.2211, i32 1
1429 %dec = add nsw i32 %numCnt.0212, -1
1430 %cmp74 = icmp sgt i32 %numCnt.0212, 1
1431 br i1 %cmp74, label %while.body76, label %while.end.loopexit
1432
1433while.end.loopexit: ; preds = %while.body76
1434 %scevgep = getelementptr float, float* %pSamples.1.lcssa, i32 %and
1435 br label %while.end
1436
1437while.end: ; preds = %while.end.loopexit, %for.end
1438 %pSamples.2.lcssa = phi float* [ %pSamples.1.lcssa, %for.end ], [ %scevgep, %while.end.loopexit ]
1439 %vecAcc0.1.lcssa = phi <4 x float> [ %vecAcc0.0.lcssa, %for.end ], [ %74, %while.end.loopexit ]
1440 %75 = bitcast float* %pOutput.0218 to <4 x float>*
1441 store <4 x float> %vecAcc0.1.lcssa, <4 x float>* %75, align 4
1442 %add.ptr81 = getelementptr inbounds float, float* %pOutput.0218, i32 4
1443 %add.ptr82 = getelementptr inbounds float, float* %pSamples.2.lcssa, i32 4
1444 %add.ptr83 = getelementptr inbounds float, float* %add.ptr82, i32 %idx.neg
1445 %dec84 = add nsw i32 %blkCnt.0222, -1
1446 %cmp5 = icmp eq i32 %dec84, 0
1447 br i1 %cmp5, label %if.end, label %while.body
1448
1449if.end: ; preds = %while.end, %if.then, %entry
1450 ret void
1451}
1452
1453declare void @llvm.assume(i1)
1454declare <4 x i1> @llvm.arm.mve.vctp32(i32)
1455declare <4 x float> @llvm.fma.v4f32(<4 x float>, <4 x float>, <4 x float>)
1456declare void @llvm.masked.store.v4f32.p0v4f32(<4 x float>, <4 x float>*, i32 immarg, <4 x i1>)