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