xref: /aosp_15_r20/external/llvm/test/CodeGen/ARM/movt-movw-global.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -verify-machineinstrs -mtriple=armv7-eabi      | FileCheck %s -check-prefix=EABI
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -verify-machineinstrs -mtriple=armv7-apple-ios -relocation-model=dynamic-no-pic | FileCheck %s -check-prefix=IOS
3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -verify-machineinstrs -mtriple=armv7-apple-ios -relocation-model=pic            | FileCheck %s -check-prefix=IOS-PIC
4*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -verify-machineinstrs -mtriple=armv7-apple-ios -relocation-model=static         | FileCheck %s -check-prefix=IOS-STATIC
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker@foo = common global i32 0
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Workerdefine i32* @bar1() nounwind readnone {
9*9880d681SAndroid Build Coastguard Workerentry:
10*9880d681SAndroid Build Coastguard Worker; EABI:      movw    r0, :lower16:foo
11*9880d681SAndroid Build Coastguard Worker; EABI-NEXT: movt    r0, :upper16:foo
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker; IOS:      movw    r0, :lower16:L_foo$non_lazy_ptr
14*9880d681SAndroid Build Coastguard Worker; IOS-NEXT: movt    r0, :upper16:L_foo$non_lazy_ptr
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker; IOS-PIC:      movw    r0, :lower16:(L_foo$non_lazy_ptr-(LPC0_0+8))
17*9880d681SAndroid Build Coastguard Worker; IOS-PIC-NEXT: movt    r0, :upper16:(L_foo$non_lazy_ptr-(LPC0_0+8))
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Worker; IOS-STATIC:      movw    r0, :lower16:_foo
20*9880d681SAndroid Build Coastguard Worker; IOS-STATIC-NEXT:       movt    r0, :upper16:_foo
21*9880d681SAndroid Build Coastguard Worker  ret i32* @foo
22*9880d681SAndroid Build Coastguard Worker}
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Workerdefine void @bar2(i32 %baz) nounwind {
25*9880d681SAndroid Build Coastguard Workerentry:
26*9880d681SAndroid Build Coastguard Worker; EABI:      movw    r1, :lower16:foo
27*9880d681SAndroid Build Coastguard Worker; EABI-NEXT: movt    r1, :upper16:foo
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Worker; IOS:      movw    r1, :lower16:L_foo$non_lazy_ptr
30*9880d681SAndroid Build Coastguard Worker; IOS-NEXT: movt    r1, :upper16:L_foo$non_lazy_ptr
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Worker; IOS-PIC:      movw    r1, :lower16:(L_foo$non_lazy_ptr-(LPC1_0+8))
33*9880d681SAndroid Build Coastguard Worker; IOS-PIC-NEXT: movt    r1, :upper16:(L_foo$non_lazy_ptr-(LPC1_0+8))
34*9880d681SAndroid Build Coastguard Worker
35*9880d681SAndroid Build Coastguard Worker; IOS-STATIC:      movw    r1, :lower16:_foo
36*9880d681SAndroid Build Coastguard Worker; IOS-STATIC-NEXT:      movt    r1, :upper16:_foo
37*9880d681SAndroid Build Coastguard Worker  store i32 %baz, i32* @foo, align 4
38*9880d681SAndroid Build Coastguard Worker  ret void
39*9880d681SAndroid Build Coastguard Worker}
40