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(ptr noalias nocapture readonly %off, ptr noalias nocapture %data, ptr noalias nocapture %dst, i32 %n) {
6 ; CHECK: @ %bb.0: @ %entry
7 ; CHECK-NEXT: cmp r3, #1
10 ; CHECK-NEXT: .LBB0_1: @ %for.cond1.preheader.us.preheader
11 ; CHECK-NEXT: push.w {r4, r5, r6, r7, r8, lr}
12 ; CHECK-NEXT: mov r8, r3
13 ; CHECK-NEXT: lsl.w r12, r3, #1
14 ; CHECK-NEXT: movs r3, #0
15 ; CHECK-NEXT: mov r4, r1
16 ; CHECK-NEXT: .LBB0_2: @ %for.cond1.preheader.us
17 ; CHECK-NEXT: @ =>This Loop Header: Depth=1
18 ; CHECK-NEXT: @ Child Loop BB0_3 Depth 2
19 ; CHECK-NEXT: @ Child Loop BB0_5 Depth 2
20 ; CHECK-NEXT: dls lr, r8
21 ; CHECK-NEXT: movs r6, #0
22 ; CHECK-NEXT: .LBB0_3: @ %for.body4.us
23 ; CHECK-NEXT: @ Parent Loop BB0_2 Depth=1
24 ; CHECK-NEXT: @ => This Inner Loop Header: Depth=2
25 ; CHECK-NEXT: ldrh.w r5, [r0, r6, lsl #1]
26 ; CHECK-NEXT: ldrh.w r7, [r1, r6, lsl #1]
27 ; CHECK-NEXT: add r5, r7
28 ; CHECK-NEXT: strh.w r5, [r4, r6, lsl #1]
29 ; CHECK-NEXT: adds r6, #1
30 ; CHECK-NEXT: le lr, .LBB0_3
31 ; CHECK-NEXT: @ %bb.4: @ %for.body15.us.preheader
32 ; CHECK-NEXT: @ in Loop: Header=BB0_2 Depth=1
33 ; CHECK-NEXT: dls lr, r8
34 ; CHECK-NEXT: movs r6, #0
35 ; CHECK-NEXT: .LBB0_5: @ %for.body15.us
36 ; CHECK-NEXT: @ Parent Loop BB0_2 Depth=1
37 ; CHECK-NEXT: @ => This Inner Loop Header: Depth=2
38 ; CHECK-NEXT: ldrh.w r7, [r0, r6, lsl #1]
39 ; CHECK-NEXT: ldrh.w r5, [r1, r6, lsl #1]
40 ; CHECK-NEXT: add r5, r7
41 ; CHECK-NEXT: strh.w r5, [r2, r6, lsl #1]
42 ; CHECK-NEXT: adds r6, #1
43 ; CHECK-NEXT: le lr, .LBB0_5
44 ; CHECK-NEXT: @ %bb.6: @ %for.cond.cleanup14.us
45 ; CHECK-NEXT: @ in Loop: Header=BB0_2 Depth=1
46 ; CHECK-NEXT: adds r3, #1
47 ; CHECK-NEXT: add r2, r12
48 ; CHECK-NEXT: add r4, r12
49 ; CHECK-NEXT: cmp r3, r8
50 ; CHECK-NEXT: bne .LBB0_2
51 ; CHECK-NEXT: @ %bb.7:
52 ; CHECK-NEXT: pop.w {r4, r5, r6, r7, r8, lr}
55 %cmp252 = icmp sgt i32 %n, 0
56 br i1 %cmp252, label %for.cond1.preheader.us, label %for.cond.cleanup
58 for.cond1.preheader.us: ; preds = %entry, %for.cond.cleanup14.us
59 %i.057.us = phi i32 [ %inc29.us, %for.cond.cleanup14.us ], [ 0, %entry ]
60 %mul.us = mul i32 %i.057.us, %n
61 br label %for.body4.us
63 for.cond.cleanup14.us: ; preds = %for.body15.us
64 %inc29.us = add nuw i32 %i.057.us, 1
65 %exitcond94 = icmp eq i32 %inc29.us, %n
66 br i1 %exitcond94, label %for.cond.cleanup, label %for.cond1.preheader.us
68 for.body15.us: ; preds = %for.body4.us, %for.body15.us
69 %j10.055.us = phi i32 [ %inc26.us, %for.body15.us ], [ 0, %for.body4.us ]
70 %arrayidx16.us = getelementptr inbounds i16, ptr %off, i32 %j10.055.us
71 %0 = load i16, ptr %arrayidx16.us, align 2
72 %arrayidx18.us = getelementptr inbounds i16, ptr %data, i32 %j10.055.us
73 %1 = load i16, ptr %arrayidx18.us, align 2
74 %add20.us = add i16 %1, %0
75 %add23.us = add i32 %j10.055.us, %mul.us
76 %arrayidx24.us = getelementptr inbounds i16, ptr %dst, i32 %add23.us
77 store i16 %add20.us, ptr %arrayidx24.us, align 2
78 %inc26.us = add nuw nsw i32 %j10.055.us, 1
79 %exitcond93 = icmp eq i32 %inc26.us, %n
80 br i1 %exitcond93, label %for.cond.cleanup14.us, label %for.body15.us
82 for.body4.us: ; preds = %for.body4.us, %for.cond1.preheader.us
83 %j.053.us = phi i32 [ 0, %for.cond1.preheader.us ], [ %inc.us, %for.body4.us ]
84 %arrayidx.us = getelementptr inbounds i16, ptr %off, i32 %j.053.us
85 %2 = load i16, ptr %arrayidx.us, align 2
86 %arrayidx5.us = getelementptr inbounds i16, ptr %data, i32 %j.053.us
87 %3 = load i16, ptr %arrayidx5.us, align 2
88 %add.us = add i16 %3, %2
89 %add8.us = add i32 %j.053.us, %mul.us
90 %arrayidx9.us = getelementptr inbounds i16, ptr %data, i32 %add8.us
91 store i16 %add.us, ptr %arrayidx9.us, align 2
92 %inc.us = add nuw nsw i32 %j.053.us, 1
93 %exitcond = icmp eq i32 %inc.us, %n
94 br i1 %exitcond, label %for.body15.us, label %for.body4.us
96 for.cond.cleanup: ; preds = %for.cond.cleanup14.us, %entry