1 ; RUN: llc -O0 -fast-isel -mtriple=arm64-none-linux-gnu -relocation-model=pic \ 2 ; RUN: -verify-machineinstrs < %s | FileCheck -check-prefix=CHECK -check-prefix=NOEMU %s 3 ; RUN: llc -emulated-tls -O0 -fast-isel -mtriple=arm64-none-linux-gnu -relocation-model=pic \ 4 ; RUN: -verify-machineinstrs < %s | FileCheck -check-prefix=CHECK -check-prefix=EMU %s 5 6 ; If the .tlsdesccall and blr parts are emitted completely separately (even with 7 ; glue) then LLVM will separate them quite happily (with a spill at O0, hence 8 ; the option). This is definitely wrong, so we make sure they are emitted 9 ; together. 10 11 @general_dynamic_var = external thread_local global i32 12 13 define i32 @test_generaldynamic() { 14 ; CHECK-LABEL: test_generaldynamic: 15 16 %val = load i32, i32* @general_dynamic_var 17 ret i32 %val 18 19 ; NOEMU: .tlsdesccall general_dynamic_var 20 ; NOEMU-NEXT: blr {{x[0-9]+}} 21 ; NOEMU-NOT: __emutls_v.general_dynamic_var: 22 23 ; EMU: adrp{{.+}}__emutls_v.general_dynamic_var 24 ; EMU: bl __emutls_get_address 25 26 ; EMU-NOT: __emutls_v.general_dynamic_var 27 ; EMU-NOT: __emutls_t.general_dynamic_var 28 } 29 30 @emulated_init_var = thread_local global i32 37, align 8 31 32 define i32 @test_emulated_init() { 33 ; COMMON-LABEL: test_emulated_init: 34 35 %val = load i32, i32* @emulated_init_var 36 ret i32 %val 37 38 ; EMU: adrp{{.+}}__emutls_v.emulated_init_var 39 ; EMU: bl __emutls_get_address 40 41 ; EMU-NOT: __emutls_v.general_dynamic_var: 42 43 ; EMU: .p2align 3 44 ; EMU-LABEL: __emutls_v.emulated_init_var: 45 ; EMU-NEXT: .xword 4 46 ; EMU-NEXT: .xword 8 47 ; EMU-NEXT: .xword 0 48 ; EMU-NEXT: .xword __emutls_t.emulated_init_var 49 50 ; EMU-LABEL: __emutls_t.emulated_init_var: 51 ; EMU-NEXT: .word 37 52 } 53 54 ; CHECK-NOT: __emutls_v.general_dynamic_var: 55 ; EMU-NOT: __emutls_t.general_dynamic_var 56