1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=thumbv8.1m.main -mattr=+lob --verify-machineinstrs %s -o - | FileCheck %s
4 define arm_aapcs_vfpcc void @test(i16* noalias nocapture readonly %off, i16* noalias nocapture %data, i16* noalias nocapture %dst, i32 %n) {
6 ; CHECK: @ %bb.0: @ %entry
7 ; CHECK-NEXT: push.w {r4, r5, r6, r7, r8, lr}
8 ; CHECK-NEXT: cmp r3, #1
9 ; CHECK-NEXT: blt .LBB0_7
10 ; CHECK-NEXT: @ %bb.1: @ %for.cond1.preheader.us.preheader
11 ; CHECK-NEXT: mov r8, r3
12 ; CHECK-NEXT: lsl.w r12, r3, #1
13 ; CHECK-NEXT: movs r3, #0
14 ; CHECK-NEXT: mov r4, r1
15 ; CHECK-NEXT: .LBB0_2: @ %for.cond1.preheader.us
16 ; CHECK-NEXT: @ =>This Loop Header: Depth=1
17 ; CHECK-NEXT: @ Child Loop BB0_3 Depth 2
18 ; CHECK-NEXT: @ Child Loop BB0_5 Depth 2
19 ; CHECK-NEXT: dls lr, r8
20 ; CHECK-NEXT: movs r6, #0
21 ; CHECK-NEXT: .LBB0_3: @ %for.body4.us
22 ; CHECK-NEXT: @ Parent Loop BB0_2 Depth=1
23 ; CHECK-NEXT: @ => This Inner Loop Header: Depth=2
24 ; CHECK-NEXT: ldrh.w r5, [r0, r6, lsl #1]
25 ; CHECK-NEXT: ldrh.w r7, [r1, r6, lsl #1]
26 ; CHECK-NEXT: add r5, r7
27 ; CHECK-NEXT: strh.w r5, [r4, r6, lsl #1]
28 ; CHECK-NEXT: adds r6, #1
29 ; CHECK-NEXT: le lr, .LBB0_3
30 ; CHECK-NEXT: @ %bb.4: @ %for.body15.us.preheader
31 ; CHECK-NEXT: @ in Loop: Header=BB0_2 Depth=1
32 ; CHECK-NEXT: dls lr, r8
33 ; CHECK-NEXT: movs r6, #0
34 ; CHECK-NEXT: .LBB0_5: @ %for.body15.us
35 ; CHECK-NEXT: @ Parent Loop BB0_2 Depth=1
36 ; CHECK-NEXT: @ => This Inner Loop Header: Depth=2
37 ; CHECK-NEXT: ldrh.w r7, [r0, r6, lsl #1]
38 ; CHECK-NEXT: ldrh.w r5, [r1, r6, lsl #1]
39 ; CHECK-NEXT: add r5, r7
40 ; CHECK-NEXT: strh.w r5, [r2, r6, lsl #1]
41 ; CHECK-NEXT: adds r6, #1
42 ; CHECK-NEXT: le lr, .LBB0_5
43 ; CHECK-NEXT: @ %bb.6: @ %for.cond.cleanup14.us
44 ; CHECK-NEXT: @ in Loop: Header=BB0_2 Depth=1
45 ; CHECK-NEXT: adds r3, #1
46 ; CHECK-NEXT: add r2, r12
47 ; CHECK-NEXT: add r4, r12
48 ; CHECK-NEXT: cmp r3, r8
49 ; CHECK-NEXT: bne .LBB0_2
50 ; CHECK-NEXT: .LBB0_7: @ %for.cond.cleanup
51 ; CHECK-NEXT: pop.w {r4, r5, r6, r7, r8, pc}
53 %cmp252 = icmp sgt i32 %n, 0
54 br i1 %cmp252, label %for.cond1.preheader.us, label %for.cond.cleanup
56 for.cond1.preheader.us: ; preds = %entry, %for.cond.cleanup14.us
57 %i.057.us = phi i32 [ %inc29.us, %for.cond.cleanup14.us ], [ 0, %entry ]
58 %mul.us = mul i32 %i.057.us, %n
59 br label %for.body4.us
61 for.cond.cleanup14.us: ; preds = %for.body15.us
62 %inc29.us = add nuw i32 %i.057.us, 1
63 %exitcond94 = icmp eq i32 %inc29.us, %n
64 br i1 %exitcond94, label %for.cond.cleanup, label %for.cond1.preheader.us
66 for.body15.us: ; preds = %for.body4.us, %for.body15.us
67 %j10.055.us = phi i32 [ %inc26.us, %for.body15.us ], [ 0, %for.body4.us ]
68 %arrayidx16.us = getelementptr inbounds i16, i16* %off, i32 %j10.055.us
69 %0 = load i16, i16* %arrayidx16.us, align 2
70 %arrayidx18.us = getelementptr inbounds i16, i16* %data, i32 %j10.055.us
71 %1 = load i16, i16* %arrayidx18.us, align 2
72 %add20.us = add i16 %1, %0
73 %add23.us = add i32 %j10.055.us, %mul.us
74 %arrayidx24.us = getelementptr inbounds i16, i16* %dst, i32 %add23.us
75 store i16 %add20.us, i16* %arrayidx24.us, align 2
76 %inc26.us = add nuw nsw i32 %j10.055.us, 1
77 %exitcond93 = icmp eq i32 %inc26.us, %n
78 br i1 %exitcond93, label %for.cond.cleanup14.us, label %for.body15.us
80 for.body4.us: ; preds = %for.body4.us, %for.cond1.preheader.us
81 %j.053.us = phi i32 [ 0, %for.cond1.preheader.us ], [ %inc.us, %for.body4.us ]
82 %arrayidx.us = getelementptr inbounds i16, i16* %off, i32 %j.053.us
83 %2 = load i16, i16* %arrayidx.us, align 2
84 %arrayidx5.us = getelementptr inbounds i16, i16* %data, i32 %j.053.us
85 %3 = load i16, i16* %arrayidx5.us, align 2
86 %add.us = add i16 %3, %2
87 %add8.us = add i32 %j.053.us, %mul.us
88 %arrayidx9.us = getelementptr inbounds i16, i16* %data, i32 %add8.us
89 store i16 %add.us, i16* %arrayidx9.us, align 2
90 %inc.us = add nuw nsw i32 %j.053.us, 1
91 %exitcond = icmp eq i32 %inc.us, %n
92 br i1 %exitcond, label %for.body15.us, label %for.body4.us
94 for.cond.cleanup: ; preds = %for.cond.cleanup14.us, %entry