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