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