Home | History | Annotate | Download | only in ARM
      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 
      8 @G = external global i32
      9 
     10 define i32 @test1() {
     11 ; STATIC: _test1:
     12 ; STATIC: ldr r0, LCPI0_0
     13 ; STATIC: ldr r0, [r0]
     14 ; STATIC: .long _G
     15 
     16 ; DYNAMIC: _test1:
     17 ; DYNAMIC: ldr r0, LCPI0_0
     18 ; DYNAMIC: ldr r0, [r0]
     19 ; DYNAMIC: ldr r0, [r0]
     20 ; DYNAMIC: .long L_G$non_lazy_ptr
     21 
     22 ; PIC: _test1
     23 ; PIC: ldr r0, LCPI0_0
     24 ; PIC: ldr r0, [pc, r0]
     25 ; PIC: ldr r0, [r0]
     26 ; PIC: .long L_G$non_lazy_ptr-(LPC0_0+8)
     27 
     28 ; PIC_T: _test1
     29 ; PIC_T: ldr.n r0, LCPI0_0
     30 ; PIC_T: add r0, pc
     31 ; PIC_T: ldr r0, [r0]
     32 ; PIC_T: ldr r0, [r0]
     33 ; PIC_T: .long L_G$non_lazy_ptr-(LPC0_0+4)
     34 
     35 ; PIC_V7: _test1
     36 ; PIC_V7: movw r0, :lower16:(L_G$non_lazy_ptr-(LPC0_0+8))
     37 ; PIC_V7: movt r0, :upper16:(L_G$non_lazy_ptr-(LPC0_0+8))
     38 ; PIC_V7: ldr r0, [pc, r0]
     39 ; PIC_V7: ldr r0, [r0]
     40 
     41 ; LINUX: test1
     42 ; LINUX: ldr r0, .LCPI0_0
     43 ; LINUX: ldr r1, .LCPI0_1
     44 ; LINUX: add r0, pc, r0
     45 ; LINUX: ldr r0, [r1, r0]
     46 ; LINUX: ldr r0, [r0]
     47 ; LINUX: .long G(GOT)
     48 	%tmp = load i32* @G
     49 	ret i32 %tmp
     50 }
     51