1; Test general-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 global i32 0
7
8; Call __tls_get_offset to retrieve the symbol's TLS offset.
9define i32 *@foo() {
10; CHECK-CP: .LCP{{.*}}:
11; CHECK-CP: .quad x@TLSGD
12;
13; CHECK-MAIN-LABEL: foo:
14; CHECK-MAIN-DAG: larl %r12, _GLOBAL_OFFSET_TABLE_
15; CHECK-MAIN-DAG: lgrl %r2, .LCP{{.*}}
16; CHECK-MAIN: brasl %r14, __tls_get_offset@PLT:tls_gdcall:x
17; CHECK-MAIN: ear [[HIGH:%r[0-5]]], %a0
18; CHECK-MAIN: sllg [[TP:%r[0-5]]], [[HIGH]], 32
19; CHECK-MAIN: ear [[TP]], %a1
20; CHECK-MAIN: agr %r2, [[TP]]
21; CHECK-MAIN: br %r14
22  ret i32 *@x
23}
24