2009-09-08 23:54:48 +00:00
|
|
|
; RUN: llc < %s -march=x86 -mtriple=i386-linux-gnu -relocation-model=pic | FileCheck -check-prefix=X32 %s
|
|
|
|
; RUN: llc < %s -march=x86-64 -mtriple=x86_64-linux-gnu -relocation-model=pic | FileCheck -check-prefix=X64 %s
|
2009-02-27 13:37:18 +00:00
|
|
|
|
|
|
|
@i = thread_local global i32 15
|
2012-06-01 16:27:21 +00:00
|
|
|
@j = internal thread_local global i32 42
|
|
|
|
@k = internal thread_local global i32 42
|
2009-02-27 13:37:18 +00:00
|
|
|
|
2009-08-07 23:56:42 +00:00
|
|
|
define i32 @f1() {
|
2009-02-27 13:37:18 +00:00
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load i32, i32* @i
|
2009-02-27 13:37:18 +00:00
|
|
|
ret i32 %tmp1
|
|
|
|
}
|
2009-08-07 23:56:42 +00:00
|
|
|
|
2013-07-14 06:24:09 +00:00
|
|
|
; X32-LABEL: f1:
|
2009-08-07 23:56:42 +00:00
|
|
|
; X32: leal i@TLSGD(,%ebx), %eax
|
2010-11-27 20:43:02 +00:00
|
|
|
; X32: calll ___tls_get_addr@PLT
|
2009-08-07 23:56:42 +00:00
|
|
|
|
2013-07-14 06:24:09 +00:00
|
|
|
; X64-LABEL: f1:
|
2009-08-07 23:56:42 +00:00
|
|
|
; X64: leaq i@TLSGD(%rip), %rdi
|
2010-11-27 20:43:02 +00:00
|
|
|
; X64: callq __tls_get_addr@PLT
|
2009-08-07 23:56:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
@i2 = external thread_local global i32
|
|
|
|
|
|
|
|
define i32* @f2() {
|
|
|
|
entry:
|
|
|
|
ret i32* @i
|
|
|
|
}
|
|
|
|
|
2013-07-14 06:24:09 +00:00
|
|
|
; X32-LABEL: f2:
|
2009-08-07 23:56:42 +00:00
|
|
|
; X32: leal i@TLSGD(,%ebx), %eax
|
2010-11-27 20:43:02 +00:00
|
|
|
; X32: calll ___tls_get_addr@PLT
|
2009-08-07 23:56:42 +00:00
|
|
|
|
2013-07-14 06:24:09 +00:00
|
|
|
; X64-LABEL: f2:
|
2009-08-07 23:56:42 +00:00
|
|
|
; X64: leaq i@TLSGD(%rip), %rdi
|
2010-11-27 20:43:02 +00:00
|
|
|
; X64: callq __tls_get_addr@PLT
|
2009-08-07 23:56:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
define i32 @f3() {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%tmp1 = load i32, i32* @i ; <i32> [#uses=1]
|
2009-08-07 23:56:42 +00:00
|
|
|
ret i32 %tmp1
|
|
|
|
}
|
|
|
|
|
2013-07-14 06:24:09 +00:00
|
|
|
; X32-LABEL: f3:
|
2009-08-07 23:56:42 +00:00
|
|
|
; X32: leal i@TLSGD(,%ebx), %eax
|
2010-11-27 20:43:02 +00:00
|
|
|
; X32: calll ___tls_get_addr@PLT
|
2009-08-07 23:56:42 +00:00
|
|
|
|
2013-07-14 06:24:09 +00:00
|
|
|
; X64-LABEL: f3:
|
2009-08-07 23:56:42 +00:00
|
|
|
; X64: leaq i@TLSGD(%rip), %rdi
|
2010-11-27 20:43:02 +00:00
|
|
|
; X64: callq __tls_get_addr@PLT
|
2009-08-07 23:56:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
define i32* @f4() nounwind {
|
|
|
|
entry:
|
|
|
|
ret i32* @i
|
|
|
|
}
|
|
|
|
|
2013-07-14 06:24:09 +00:00
|
|
|
; X32-LABEL: f4:
|
2009-08-07 23:56:42 +00:00
|
|
|
; X32: leal i@TLSGD(,%ebx), %eax
|
2010-11-27 20:43:02 +00:00
|
|
|
; X32: calll ___tls_get_addr@PLT
|
2009-08-07 23:56:42 +00:00
|
|
|
|
2013-07-14 06:24:09 +00:00
|
|
|
; X64-LABEL: f4:
|
2009-08-07 23:56:42 +00:00
|
|
|
; X64: leaq i@TLSGD(%rip), %rdi
|
2010-11-27 20:43:02 +00:00
|
|
|
; X64: callq __tls_get_addr@PLT
|
2009-08-07 23:56:42 +00:00
|
|
|
|
|
|
|
|
2012-06-01 16:27:21 +00:00
|
|
|
define i32 @f5() nounwind {
|
|
|
|
entry:
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load i32, i32* @j, align 4
|
|
|
|
%1 = load i32, i32* @k, align 4
|
2012-06-01 16:27:21 +00:00
|
|
|
%add = add nsw i32 %0, %1
|
|
|
|
ret i32 %add
|
|
|
|
}
|
2009-08-07 23:56:42 +00:00
|
|
|
|
2013-07-14 06:24:09 +00:00
|
|
|
; X32-LABEL: f5:
|
2012-06-07 18:39:19 +00:00
|
|
|
; X32: leal {{[jk]}}@TLSLDM(%ebx)
|
2012-09-06 18:15:23 +00:00
|
|
|
; X32: calll ___tls_get_addr@PLT
|
|
|
|
; X32: movl {{[jk]}}@DTPOFF(%e
|
|
|
|
; X32: addl {{[jk]}}@DTPOFF(%e
|
2012-06-01 16:27:21 +00:00
|
|
|
|
2013-07-14 06:24:09 +00:00
|
|
|
; X64-LABEL: f5:
|
2012-06-01 16:27:21 +00:00
|
|
|
; X64: leaq {{[jk]}}@TLSLD(%rip), %rdi
|
2012-09-06 18:15:23 +00:00
|
|
|
; X64: callq __tls_get_addr@PLT
|
|
|
|
; X64: movl {{[jk]}}@DTPOFF(%r
|
|
|
|
; X64: addl {{[jk]}}@DTPOFF(%r
|