Merging r259740:
[oota-llvm.git] / test / CodeGen / PowerPC / ctrloop-asm.ll
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 define void @test1(i32 %c) nounwind {
6 entry:
7   br label %for.body
8
9 for.body:                                         ; preds = %for.body, %entry
10   %i.01 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
11   call void asm sideeffect "", "~{r5}"() nounwind
12   %inc = add nsw i32 %i.01, 1
13   %exitcond = icmp eq i32 %inc, 2048
14   br i1 %exitcond, label %for.end, label %for.body
15
16 for.end:                                          ; preds = %for.body
17   ret void
18 ; CHECK: @test1
19 ; CHECK: mtctr
20 }
21
22 define void @test2(i32 %c) nounwind {
23 entry:
24   br label %for.body
25
26 for.body:                                         ; preds = %for.body, %entry
27   %i.01 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
28   call void asm sideeffect "", "~{ctr}"() nounwind
29   %inc = add nsw i32 %i.01, 1
30   %exitcond = icmp eq i32 %inc, 2048
31   br i1 %exitcond, label %for.end, label %for.body
32
33 for.end:                                          ; preds = %for.body
34   ret void
35 ; CHECK: @test2
36 ; CHECK-NOT: mtctr
37 }
38