1 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v128:128:128-n32:64" 2 target triple = "powerpc64-unknown-freebsd10.0" 3 ; RUN: llc < %s -march=ppc64 | FileCheck %s 4 5 @a = common global i32 0, align 4 6 7 define void @test1(i32 %c) nounwind { 8 entry: 9 br label %for.body 10 11 for.body: ; preds = %for.body, %entry 12 %i.01 = phi i32 [ 0, %entry ], [ %inc, %for.body ] 13 %0 = load volatile i32* @a, align 4 14 %add = add nsw i32 %0, %c 15 store volatile i32 %add, i32* @a, align 4 16 %inc = add nsw i32 %i.01, 1 17 %exitcond = icmp eq i32 %inc, 2048 18 br i1 %exitcond, label %for.end, label %for.body 19 20 for.end: ; preds = %for.body 21 ret void 22 ; CHECK: @test1 23 ; CHECK-NOT: or 3, 3, 3 24 ; CHECK: mtctr 25 ; CHECK-NOT: addi {[0-9]+} 26 ; CHECK-NOT: cmplwi 27 ; CHECK: bdnz 28 } 29 30 define void @test2(i32 %c, i32 %d) nounwind { 31 entry: 32 %cmp1 = icmp sgt i32 %d, 0 33 br i1 %cmp1, label %for.body, label %for.end 34 35 for.body: ; preds = %entry, %for.body 36 %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ] 37 %0 = load volatile i32* @a, align 4 38 %add = add nsw i32 %0, %c 39 store volatile i32 %add, i32* @a, align 4 40 %inc = add nsw i32 %i.02, 1 41 %exitcond = icmp eq i32 %inc, %d 42 br i1 %exitcond, label %for.end, label %for.body 43 44 for.end: ; preds = %for.body, %entry 45 ret void 46 ; CHECK: @test2 47 ; CHECK: mtctr 48 ; CHECK-NOT: addi {[0-9]+} 49 ; CHECK-NOT: cmplwi 50 ; CHECK: bdnz 51 } 52 53 define void @test3(i32 %c, i32 %d) nounwind { 54 entry: 55 %cmp1 = icmp sgt i32 %d, 0 56 br i1 %cmp1, label %for.body, label %for.end 57 58 for.body: ; preds = %entry, %for.body 59 %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ] 60 %mul = mul nsw i32 %i.02, %c 61 %0 = load volatile i32* @a, align 4 62 %add = add nsw i32 %0, %mul 63 store volatile i32 %add, i32* @a, align 4 64 %inc = add nsw i32 %i.02, 1 65 %exitcond = icmp eq i32 %inc, %d 66 br i1 %exitcond, label %for.end, label %for.body 67 68 for.end: ; preds = %for.body, %entry 69 ret void 70 ; CHECK: @test3 71 ; CHECK: mtctr 72 ; CHECK-NOT: addi {[0-9]+} 73 ; CHECK-NOT: cmplwi 74 ; CHECK: bdnz 75 } 76