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; RUN: llc < %s -emulated-tls -mtriple=arm-apple-darwin -O3 \ 10; RUN: | FileCheck -check-prefix=DARWIN %s 11; RUN: llc < %s -emulated-tls -mtriple=thumbv7-windows-gnu -O3 \ 12; RUN: | FileCheck -check-prefix=WIN %s 13 14; RUN: llc < %s -mtriple=arm-linux-android -relocation-model=pic \ 15; RUN: | FileCheck -check-prefix=ARM_32 %s 16; RUN: llc < %s -mtriple=arm-linux-androidabi -relocation-model=pic \ 17; RUN: | FileCheck -check-prefix=ARM_32 %s 18; RUN: llc < %s -mtriple=arm-linux-androidabi -relocation-model=pic -O3 \ 19; RUN: | FileCheck -check-prefix=ARM_32 %s 20; RUN: llc < %s -mtriple=arm-linux-androidabi -O3 \ 21; RUN: | FileCheck -check-prefix=ARM_32 %s 22; arm-apple-darwin must use -emulated-tls 23; windows must use -emulated-tls 24 25; Make sure that TLS symbols are emitted in expected order. 26 27@external_x = external thread_local global i32, align 8 28@external_y = thread_local global i8 7, align 2 29@internal_y = internal thread_local global i64 9, align 16 30 31define i32* @get_external_x() { 32entry: 33 ret i32* @external_x 34} 35 36define i8* @get_external_y() { 37entry: 38 ret i8* @external_y 39} 40 41define i64* @get_internal_y() { 42entry: 43 ret i64* @internal_y 44} 45 46; ARM_32-LABEL: get_external_x: 47; ARM_32: bl __emutls_get_address 48; ARM_32: .long __emutls_v.external_x 49; ARM_32-LABEL: get_external_y: 50; ARM_32: bl __emutls_get_address 51; ARM_32: .long __emutls_v.external_y 52; ARM_32-LABEL: get_internal_y: 53; ARM_32: bl __emutls_get_address 54; ARM_32: .long __emutls_v.internal_y 55; ARM_32-NOT: __emutls_t.external_x 56; ARM_32-NOT: __emutls_v.external_x: 57; ARM_32: .data{{$}} 58; ARM_32: .globl __emutls_v.external_y 59; ARM_32: .p2align 2 60; ARM_32-LABEL: __emutls_v.external_y: 61; ARM_32-NEXT: .long 1 62; ARM_32-NEXT: .long 2 63; ARM_32-NEXT: .long 0 64; ARM_32-NEXT: .long __emutls_t.external_y 65; ARM_32: .section .rodata, 66; ARM_32-LABEL: __emutls_t.external_y: 67; ARM_32-NEXT: .byte 7 68; ARM_32: .data{{$}} 69; ARM_32-NOT: .globl 70; ARM_32: .p2align 2 71; ARM_32-LABEL: __emutls_v.internal_y: 72; ARM_32-NEXT: .long 8 73; ARM_32-NEXT: .long 16 74; ARM_32-NEXT: .long 0 75; ARM_32-NEXT: .long __emutls_t.internal_y 76; ARM_32-LABEL: __emutls_t.internal_y: 77; ARM_32-NEXT: .long 9 78; ARM_32-NEXT: .long 0 79 80; WIN-LABEL: get_external_x: 81; WIN: movw r0, :lower16:__emutls_v.external_x 82; WIN: movt r0, :upper16:__emutls_v.external_x 83; WIN: bl __emutls_get_address 84; WIN-LABEL: get_external_y: 85; WIN: movw r0, :lower16:__emutls_v.external_y 86; WIN: movt r0, :upper16:__emutls_v.external_y 87; WIN: bl __emutls_get_address 88; WIN-LABEL: get_internal_y: 89; WIN: movw r0, :lower16:__emutls_v.internal_y 90; WIN: movt r0, :upper16:__emutls_v.internal_y 91; WIN: bl __emutls_get_address 92; WIN-NOT: __emutls_t.external_x 93; WIN-NOT: __emutls_v.external_x: 94; WIN: .data{{$}} 95; WIN: .globl __emutls_v.external_y 96; WIN: .p2align 2 97; WIN-LABEL: __emutls_v.external_y: 98; WIN-NEXT: .long 1 99; WIN-NEXT: .long 2 100; WIN-NEXT: .long 0 101; WIN-NEXT: .long __emutls_t.external_y 102; WIN: .section .rdata, 103; WIN-LABEL: __emutls_t.external_y: 104; WIN-NEXT: .byte 7 105; WIN: .data{{$}} 106; WIN-NOT: .globl 107; WIN: .p2align 2 108; WIN-LABEL: __emutls_v.internal_y: 109; WIN-NEXT: .long 8 110; WIN-NEXT: .long 16 111; WIN-NEXT: .long 0 112; WIN-NEXT: .long __emutls_t.internal_y 113; WIN-LABEL: __emutls_t.internal_y: 114; .quad 9 is equivalent to .long 9 .long 0 115; WIN-NEXT: .quad 9 116 117; DARWIN-LABEL: _get_external_x: 118; DARWIN: bl ___emutls_get_address 119; DARWIN: .long L___emutls_v.external_x$non_lazy_ptr-(LPC0_0+8) 120; DARWIN-LABEL: _get_external_y: 121; DARWIN: bl ___emutls_get_address 122; DARWIN: .long ___emutls_v.external_y-(LPC1_0+8) 123; DARWIN-LABEL: _get_internal_y: 124; DARWIN: bl ___emutls_get_address 125; DARWIN: .long ___emutls_v.internal_y-(LPC2_0+8) 126; DARWIN-NOT: ___emutls_t.external_x 127; DARWIN-NOT: ___emutls_v.external_x: 128; DARWIN: .section __DATA,__data 129; DARWIN: .globl ___emutls_v.external_y 130; DARWIN: .p2align 2 131; DARWIN-LABEL: ___emutls_v.external_y: 132; DARWIN-NEXT: .long 1 133; DARWIN-NEXT: .long 2 134; DARWIN-NEXT: .long 0 135; DARWIN-NEXT: .long ___emutls_t.external_y 136; DARWIN: .section __TEXT,__const 137; DARWIN-LABEL: ___emutls_t.external_y: 138; DARWIN-NEXT: .byte 7 139; DARWIN: .section __DATA,__data 140; DARWIN-NOT: .globl 141; DARWIN: .p2align 2 142; DARWIN-LABEL: ___emutls_v.internal_y: 143; DARWIN-NEXT: .long 8 144; DARWIN-NEXT: .long 16 145; DARWIN-NEXT: .long 0 146; DARWIN-NEXT: .long ___emutls_t.internal_y 147; DARWIN-LABEL: ___emutls_t.internal_y: 148; DARWIN-NEXT: .long 9 149; DARWIN-NEXT: .long 0 150