blob: 6b9d31e2d99fe03ce8bebcbb104e66f888569023 [file] [log] [blame]
Eric Christophercee313d2019-04-17 04:52:47 +00001; RUN: opt < %s -S -mtriple=powerpc64-unknown-linux-gnu -mcpu=a2 -loop-unroll -unroll-runtime-epilog=true | FileCheck %s -check-prefix=EPILOG
2; RUN: opt < %s -S -mtriple=powerpc64-unknown-linux-gnu -mcpu=a2 -loop-unroll -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG
3
4define i32 @test(i32* nocapture %a, i32 %n) nounwind uwtable readonly {
5entry:
6 %cmp1 = icmp eq i32 %n, 0
7 br i1 %cmp1, label %for.end, label %for.body
8
9for.body: ; preds = %for.body, %entry
10 %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
11 %sum.02 = phi i32 [ %add, %for.body ], [ 0, %entry ]
12 %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
13 %0 = load i32, i32* %arrayidx, align 4
14 %add = add nsw i32 %0, %sum.02
15 %indvars.iv.next = add i64 %indvars.iv, 1
16 %lftr.wideiv = trunc i64 %indvars.iv.next to i32
17 %exitcond = icmp eq i32 %lftr.wideiv, %n
18 br i1 %exitcond, label %for.end, label %for.body
19
20for.end: ; preds = %for.body, %entry
21 %sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
22 ret i32 %sum.0.lcssa
23}
24
25; EPILOG-LABEL: @test
26; EPILOG: for.body:
27; EPILOG: br i1 %niter.ncmp.7, label %for.end.loopexit{{.*}}, label %for.body
28; EPILOG: for.body.epil{{.*}}:
29
30; PROLOG-LABEL: @test
31; PROLOG: for.body.prol{{.*}}:
32; PROLOG: for.body:
33; PROLOG: br i1 %exitcond.7, label %for.end.loopexit{{.*}}, label %for.body
34