2014-05-24 14:50:23 +02:00
|
|
|
; RUN: llc -mtriple=aarch64-linux-gnu -verify-machineinstrs -relocation-model=pic %s -o - | FileCheck %s
|
2013-01-31 13:12:40 +01:00
|
|
|
|
|
|
|
@var = global i32 0
|
|
|
|
|
|
|
|
define i32 @get_globalvar() {
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: get_globalvar:
|
2013-01-31 13:12:40 +01:00
|
|
|
|
2015-02-27 22:17:42 +01:00
|
|
|
%val = load i32, i32* @var
|
2013-01-31 13:12:40 +01:00
|
|
|
; CHECK: adrp x[[GOTHI:[0-9]+]], :got:var
|
2020-01-03 18:15:52 +01:00
|
|
|
; CHECK: ldr x[[GOTLOC:[0-9]+]], [x[[GOTHI]], :got_lo12:var]
|
2013-01-31 13:12:40 +01:00
|
|
|
; CHECK: ldr w0, [x[[GOTLOC]]]
|
|
|
|
|
|
|
|
ret i32 %val
|
|
|
|
}
|
|
|
|
|
|
|
|
define i32* @get_globalvaraddr() {
|
2013-07-14 08:24:09 +02:00
|
|
|
; CHECK-LABEL: get_globalvaraddr:
|
2013-01-31 13:12:40 +01:00
|
|
|
|
2015-02-27 22:17:42 +01:00
|
|
|
%val = load i32, i32* @var
|
2013-01-31 13:12:40 +01:00
|
|
|
; CHECK: adrp x[[GOTHI:[0-9]+]], :got:var
|
2020-01-03 18:15:52 +01:00
|
|
|
; CHECK: ldr x0, [x[[GOTHI]], :got_lo12:var]
|
2013-01-31 13:12:40 +01:00
|
|
|
|
|
|
|
ret i32* @var
|
|
|
|
}
|