1 ; RUN: llc -mtriple=thumbv7m-none-macho %s -o - -relocation-model=pic -disable-fp-elim | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NON-FAST
2 ; RUN: llc -mtriple=thumbv7m-none-macho -O0 %s -o - -relocation-model=pic -disable-fp-elim | FileCheck %s
3 ; RUN: llc -mtriple=thumbv7m-none-macho -filetype=obj %s -o /dev/null
5 ; Bare-metal should probably "declare" segments just like normal MachO
6 ; CHECK: __picsymbolstub4
10 @var = external global i32
12 define i32 @test_litpool() minsize {
13 ; CHECK-LABEL: test_litpool:
17 ; Lit-pool entries need to produce a "$non_lazy_ptr" version of the symbol.
19 ; CHECK-NEXT: .long L_var$non_lazy_ptr-(LPC0_0+4)
22 define i32 @test_movw_movt() {
23 ; CHECK-LABEL: test_movw_movt:
27 ; movw/movt should also address their symbols MachO-style
28 ; CHECK: movw [[RTMP:r[0-9]+]], :lower16:(L_var$non_lazy_ptr-(LPC1_0+4))
29 ; CHECK: movt [[RTMP]], :upper16:(L_var$non_lazy_ptr-(LPC1_0+4))
31 ; CHECK: add [[RTMP]], pc
34 declare void @llvm.trap()
36 define void @test_trap() {
37 ; CHECK-LABEL: test_trap:
39 ; Bare-metal MachO gets compiled on top of normal MachO toolchain which
40 ; understands trap natively.
41 call void @llvm.trap()
47 define i32 @test_frame_ptr() {
48 ; CHECK-LABEL: test_frame_ptr:
49 call void @test_trap()
51 ; Frame pointer is r7 as for Darwin
56 %big_arr = type [8 x i32]
57 define void @test_two_areas(%big_arr* %addr) {
58 ; CHECK-LABEL: test_two_areas:
59 %val = load %big_arr* %addr
60 call void @test_trap()
61 store %big_arr %val, %big_arr* %addr
63 ; This goes with the choice of r7 as FP (largely). FP and LR have to be stored
64 ; consecutively on the stack for the frame record to be valid, which means we
65 ; need the 2 register-save areas employed by iOS.
66 ; CHECK-NON-FAST: push {r4, r5, r6, r7, lr}
67 ; CHECK-NON-FAST: push.w {r8, r9, r10, r11}
69 ; CHECK-NON-FAST: pop.w {r8, r9, r10, r11}
70 ; CHECK-NON-FAST: pop {r4, r5, r6, r7, pc}
74 define void @test_tail_call() {
75 ; CHECK-LABEL: test_tail_call:
76 tail call void @test_trap()
78 ; Tail calls should be available and use Thumb2 branch.
79 ; CHECK: b.w _test_trap
83 define float @test_softfloat_calls(float %in) {
84 ; CHECK-LABEL: test_softfloat_calls:
85 %sum = fadd float %in, %in
87 ; Soft-float calls should be GNU-style rather than RTABI and should not be the
88 ; *vfp variants used for ARMv6 iOS.
89 ; CHECK: blx ___addsf3{{$}}
93 ; Even bare-metal PIC needs GOT-like behaviour, in principle. Depends a bit on
94 ; the use-case of course, but LLVM doesn't know what that is.
95 ; CHECK: non_lazy_symbol_pointers
96 ; CHECK: L_var$non_lazy_ptr:
97 ; CHECK-NEXT: .indirect_symbol _var
99 ; All MachO objects should have this to give the linker leeway in removing
101 ; CHECK: .subsections_via_symbols