1 ; RUN: llc -verify-machineinstrs < %s -relocation-model=pic | FileCheck %s
2 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"
3 target triple = "powerpc64-unknown-freebsd10.0"
5 @a = common global i32 0, align 4
7 define void @test1(i32 %c) nounwind {
11 for.body: ; preds = %for.body, %entry
12 %i.01 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
13 %0 = load volatile i32, ptr @a, align 4
14 %add = add nsw i32 %0, %c
15 store volatile i32 %add, ptr @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
20 for.end: ; preds = %for.body
23 ; CHECK-NOT: or 3, 3, 3
25 ; CHECK-NOT: addi {[0-9]+}
30 define void @test2(i32 %c, i32 %d) nounwind {
32 %cmp1 = icmp sgt i32 %d, 0
33 br i1 %cmp1, label %for.body, label %for.end
35 for.body: ; preds = %entry, %for.body
36 %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
37 %0 = load volatile i32, ptr @a, align 4
38 %add = add nsw i32 %0, %c
39 store volatile i32 %add, ptr @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
44 for.end: ; preds = %for.body, %entry
48 ; CHECK-NOT: addi {[0-9]+}
53 define void @test3(i32 %c, i32 %d) nounwind {
55 %cmp1 = icmp sgt i32 %d, 0
56 br i1 %cmp1, label %for.body, label %for.end
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, ptr @a, align 4
62 %add = add nsw i32 %0, %mul
63 store volatile i32 %add, ptr @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
68 for.end: ; preds = %for.body, %entry
72 ; CHECK-NOT: addi {[0-9]+}
77 @tls_var = external thread_local global i8
79 define i32 @test4(i32 %inp) {
83 for.body: ; preds = %for.body, %entry
84 %phi = phi i32 [ %dec, %for.body ], [ %inp, %entry ]
85 %load = ptrtoint ptr @tls_var to i32
86 %val = add i32 %load, %phi
87 %dec = add i32 %phi, -1
88 %cmp = icmp sgt i32 %phi, 1
89 br i1 %cmp, label %for.body, label %return
91 return: ; preds = %for.body
96 ; CHECK: __tls_get_addr