Home | History | Annotate | Download | only in AArch64
      1 ; RUN: opt < %s -S -loop-unroll -mtriple aarch64 -mcpu=cortex-a57 | FileCheck %s -check-prefix=EPILOG
      2 ; RUN: opt < %s -S -loop-unroll -mtriple aarch64 -mcpu=cortex-a57 -unroll-runtime-epilog=false | FileCheck %s -check-prefix=PROLOG
      3 
      4 ; Tests for unrolling loops with run-time trip counts
      5 
      6 ; EPILOG:  %xtraiter = and i32 %n
      7 ; EPILOG:  for.body:
      8 ; EPILOG:  %lcmp.mod = icmp ne i32 %xtraiter, 0
      9 ; EPILOG:  br i1 %lcmp.mod, label %for.body.epil.preheader, label %for.end.loopexit
     10 ; EPILOG:  for.body.epil:
     11 
     12 ; PROLOG:  %xtraiter = and i32 %n
     13 ; PROLOG:  %lcmp.mod = icmp ne i32 %xtraiter, 0
     14 ; PROLOG:  br i1 %lcmp.mod, label %for.body.prol.preheader, label %for.body.prol.loopexit
     15 ; PROLOG:  for.body.prol:
     16 ; PROLOG:  for.body:
     17 
     18 define i32 @test(i32* nocapture %a, i32 %n) nounwind uwtable readonly {
     19 entry:
     20   %cmp1 = icmp eq i32 %n, 0
     21   br i1 %cmp1, label %for.end, label %for.body
     22 
     23 for.body:                                         ; preds = %for.body, %entry
     24   %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
     25   %sum.02 = phi i32 [ %add, %for.body ], [ 0, %entry ]
     26   %arrayidx = getelementptr inbounds i32, i32* %a, i64 %indvars.iv
     27   %0 = load i32, i32* %arrayidx, align 4
     28   %add = add nsw i32 %0, %sum.02
     29   %indvars.iv.next = add i64 %indvars.iv, 1
     30   %lftr.wideiv = trunc i64 %indvars.iv.next to i32
     31   %exitcond = icmp eq i32 %lftr.wideiv, %n
     32   br i1 %exitcond, label %for.end, label %for.body
     33 
     34 for.end:                                          ; preds = %for.body, %entry
     35   %sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
     36   ret i32 %sum.0.lcssa
     37 }
     38 
     39 
     40