• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Test local-dynamic TLS accesses.
2;
3; RUN: llc < %s -mcpu=z10 -mtriple=s390x-linux-gnu -relocation-model=pic | FileCheck %s -check-prefix=CHECK-MAIN
4; RUN: llc < %s -mcpu=z10 -mtriple=s390x-linux-gnu -relocation-model=pic | FileCheck %s -check-prefix=CHECK-CP
5
6@x = thread_local(localdynamic) global i32 0
7
8; Call __tls_get_offset to retrieve the module's TLS base offset.
9; Add the per-symbol offset and the thread pointer.
10define i32 *@foo() {
11; CHECK-CP: .LCP{{.*}}_0:
12; CHECK-CP: .quad x@TLSLDM
13; CHECK-CP: .LCP{{.*}}_1:
14; CHECK-CP: .quad x@DTPOFF
15;
16; CHECK-MAIN-LABEL: foo:
17; CHECK-MAIN-DAG: larl %r12, _GLOBAL_OFFSET_TABLE_
18; CHECK-MAIN-DAG: lgrl %r2, .LCP{{.*}}_0
19; CHECK-MAIN: brasl %r14, __tls_get_offset@PLT:tls_ldcall:x
20; CHECK-MAIN: larl %r1, .LCP{{.*}}_1
21; CHECK-MAIN: ag %r2, 0(%r1)
22; CHECK-MAIN: ear [[HIGH:%r[0-5]]], %a0
23; CHECK-MAIN: sllg [[TP:%r[0-5]]], [[HIGH]], 32
24; CHECK-MAIN: ear [[TP]], %a1
25; CHECK-MAIN: agr %r2, [[TP]]
26; CHECK-MAIN: br %r14
27  ret i32 *@x
28}
29