1 ; RUN: llc < %s -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr9 -verify-machineinstrs | FileCheck %s 2 ; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr9 -verify-machineinstrs | FileCheck %s 3 ; RUN: llc < %s -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 -verify-machineinstrs | FileCheck %s 4 ; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 -verify-machineinstrs | FileCheck %s 5 6 ; Function Attrs: norecurse nounwind readonly 7 define signext i32 @limit_loop(i32 signext %iters, i32* nocapture readonly %vec, i32 signext %limit) local_unnamed_addr { 8 entry: 9 %cmp5 = icmp sgt i32 %iters, 0 10 br i1 %cmp5, label %for.body.preheader, label %cleanup 11 12 for.body.preheader: ; preds = %entry 13 %0 = sext i32 %iters to i64 14 br label %for.body 15 16 for.cond: ; preds = %for.body 17 %cmp = icmp slt i64 %indvars.iv.next, %0 18 br i1 %cmp, label %for.body, label %cleanup 19 20 for.body: ; preds = %for.body.preheader, %for.cond 21 %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ] 22 %arrayidx = getelementptr inbounds i32, i32* %vec, i64 %indvars.iv 23 %1 = load i32, i32* %arrayidx, align 4 24 %cmp1 = icmp slt i32 %1, %limit 25 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 26 br i1 %cmp1, label %for.cond, label %cleanup 27 28 cleanup: ; preds = %for.body, %for.cond, %entry 29 %2 = phi i32 [ 0, %entry ], [ 0, %for.cond ], [ 1, %for.body ] 30 ret i32 %2 31 ; CHECK-LABEL: limit_loop 32 ; CHECK: mtctr 33 ; CHECK-NOT: addi {{[0-9]+}}, {{[0-9]+}}, 1 34 ; CHECK: bdnz 35 ; CHECK: blr 36 } 37 38 39