1; RUN: llc -mtriple=thumbv7-linux-gnueabihf -relocation-model=pic %s -o - | FileCheck %s
2
3@var = thread_local global i32 0, align 4
4
5define void @func(i32 %n) {
6; CHECK-LABEL: func:
7; CHECK: ldr [[REF1:r[0-9]+]], [[CP1:.LCPI[0-9]+_[0-9]+]]
8; CHECK: ldr [[REF2:r[0-9]+]], [[CP2:.LCPI[0-9]+_[0-9]+]]
9
10; CHECK: [[PCPOS1:.LPC[0-9]+_[0-9]+]]:
11; CHECK-NEXT: add [[REF1]], pc
12
13; CHECK: [[PCPOS2:.LPC[0-9]+_[0-9]+]]:
14; CHECK-NEXT: add [[REF2]], pc
15
16; CHECK: [[CP1]]:
17; CHECK-NEXT: [[CP1_TMP:.Ltmp[0-9]+]]:
18; CHECK-NEXT:     .long var(TLSGD)-(([[PCPOS1]]+4)-[[CP1_TMP]])
19
20; CHECK: [[CP2]]:
21; CHECK-NEXT: [[CP2_TMP:.Ltmp[0-9]+]]:
22; CHECK-NEXT:     .long var(TLSGD)-(([[PCPOS2]]+4)-[[CP2_TMP]])
23
24entry:
25  br label %loop
26
27loop:
28  %i = phi i32 [ %inc, %next ], [ 0, %entry ]
29  %val = load i32, i32* @var
30  %tst = icmp eq i32 %val, 0
31  br i1 %tst, label %next, label %call
32
33call:
34  tail call void @foo(i32* nonnull @var) #2
35  br label %next
36
37next:
38  %inc = add i32 %i, 1
39  %stop = icmp eq i32 %inc, %n
40  br i1 %stop, label %done, label %loop
41
42done:
43  ret void
44}
45
46declare void @foo(i32*)