1; RUN: llc < %s -emulated-tls -mtriple=arm-linux-android -relocation-model=pic \
2; RUN:     | FileCheck -check-prefix=ARM_32 %s
3; RUN: llc < %s -emulated-tls -mtriple=arm-linux-androidabi -relocation-model=pic \
4; RUN:     | FileCheck -check-prefix=ARM_32 %s
5; RUN: llc < %s -emulated-tls -mtriple=arm-linux-androidabi -relocation-model=pic -O3 \
6; RUN:     | FileCheck -check-prefix=ARM_32 %s
7; RUN: llc < %s -emulated-tls -mtriple=arm-linux-androidabi -O3 \
8; RUN:     | FileCheck -check-prefix=ARM_32 %s
9
10; Make sure that TLS symbols are emitted in expected order.
11
12@external_x = external thread_local global i32, align 8
13@external_y = thread_local global i8 7, align 2
14@internal_y = internal thread_local global i64 9, align 16
15
16define i32* @get_external_x() {
17entry:
18  ret i32* @external_x
19}
20
21define i8* @get_external_y() {
22entry:
23  ret i8* @external_y
24}
25
26define i64* @get_internal_y() {
27entry:
28  ret i64* @internal_y
29}
30
31; ARM_32-LABEL:  get_external_x:
32; ARM_32:        bl __emutls_get_address
33; ARM_32:        .long __emutls_v.external_x
34; ARM_32-LABEL:  get_external_y:
35; ARM_32:        bl __emutls_get_address
36; ARM_32:        .long __emutls_v.external_y
37; ARM_32-LABEL:  get_internal_y:
38; ARM_32:        bl __emutls_get_address
39; ARM_32:        .long __emutls_v.internal_y
40; ARM_32-NOT:    __emutls_t.external_x
41; ARM_32-NOT:    __emutls_v.external_x:
42; ARM_32:        .data{{$}}
43; ARM_32:        .globl __emutls_v.external_y
44; ARM_32:        .p2align 2
45; ARM_32-LABEL:  __emutls_v.external_y:
46; ARM_32-NEXT:   .long 1
47; ARM_32-NEXT:   .long 2
48; ARM_32-NEXT:   .long 0
49; ARM_32-NEXT:   .long __emutls_t.external_y
50; ARM_32:        .section .rodata,
51; ARM_32-LABEL:  __emutls_t.external_y:
52; ARM_32-NEXT:   .byte 7
53; ARM_32:        .data{{$}}
54; ARM_32-NOT:    .globl
55; ARM_32:        .p2align 2
56; ARM_32-LABEL:  __emutls_v.internal_y:
57; ARM_32-NEXT:   .long 8
58; ARM_32-NEXT:   .long 16
59; ARM_32-NEXT:   .long 0
60; ARM_32-NEXT:   .long __emutls_t.internal_y
61; ARM_32-LABEL:  __emutls_t.internal_y:
62; ARM_32-NEXT:   .long 9
63; ARM_32-NEXT:   .long 0
64