xref: /aosp_15_r20/external/llvm/test/CodeGen/ARM/load-global.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=armv6-apple-darwin -relocation-model=static | FileCheck %s -check-prefix=STATIC
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=armv6-apple-darwin -relocation-model=dynamic-no-pic | FileCheck %s -check-prefix=DYNAMIC
3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=armv6-apple-darwin -relocation-model=pic | FileCheck %s -check-prefix=PIC
4*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=thumbv6-apple-darwin -relocation-model=pic | FileCheck %s -check-prefix=PIC_T
5*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=armv7-apple-darwin -relocation-model=pic | FileCheck %s -check-prefix=PIC_V7
6*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=armv6-linux-gnueabi -relocation-model=pic | FileCheck %s -check-prefix=LINUX
7*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=thumbv6-linux-gnueabi -relocation-model=pic | FileCheck %s -check-prefix=LINUX_T
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Worker@G = external global i32
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Workerdefine i32 @test1() {
12*9880d681SAndroid Build Coastguard Worker; STATIC: _test1:
13*9880d681SAndroid Build Coastguard Worker; STATIC: ldr r0, LCPI0_0
14*9880d681SAndroid Build Coastguard Worker; STATIC: ldr r0, [r0]
15*9880d681SAndroid Build Coastguard Worker; STATIC: .long _G
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Worker; DYNAMIC: _test1:
18*9880d681SAndroid Build Coastguard Worker; DYNAMIC: ldr r0, LCPI0_0
19*9880d681SAndroid Build Coastguard Worker; DYNAMIC: ldr r0, [r0]
20*9880d681SAndroid Build Coastguard Worker; DYNAMIC: ldr r0, [r0]
21*9880d681SAndroid Build Coastguard Worker; DYNAMIC: .long L_G$non_lazy_ptr
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Worker; PIC: _test1
24*9880d681SAndroid Build Coastguard Worker; PIC: ldr r0, LCPI0_0
25*9880d681SAndroid Build Coastguard Worker; PIC: ldr r0, [pc, r0]
26*9880d681SAndroid Build Coastguard Worker; PIC: ldr r0, [r0]
27*9880d681SAndroid Build Coastguard Worker; PIC: .long L_G$non_lazy_ptr-(LPC0_0+8)
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Worker; PIC_T: _test1
30*9880d681SAndroid Build Coastguard Worker; PIC_T: ldr r0, LCPI0_0
31*9880d681SAndroid Build Coastguard Worker; PIC_T: add r0, pc
32*9880d681SAndroid Build Coastguard Worker; PIC_T: ldr r0, [r0]
33*9880d681SAndroid Build Coastguard Worker; PIC_T: ldr r0, [r0]
34*9880d681SAndroid Build Coastguard Worker; PIC_T: .long L_G$non_lazy_ptr-(LPC0_0+4)
35*9880d681SAndroid Build Coastguard Worker
36*9880d681SAndroid Build Coastguard Worker; PIC_V7: _test1
37*9880d681SAndroid Build Coastguard Worker; PIC_V7: movw r0, :lower16:(L_G$non_lazy_ptr-(LPC0_0+8))
38*9880d681SAndroid Build Coastguard Worker; PIC_V7: movt r0, :upper16:(L_G$non_lazy_ptr-(LPC0_0+8))
39*9880d681SAndroid Build Coastguard Worker; PIC_V7: ldr r0, [pc, r0]
40*9880d681SAndroid Build Coastguard Worker; PIC_V7: ldr r0, [r0]
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Worker; LINUX: test1
43*9880d681SAndroid Build Coastguard Worker; LINUX: ldr r0, .LCPI0_0
44*9880d681SAndroid Build Coastguard Worker; LINUX: ldr r0, [pc, r0]
45*9880d681SAndroid Build Coastguard Worker; LINUX: ldr r0, [r0]
46*9880d681SAndroid Build Coastguard Worker; LINUX: .long G(GOT_PREL)-((.LPC0_0+8)-.Ltmp0)
47*9880d681SAndroid Build Coastguard Worker
48*9880d681SAndroid Build Coastguard Worker; LINUX_T: ldr r0, .LCPI0_0
49*9880d681SAndroid Build Coastguard Worker; LINUX_T: add r0, pc
50*9880d681SAndroid Build Coastguard Worker; LINUX_T: ldr r0, [r0]
51*9880d681SAndroid Build Coastguard Worker; LINUX_T: ldr r0, [r0]
52*9880d681SAndroid Build Coastguard Worker	%tmp = load i32, i32* @G
53*9880d681SAndroid Build Coastguard Worker	ret i32 %tmp
54*9880d681SAndroid Build Coastguard Worker}
55