blob: 4cad8376d8d9ddd2019f220e317a48aec77aa866 [file] [log] [blame]
Dan Gohman36a09472009-09-08 23:54:48 +00001; RUN: llc < %s -march=x86 -mtriple=i386-linux-gnu -relocation-model=pic | FileCheck -check-prefix=X32 %s
2; RUN: llc < %s -march=x86-64 -mtriple=x86_64-linux-gnu -relocation-model=pic | FileCheck -check-prefix=X64 %s
Rafael Espindola9a580232009-02-27 13:37:18 +00003
4@i = thread_local global i32 15
5
Chris Lattnereed46572009-08-07 23:56:42 +00006define i32 @f1() {
Rafael Espindola9a580232009-02-27 13:37:18 +00007entry:
8 %tmp1 = load i32* @i
9 ret i32 %tmp1
10}
Chris Lattnereed46572009-08-07 23:56:42 +000011
12; X32: f1:
13; X32: leal i@TLSGD(,%ebx), %eax
14; X32: call ___tls_get_addr@PLT
15
16; X64: f1:
17; X64: leaq i@TLSGD(%rip), %rdi
18; X64: call __tls_get_addr@PLT
19
20
21@i2 = external thread_local global i32
22
23define i32* @f2() {
24entry:
25 ret i32* @i
26}
27
28; X32: f2:
29; X32: leal i@TLSGD(,%ebx), %eax
30; X32: call ___tls_get_addr@PLT
31
32; X64: f2:
33; X64: leaq i@TLSGD(%rip), %rdi
34; X64: call __tls_get_addr@PLT
35
36
37
38define i32 @f3() {
39entry:
40 %tmp1 = load i32* @i ; <i32> [#uses=1]
41 ret i32 %tmp1
42}
43
44; X32: f3:
45; X32: leal i@TLSGD(,%ebx), %eax
46; X32: call ___tls_get_addr@PLT
47
48; X64: f3:
49; X64: leaq i@TLSGD(%rip), %rdi
50; X64: call __tls_get_addr@PLT
51
52
53define i32* @f4() nounwind {
54entry:
55 ret i32* @i
56}
57
58; X32: f4:
59; X32: leal i@TLSGD(,%ebx), %eax
60; X32: call ___tls_get_addr@PLT
61
62; X64: f4:
63; X64: leaq i@TLSGD(%rip), %rdi
64; X64: call __tls_get_addr@PLT
65
66
67