xref: /aosp_15_r20/external/llvm/test/CodeGen/AArch64/arm64-global-address.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=arm64-apple-ios7.0 | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; rdar://9618644
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker@G = external global i32
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workerdefine i32 @test(i32 %off) nounwind {
7*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test:
8*9880d681SAndroid Build Coastguard Worker; CHECK: adrp x[[REG:[0-9]+]], _G@GOTPAGE
9*9880d681SAndroid Build Coastguard Worker; CHECK: ldr  x[[REG2:[0-9]+]], [x[[REG]], _G@GOTPAGEOFF]
10*9880d681SAndroid Build Coastguard Worker; CHECK: add w0, w[[REG2]], w0
11*9880d681SAndroid Build Coastguard Worker  %tmp = ptrtoint i32* @G to i32
12*9880d681SAndroid Build Coastguard Worker  %tmp1 = add i32 %tmp, %off
13*9880d681SAndroid Build Coastguard Worker  ret i32 %tmp1
14*9880d681SAndroid Build Coastguard Worker}
15