• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mtriple=i686-pc-linux-gnu -asm-verbose=false \
2; RUN: -relocation-model=pic | FileCheck %s
3
4@thread_var = thread_local global i32 42, align 4
5@thread_alias = thread_local(localdynamic) alias i32, i32* @thread_var
6
7; CHECK-LABEL: get_thread_var
8define i32* @get_thread_var() {
9; CHECK: leal    thread_var@TLSGD
10  ret i32* @thread_var
11}
12
13; CHECK-LABEL: get_thread_alias
14define i32* @get_thread_alias() {
15; CHECK: leal    thread_alias@TLSLD
16  ret i32* @thread_alias
17}
18
19@bar = global i32 42
20
21; CHECK-DAG: .globl	foo1
22@foo1 = alias i32, i32* @bar
23
24; CHECK-DAG: .globl	foo2
25@foo2 = alias i32, i32* @bar
26
27%FunTy = type i32()
28
29define i32 @foo_f() {
30  ret i32 0
31}
32; CHECK-DAG: .weak	bar_f
33@bar_f = weak alias %FunTy, %FunTy* @foo_f
34
35@bar_l = linkonce_odr alias i32, i32* @bar
36; CHECK-DAG: .weak	bar_l
37
38@bar_i = internal alias i32, i32* @bar
39
40; CHECK-DAG: .globl	A
41@A = alias i64, bitcast (i32* @bar to i64*)
42
43; CHECK-DAG: .globl	bar_h
44; CHECK-DAG: .hidden	bar_h
45@bar_h = hidden alias i32, i32* @bar
46
47; CHECK-DAG: .globl	bar_p
48; CHECK-DAG: .protected	bar_p
49@bar_p = protected alias i32, i32* @bar
50
51; CHECK-DAG: .set test2, bar+4
52@test2 = alias i32, getelementptr(i32, i32* @bar, i32 1)
53
54; CHECK-DAG: .set test3, 42
55@test3 = alias i32, inttoptr(i32 42 to i32*)
56
57; CHECK-DAG: .set test4, bar
58@test4 = alias i32, inttoptr(i64 ptrtoint (i32* @bar to i64) to i32*)
59
60; CHECK-DAG: .set test5, test2-bar
61@test5 = alias i32, inttoptr(i32 sub (i32 ptrtoint (i32* @test2 to i32),
62                                 i32 ptrtoint (i32* @bar to i32)) to i32*)
63
64; CHECK-DAG: .globl	test
65define i32 @test() {
66entry:
67   %tmp = load i32, i32* @foo1
68   %tmp1 = load i32, i32* @foo2
69   %tmp0 = load i32, i32* @bar_i
70   %tmp2 = call i32 @foo_f()
71   %tmp3 = add i32 %tmp, %tmp2
72   %tmp4 = call i32 @bar_f()
73   %tmp5 = add i32 %tmp3, %tmp4
74   %tmp6 = add i32 %tmp1, %tmp5
75   %tmp7 = add i32 %tmp6, %tmp0
76   ret i32 %tmp7
77}
78