brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · e4f1996 Raw
97 lines · plain
1; RUN: llc -mtriple=thumbv7m-none-macho %s -o - -relocation-model=pic -frame-pointer=all | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NON-FAST2; RUN: llc -mtriple=thumbv7m-none-macho -O0 %s -o - -relocation-model=pic -frame-pointer=all | FileCheck %s3; RUN: llc -mtriple=thumbv7m-none-macho -filetype=obj %s -o /dev/null4 5@var = external global i326 7define i32 @test_litpool() minsize {8; CHECK-LABEL: test_litpool:9  %val = load i32, ptr @var10  ret i32 %val11 12  ; Lit-pool entries need to produce a "$non_lazy_ptr" version of the symbol.13; CHECK: LCPI0_0:14; CHECK-NEXT: .long L_var$non_lazy_ptr-(LPC0_0+4)15}16 17define i32 @test_movw_movt() {18; CHECK-LABEL: test_movw_movt:19  %val = load i32, ptr @var20  ret i32 %val21 22  ; movw/movt should also address their symbols MachO-style23; CHECK: movw [[RTMP:r[0-9]+]], :lower16:(L_var$non_lazy_ptr-(LPC1_0+4))24; CHECK: movt [[RTMP]], :upper16:(L_var$non_lazy_ptr-(LPC1_0+4))25; CHECK: LPC1_0:26; CHECK: add [[RTMP]], pc27}28 29declare void @llvm.trap()30 31define void @test_trap() {32; CHECK-LABEL: test_trap:33 34  ; Bare-metal MachO gets compiled on top of normal MachO toolchain which35  ; understands trap natively.36  call void @llvm.trap()37; CHECK: trap38 39  ret void40}41 42define i32 @test_frame_ptr() {43; CHECK-LABEL: test_frame_ptr:44  call void @test_trap()45 46  ; Frame pointer is r7.47; CHECK: mov r7, sp48  ret i32 4249}50 51%big_arr = type [8 x i32]52define void @test_two_areas(ptr %addr) {53; CHECK-LABEL: test_two_areas:54  %val = load %big_arr, ptr %addr55  call void @test_trap()56  store %big_arr %val, ptr %addr57 58  ; This goes with the choice of r7 as FP (largely). FP and LR have to be stored59  ; consecutively on the stack for the frame record to be valid, which means we60  ; need the 2 register-save areas employed by iOS.61; CHECK-NON-FAST: push {r4, r5, r6, r7, lr}62; CHECK-NON-FAST: push.w {r8, r9, r10, r11}63; ...64; CHECK-NON-FAST: pop.w {r8, r9, r10, r11}65; CHECK-NON-FAST: pop {r4, r5, r6, r7, pc}66  ret void67}68 69define void @test_tail_call() {70; CHECK-LABEL: test_tail_call:71  tail call void @test_trap()72 73  ; Tail calls should be available and use Thumb2 branch.74; CHECK: b.w _test_trap75  ret void76}77 78define float @test_softfloat_calls(float %in) {79; CHECK-LABEL: test_softfloat_calls:80  %sum = fadd float %in, %in81 82  ; Soft-float calls should be GNU-style rather than RTABI and should not be the83  ; *vfp variants used for ARMv6 iOS.84; CHECK: bl ___addsf3{{$}}85  ret float %sum86}87 88  ; Even bare-metal PIC needs GOT-like behaviour, in principle. Depends a bit on89  ; the use-case of course, but LLVM doesn't know what that is.90; CHECK: non_lazy_symbol_pointers91; CHECK: L_var$non_lazy_ptr:92; CHECK-NEXT:   .indirect_symbol _var93 94  ; All MachO objects should have this to give the linker leeway in removing95  ; dead code.96; CHECK: .subsections_via_symbols97