2014-05-24 12:50:23 +00:00
|
|
|
; RUN: llc -mtriple=aarch64-linux-gnu -verify-machineinstrs -relocation-model=pic %s -o - | FileCheck %s
|
2013-01-31 12:12:40 +00:00
|
|
|
|
|
|
|
@var = global i32 0
|
|
|
|
|
|
|
|
define i32 @get_globalvar() {
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: get_globalvar:
|
2013-01-31 12:12:40 +00:00
|
|
|
|
|
|
|
%val = load i32* @var
|
|
|
|
; CHECK: adrp x[[GOTHI:[0-9]+]], :got:var
|
2014-04-14 12:50:58 +00:00
|
|
|
; CHECK: ldr x[[GOTLOC:[0-9]+]], [x[[GOTHI]], {{#?}}:got_lo12:var]
|
2013-01-31 12:12:40 +00:00
|
|
|
; CHECK: ldr w0, [x[[GOTLOC]]]
|
|
|
|
|
|
|
|
ret i32 %val
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32* @get_globalvaraddr() {
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: get_globalvaraddr:
|
2013-01-31 12:12:40 +00:00
|
|
|
|
|
|
|
%val = load i32* @var
|
|
|
|
; CHECK: adrp x[[GOTHI:[0-9]+]], :got:var
|
2014-04-14 12:50:58 +00:00
|
|
|
; CHECK: ldr x0, [x[[GOTHI]], {{#?}}:got_lo12:var]
|
2013-01-31 12:12:40 +00:00
|
|
|
|
|
|
|
ret i32* @var
|
|
|
|
}
|
|
|
|
|
|
|
|
@hiddenvar = hidden global i32 0
|
|
|
|
|
|
|
|
define i32 @get_hiddenvar() {
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: get_hiddenvar:
|
2013-01-31 12:12:40 +00:00
|
|
|
|
|
|
|
%val = load i32* @hiddenvar
|
|
|
|
; CHECK: adrp x[[HI:[0-9]+]], hiddenvar
|
2014-04-14 12:50:58 +00:00
|
|
|
; CHECK: ldr w0, [x[[HI]], {{#?}}:lo12:hiddenvar]
|
2013-01-31 12:12:40 +00:00
|
|
|
|
|
|
|
ret i32 %val
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32* @get_hiddenvaraddr() {
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: get_hiddenvaraddr:
|
2013-01-31 12:12:40 +00:00
|
|
|
|
|
|
|
%val = load i32* @hiddenvar
|
|
|
|
; CHECK: adrp [[HI:x[0-9]+]], hiddenvar
|
2014-04-14 12:50:58 +00:00
|
|
|
; CHECK: add x0, [[HI]], {{#?}}:lo12:hiddenvar
|
2013-01-31 12:12:40 +00:00
|
|
|
|
|
|
|
ret i32* @hiddenvar
|
|
|
|
}
|
|
|
|
|
|
|
|
define void()* @get_func() {
|
2013-07-14 06:24:09 +00:00
|
|
|
; CHECK-LABEL: get_func:
|
2013-01-31 12:12:40 +00:00
|
|
|
|
|
|
|
ret void()* bitcast(void()*()* @get_func to void()*)
|
|
|
|
; CHECK: adrp x[[GOTHI:[0-9]+]], :got:get_func
|
2014-04-14 12:50:58 +00:00
|
|
|
; CHECK: ldr x0, [x[[GOTHI]], {{#?}}:got_lo12:get_func]
|
2013-07-13 20:38:47 +00:00
|
|
|
}
|