1; RUN: llc < %s -emulated-tls -mtriple=powerpc64-unknown-linux-gnu -relocation-model=pic \
2; RUN:     | FileCheck %s
3; RUN: llc < %s -emulated-tls -mtriple=powerpc-unknown-linux-gnu -relocation-model=pic \
4; RUN:     | FileCheck %s
5
6; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -relocation-model=pic \
7; RUN:     | FileCheck -check-prefix=NoEMU %s
8; RUN: llc < %s -mtriple=powerpc-unknown-linux-gnu -relocation-model=pic \
9; RUN:     | FileCheck -check-prefix=NoEMU %s
10
11; NoEMU-NOT: __emutls
12
13; Make sure that TLS symbols are emitted in expected order.
14
15@external_x = external thread_local global i32, align 8
16@external_y = thread_local global i8 7, align 2
17@internal_y = internal thread_local global i64 9, align 16
18
19define i32* @get_external_x() {
20entry:
21  ret i32* @external_x
22}
23
24define i8* @get_external_y() {
25entry:
26  ret i8* @external_y
27}
28
29define i64* @get_internal_y() {
30entry:
31  ret i64* @internal_y
32}
33
34; CHECK-LABEL: get_external_x:
35; CHECK-NOT:   _tls_get_address
36; CHECK:       __emutls_get_address
37; CHECK-LABEL: get_external_y:
38; CHECK:       __emutls_get_address
39; CHECK-NOT:   _tls_get_address
40; CHECK-LABEL: get_internal_y:
41; CHECK-NOT:   __emutls_t.external_x:
42; CHECK-NOT:   __emutls_v.external_x:
43; CHECK-LABEL: __emutls_v.external_y:
44; CHECK-LABEL: __emutls_t.external_y:
45; CHECK:       __emutls_t.external_y
46; CHECK-LABEL: __emutls_v.internal_y:
47; CHECK-LABEL: __emutls_t.internal_y:
48; CHECK:       __emutls_t.internal_y
49