blob: b83416d4b32b84af0b7074bd675c63cbe0890146 [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
Rafael Espindola5bf7c532010-11-27 20:43:02 +000014; X32: calll ___tls_get_addr@PLT
Chris Lattnereed46572009-08-07 23:56:42 +000015
16; X64: f1:
17; X64: leaq i@TLSGD(%rip), %rdi
Rafael Espindola5bf7c532010-11-27 20:43:02 +000018; X64: callq __tls_get_addr@PLT
Chris Lattnereed46572009-08-07 23:56:42 +000019
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
Rafael Espindola5bf7c532010-11-27 20:43:02 +000030; X32: calll ___tls_get_addr@PLT
Chris Lattnereed46572009-08-07 23:56:42 +000031
32; X64: f2:
33; X64: leaq i@TLSGD(%rip), %rdi
Rafael Espindola5bf7c532010-11-27 20:43:02 +000034; X64: callq __tls_get_addr@PLT
Chris Lattnereed46572009-08-07 23:56:42 +000035
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
Rafael Espindola5bf7c532010-11-27 20:43:02 +000046; X32: calll ___tls_get_addr@PLT
Chris Lattnereed46572009-08-07 23:56:42 +000047
48; X64: f3:
49; X64: leaq i@TLSGD(%rip), %rdi
Rafael Espindola5bf7c532010-11-27 20:43:02 +000050; X64: callq __tls_get_addr@PLT
Chris Lattnereed46572009-08-07 23:56:42 +000051
52
53define i32* @f4() nounwind {
54entry:
55 ret i32* @i
56}
57
58; X32: f4:
59; X32: leal i@TLSGD(,%ebx), %eax
Rafael Espindola5bf7c532010-11-27 20:43:02 +000060; X32: calll ___tls_get_addr@PLT
Chris Lattnereed46572009-08-07 23:56:42 +000061
62; X64: f4:
63; X64: leaq i@TLSGD(%rip), %rdi
Rafael Espindola5bf7c532010-11-27 20:43:02 +000064; X64: callq __tls_get_addr@PLT
Chris Lattnereed46572009-08-07 23:56:42 +000065
66
67