1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00
llvm-mirror/test/CodeGen/AArch64/arm64-tls-darwin.ll
Tim Northover c802973c73 AArch64: support TLS on Darwin platforms in GlobalISel.
All TLS access on Darwin is in the "general dynamic" form where we call
a function to resolve the address, so implementation is pretty simple.

llvm-svn: 368418
2019-08-09 09:32:38 +00:00

20 lines
684 B
LLVM

; RUN: llc -mtriple=arm64-apple-ios7.0 %s -o - | FileCheck %s
; RUN: llc -mtriple=arm64-apple-ios7.0 -global-isel -global-isel-abort=1 -verify-machineinstrs %s -o - | FileCheck %s
@var = thread_local global i8 0
; N.b. x0 must be the result of the first load (i.e. the address of the
; descriptor) when tlv_get_addr is called. Likewise the result is returned in
; x0.
define i8 @get_var() {
; CHECK-LABEL: get_var:
; CHECK: adrp x[[TLVPDESC_SLOT_HI:[0-9]+]], _var@TLVPPAGE
; CHECK: ldr x0, [x[[TLVPDESC_SLOT_HI]], _var@TLVPPAGEOFF]
; CHECK: ldr [[TLV_GET_ADDR:x[0-9]+]], [x0]
; CHECK: blr [[TLV_GET_ADDR]]
; CHECK: ldrb w0, [x0]
%val = load i8, i8* @var, align 1
ret i8 %val
}