2017-08-02 06:20:49 +08:00
|
|
|
; RUN: llc -mtriple=arm-linux-gnueabi < %s \
|
2015-07-29 00:24:05 +08:00
|
|
|
; RUN: | FileCheck -check-prefix=CHECK-NONPIC -check-prefix=COMMON %s
|
2017-08-02 06:20:49 +08:00
|
|
|
; RUN: llc -mtriple=arm-linux-gnueabi -relocation-model=pic < %s \
|
2015-07-29 00:24:05 +08:00
|
|
|
; RUN: | FileCheck -check-prefix=CHECK-PIC -check-prefix=COMMON %s
|
2017-08-02 06:20:49 +08:00
|
|
|
; RUN: llc -emulated-tls -mtriple=arm-linux-gnueabi < %s \
|
2018-11-23 18:08:39 +08:00
|
|
|
; RUN: | FileCheck -check-prefix=EMU -check-prefix=COMMON %s
|
2017-08-02 06:20:49 +08:00
|
|
|
; RUN: llc -emulated-tls -mtriple=arm-linux-gnueabi -relocation-model=pic < %s \
|
2018-11-23 18:08:39 +08:00
|
|
|
; RUN: | FileCheck -check-prefix=EMU -check-prefix=COMMON %s
|
2012-06-23 19:37:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
@external_gd = external thread_local global i32
|
|
|
|
@internal_gd = internal thread_local global i32 42
|
|
|
|
|
|
|
|
@external_ld = external thread_local(localdynamic) global i32
|
|
|
|
@internal_ld = internal thread_local(localdynamic) global i32 42
|
|
|
|
|
|
|
|
@external_ie = external thread_local(initialexec) global i32
|
|
|
|
@internal_ie = internal thread_local(initialexec) global i32 42
|
|
|
|
|
|
|
|
@external_le = external thread_local(localexec) global i32
|
|
|
|
@internal_le = internal thread_local(localexec) global i32 42
|
|
|
|
|
|
|
|
; ----- no model specified -----
|
|
|
|
|
|
|
|
define i32* @f1() {
|
|
|
|
entry:
|
|
|
|
ret i32* @external_gd
|
|
|
|
|
2015-07-29 00:24:05 +08:00
|
|
|
; COMMON-LABEL: f1:
|
2012-06-23 19:37:03 +08:00
|
|
|
; Non-PIC code can use initial-exec, PIC code has to use general dynamic.
|
2013-12-05 06:43:20 +08:00
|
|
|
; CHECK-NONPIC: external_gd(GOTTPOFF)
|
|
|
|
; CHECK-PIC: external_gd(TLSGD)
|
2015-07-29 00:24:05 +08:00
|
|
|
; EMU: __emutls_get_address
|
2012-06-23 19:37:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
define i32* @f2() {
|
|
|
|
entry:
|
|
|
|
ret i32* @internal_gd
|
|
|
|
|
2015-07-29 00:24:05 +08:00
|
|
|
; COMMON-LABEL: f2:
|
2012-06-23 19:37:03 +08:00
|
|
|
; Non-PIC code can use local exec, PIC code can use local dynamic,
|
|
|
|
; but that is not implemented, so falls back to general dynamic.
|
2013-12-05 06:43:20 +08:00
|
|
|
; CHECK-NONPIC: internal_gd(TPOFF)
|
|
|
|
; CHECK-PIC: internal_gd(TLSGD)
|
2015-07-29 00:24:05 +08:00
|
|
|
; EMU: __emutls_get_address
|
2012-06-23 19:37:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
; ----- localdynamic specified -----
|
|
|
|
|
|
|
|
define i32* @f3() {
|
|
|
|
entry:
|
|
|
|
ret i32* @external_ld
|
|
|
|
|
2015-07-29 00:24:05 +08:00
|
|
|
; COMMON-LABEL: f3:
|
2012-06-23 19:37:03 +08:00
|
|
|
; Non-PIC code can use initial exec, PIC should use local dynamic,
|
|
|
|
; but that is not implemented, so falls back to general dynamic.
|
2013-12-05 06:43:20 +08:00
|
|
|
; CHECK-NONPIC: external_ld(GOTTPOFF)
|
|
|
|
; CHECK-PIC: external_ld(TLSGD)
|
2015-07-29 00:24:05 +08:00
|
|
|
; EMU: __emutls_get_address
|
2012-06-23 19:37:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
define i32* @f4() {
|
|
|
|
entry:
|
|
|
|
ret i32* @internal_ld
|
|
|
|
|
2015-07-29 00:24:05 +08:00
|
|
|
; COMMON-LABEL: f4:
|
2012-06-23 19:37:03 +08:00
|
|
|
; Non-PIC code can use local exec, PIC code can use local dynamic,
|
|
|
|
; but that is not implemented, so it falls back to general dynamic.
|
2013-12-05 06:43:20 +08:00
|
|
|
; CHECK-NONPIC: internal_ld(TPOFF)
|
|
|
|
; CHECK-PIC: internal_ld(TLSGD)
|
2015-07-29 00:24:05 +08:00
|
|
|
; EMU: __emutls_get_address
|
2012-06-23 19:37:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
; ----- initialexec specified -----
|
|
|
|
|
|
|
|
define i32* @f5() {
|
|
|
|
entry:
|
|
|
|
ret i32* @external_ie
|
|
|
|
|
2015-07-29 00:24:05 +08:00
|
|
|
; COMMON-LABEL: f5:
|
2012-06-23 19:37:03 +08:00
|
|
|
; Non-PIC and PIC code will use initial exec as specified.
|
2013-12-05 06:43:20 +08:00
|
|
|
; CHECK-NONPIC: external_ie(GOTTPOFF)
|
|
|
|
; CHECK-PIC: external_ie(GOTTPOFF)
|
2015-07-29 00:24:05 +08:00
|
|
|
; EMU: __emutls_get_address
|
2012-06-23 19:37:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
define i32* @f6() {
|
|
|
|
entry:
|
|
|
|
ret i32* @internal_ie
|
|
|
|
|
2015-07-29 00:24:05 +08:00
|
|
|
; COMMON-LABEL: f6:
|
2012-06-23 19:37:03 +08:00
|
|
|
; Non-PIC code can use local exec, PIC code use initial exec as specified.
|
2013-12-05 06:43:20 +08:00
|
|
|
; CHECK-NONPIC: internal_ie(TPOFF)
|
|
|
|
; CHECK-PIC: internal_ie(GOTTPOFF)
|
2015-07-29 00:24:05 +08:00
|
|
|
; EMU: __emutls_get_address
|
2012-06-23 19:37:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
; ----- localexec specified -----
|
|
|
|
|
|
|
|
define i32* @f7() {
|
|
|
|
entry:
|
|
|
|
ret i32* @external_le
|
|
|
|
|
2015-07-29 00:24:05 +08:00
|
|
|
; COMMON-LABEL: f7:
|
2012-06-23 19:37:03 +08:00
|
|
|
; Non-PIC and PIC code will use local exec as specified.
|
2013-12-05 06:43:20 +08:00
|
|
|
; CHECK-NONPIC: external_le(TPOFF)
|
|
|
|
; CHECK-PIC: external_le(TPOFF)
|
2015-07-29 00:24:05 +08:00
|
|
|
; EMU: __emutls_get_address
|
2012-06-23 19:37:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
define i32* @f8() {
|
|
|
|
entry:
|
|
|
|
ret i32* @internal_le
|
|
|
|
|
2015-07-29 00:24:05 +08:00
|
|
|
; COMMON-LABEL: f8:
|
2012-06-23 19:37:03 +08:00
|
|
|
; Non-PIC and PIC code will use local exec as specified.
|
2013-12-05 06:43:20 +08:00
|
|
|
; CHECK-NONPIC: internal_le(TPOFF)
|
|
|
|
; CHECK-PIC: internal_le(TPOFF)
|
2015-07-29 00:24:05 +08:00
|
|
|
; EMU: __emutls_get_address
|
2012-06-23 19:37:03 +08:00
|
|
|
}
|
2015-07-29 00:24:05 +08:00
|
|
|
|
|
|
|
|
|
|
|
; ----- emulated specified -----
|
|
|
|
|
|
|
|
; External declaration has no initializer.
|
|
|
|
; Internal definition has initializer.
|
|
|
|
|
|
|
|
; EMU-NOT: __emutls_t.external_gd
|
|
|
|
; EMU-NOT: __emutls_v.external_gd
|
2016-01-26 08:03:25 +08:00
|
|
|
; EMU: .p2align 2
|
2015-07-29 00:24:05 +08:00
|
|
|
; EMU-LABEL: __emutls_v.internal_gd:
|
|
|
|
; EMU-NEXT: .long 4
|
|
|
|
; EMU-NEXT: .long 4
|
|
|
|
; EMU-NEXT: .long 0
|
|
|
|
; EMU-NEXT: .long __emutls_t.internal_gd
|
|
|
|
; EMU-LABEL: __emutls_t.internal_gd:
|
|
|
|
; EMU-NEXT: .long 42
|
|
|
|
; EMU-NOT: __emutls_t.external_gd
|
|
|
|
|
|
|
|
; __emutls_t and __emutls_v are the same for PIC and non-PIC modes.
|
|
|
|
|
|
|
|
; EMU-NOT: __emutls_t.external_gd
|
|
|
|
; EMU-NOT: __emutls_v.external_gd
|
2016-01-26 08:03:25 +08:00
|
|
|
; EMU: .p2align 2
|
2015-07-29 00:24:05 +08:00
|
|
|
; EMU-LABEL: __emutls_v.internal_le:
|
|
|
|
; EMU-NEXT: .long 4
|
|
|
|
; EMU-NEXT: .long 4
|
|
|
|
; EMU-NEXT: .long 0
|
|
|
|
; EMU-NEXT: .long __emutls_t.internal_le
|
|
|
|
; EMU-LABEL: __emutls_t.internal_le:
|
|
|
|
; EMU-NEXT: .long 42
|
|
|
|
; EMU-NOT: __emutls_t.external_le
|