1 ; RUN: llc -mtriple=aarch64-linux-gnu_ilp32 -relocation-model=pic %s -o - | FileCheck %s
2 ; RUN: llc -mtriple=aarch64-linux-gnu_ilp32 -relocation-model=pic -filetype=obj < %s | llvm-objdump -r - | FileCheck --check-prefix=CHECK-RELOC %s
4 @var = thread_local global i32 zeroinitializer
6 define i32 @test_thread_local() {
7 ; CHECK-LABEL: test_thread_local:
9 %val = load i32, ptr @var
12 ; CHECK: adrp x[[TLSDESC_HI:[0-9]+]], :tlsdesc:var
13 ; CHECK-NEXT: ldr w[[CALLEE:[0-9]+]], [x[[TLSDESC_HI]], :tlsdesc_lo12:var]
14 ; CHECK-NEXT: add w0, w[[TLSDESC_HI]], :tlsdesc_lo12:var
15 ; CHECK-NEXT: .tlsdesccall var
16 ; CHECK-NEXT: blr x[[CALLEE]]
18 ; CHECK-RELOC: R_AARCH64_P32_TLSDESC_ADR_PAGE21
19 ; CHECK-RELOC: R_AARCH64_P32_TLSDESC_LD32_LO12
20 ; CHECK-RELOC: R_AARCH64_P32_TLSDESC_ADD_LO12
21 ; CHECK-RELOC: R_AARCH64_P32_TLSDESC_CALL