Home | History | Annotate | Download | only in PowerPC
      1 ; RUN: opt < %s -S -mtriple=powerpc64-unknown-linux-gnu -mcpu=a2 -loop-unroll | FileCheck %s
      2 define void @unroll_opt_for_size() nounwind optsize {
      3 entry:
      4   br label %loop
      5 
      6 loop:
      7   %iv = phi i32 [ 0, %entry ], [ %inc, %loop ]
      8   %inc = add i32 %iv, 1
      9   %exitcnd = icmp uge i32 %inc, 1024
     10   br i1 %exitcnd, label %exit, label %loop
     11 
     12 exit:
     13   ret void
     14 }
     15 
     16 ; CHECK-LABEL: @unroll_opt_for_size
     17 ; CHECK:      add
     18 ; CHECK-NEXT: add
     19 ; CHECK-NEXT: add
     20 ; CHECK: icmp
     21 
     22 define i32 @test(i32* nocapture %a, i32 %n) nounwind uwtable readonly {
     23 entry:
     24   %cmp1 = icmp eq i32 %n, 0
     25   br i1 %cmp1, label %for.end, label %for.body
     26 
     27 for.body:                                         ; preds = %for.body, %entry
     28   %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
     29   %sum.02 = phi i32 [ %add, %for.body ], [ 0, %entry ]
     30   %arrayidx = getelementptr inbounds i32* %a, i64 %indvars.iv
     31   %0 = load i32* %arrayidx, align 4
     32   %add = add nsw i32 %0, %sum.02
     33   %indvars.iv.next = add i64 %indvars.iv, 1
     34   %lftr.wideiv = trunc i64 %indvars.iv.next to i32
     35   %exitcond = icmp eq i32 %lftr.wideiv, %n
     36   br i1 %exitcond, label %for.end, label %for.body
     37 
     38 for.end:                                          ; preds = %for.body, %entry
     39   %sum.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.body ]
     40   ret i32 %sum.0.lcssa
     41 }
     42 
     43 ; CHECK-LABEL: @test
     44 ; CHECK: unr.cmp{{.*}}:
     45 ; CHECK: for.body.unr{{.*}}:
     46 ; CHECK: for.body:
     47 ; CHECK: br i1 %exitcond.7, label %for.end.loopexit{{.*}}, label %for.body
     48 
     49