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