1 ; RUN: llc -mtriple=aarch64-linux-gnu -verify-machineinstrs -relocation-model=pic %s -o - | FileCheck %s
5 define i32 @get_globalvar() {
6 ; CHECK-LABEL: get_globalvar:
8 %val = load i32, i32* @var
9 ; CHECK: adrp x[[GOTHI:[0-9]+]], :got:var
10 ; CHECK: ldr x[[GOTLOC:[0-9]+]], [x[[GOTHI]], {{#?}}:got_lo12:var]
11 ; CHECK: ldr w0, [x[[GOTLOC]]]
16 define i32* @get_globalvaraddr() {
17 ; CHECK-LABEL: get_globalvaraddr:
19 %val = load i32, i32* @var
20 ; CHECK: adrp x[[GOTHI:[0-9]+]], :got:var
21 ; CHECK: ldr x0, [x[[GOTHI]], {{#?}}:got_lo12:var]
26 @hiddenvar = hidden global i32 0
28 define i32 @get_hiddenvar() {
29 ; CHECK-LABEL: get_hiddenvar:
31 %val = load i32, i32* @hiddenvar
32 ; CHECK: adrp x[[HI:[0-9]+]], hiddenvar
33 ; CHECK: ldr w0, [x[[HI]], {{#?}}:lo12:hiddenvar]
38 define i32* @get_hiddenvaraddr() {
39 ; CHECK-LABEL: get_hiddenvaraddr:
41 %val = load i32, i32* @hiddenvar
42 ; CHECK: adrp [[HI:x[0-9]+]], hiddenvar
43 ; CHECK: add x0, [[HI]], {{#?}}:lo12:hiddenvar
48 define void()* @get_func() {
49 ; CHECK-LABEL: get_func:
51 ret void()* bitcast(void()*()* @get_func to void()*)
52 ; CHECK: adrp x[[GOTHI:[0-9]+]], :got:get_func
53 ; CHECK: ldr x0, [x[[GOTHI]], {{#?}}:got_lo12:get_func]