Chris Lattner | 7bf4bc5 | 2009-10-19 18:27:56 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -mtriple=arm-apple-darwin -relocation-model=static | FileCheck %s -check-prefix=DarwinStatic |
| 2 | ; RUN: llc < %s -mtriple=arm-apple-darwin -relocation-model=dynamic-no-pic | FileCheck %s -check-prefix=DarwinDynamic |
| 3 | ; RUN: llc < %s -mtriple=arm-apple-darwin -relocation-model=pic | FileCheck %s -check-prefix=DarwinPIC |
| 4 | ; RUN: llc < %s -mtriple=arm-linux-gnueabi -relocation-model=pic | FileCheck %s -check-prefix=LinuxPIC |
Evan Cheng | 02b985c | 2007-01-19 09:20:23 +0000 | [diff] [blame] | 5 | |
Evan Cheng | 8535072 | 2007-05-04 00:29:34 +0000 | [diff] [blame] | 6 | @G = external global i32 |
Evan Cheng | 02b985c | 2007-01-19 09:20:23 +0000 | [diff] [blame] | 7 | |
Evan Cheng | 8535072 | 2007-05-04 00:29:34 +0000 | [diff] [blame] | 8 | define i32 @test1() { |
| 9 | %tmp = load i32* @G |
| 10 | ret i32 %tmp |
Evan Cheng | 02b985c | 2007-01-19 09:20:23 +0000 | [diff] [blame] | 11 | } |
Chris Lattner | 7bf4bc5 | 2009-10-19 18:27:56 +0000 | [diff] [blame] | 12 | |
| 13 | ; DarwinStatic: _test1: |
| 14 | ; DarwinStatic: ldr r0, LCPI1_0 |
| 15 | ; DarwinStatic: ldr r0, [r0] |
| 16 | ; DarwinStatic: bx lr |
| 17 | |
| 18 | ; DarwinStatic: .align 2 |
| 19 | ; DarwinStatic: LCPI1_0: |
| 20 | ; DarwinStatic: .long {{_G$}} |
| 21 | |
| 22 | |
| 23 | ; DarwinDynamic: _test1: |
| 24 | ; DarwinDynamic: ldr r0, LCPI1_0 |
| 25 | ; DarwinDynamic: ldr r0, [r0] |
| 26 | ; DarwinDynamic: ldr r0, [r0] |
| 27 | ; DarwinDynamic: bx lr |
| 28 | |
| 29 | ; DarwinDynamic: .align 2 |
| 30 | ; DarwinDynamic: LCPI1_0: |
| 31 | ; DarwinDynamic: .long L_G$non_lazy_ptr |
| 32 | |
| 33 | ; DarwinDynamic: .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers |
| 34 | ; DarwinDynamic: .align 2 |
| 35 | ; DarwinDynamic: L_G$non_lazy_ptr: |
| 36 | ; DarwinDynamic: .indirect_symbol _G |
| 37 | ; DarwinDynamic: .long 0 |
| 38 | |
| 39 | |
| 40 | |
| 41 | ; DarwinPIC: _test1: |
| 42 | ; DarwinPIC: ldr r0, LCPI1_0 |
Evan Cheng | e7e0d62 | 2009-11-06 22:24:13 +0000 | [diff] [blame] | 43 | ; DarwinPIC: LPC1_0: |
Johnny Chen | 9e08876 | 2010-03-17 17:52:21 +0000 | [diff] [blame] | 44 | ; DarwinPIC: ldr r0, [pc, r0] |
Chris Lattner | 7bf4bc5 | 2009-10-19 18:27:56 +0000 | [diff] [blame] | 45 | ; DarwinPIC: ldr r0, [r0] |
| 46 | ; DarwinPIC: bx lr |
| 47 | |
| 48 | ; DarwinPIC: .align 2 |
| 49 | ; DarwinPIC: LCPI1_0: |
Evan Cheng | e7e0d62 | 2009-11-06 22:24:13 +0000 | [diff] [blame] | 50 | ; DarwinPIC: .long L_G$non_lazy_ptr-(LPC1_0+8) |
Chris Lattner | 7bf4bc5 | 2009-10-19 18:27:56 +0000 | [diff] [blame] | 51 | |
| 52 | ; DarwinPIC: .section __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers |
| 53 | ; DarwinPIC: .align 2 |
| 54 | ; DarwinPIC: L_G$non_lazy_ptr: |
| 55 | ; DarwinPIC: .indirect_symbol _G |
| 56 | ; DarwinPIC: .long 0 |
| 57 | |
| 58 | |
| 59 | |
| 60 | ; LinuxPIC: test1: |
| 61 | ; LinuxPIC: ldr r0, .LCPI1_0 |
| 62 | ; LinuxPIC: ldr r1, .LCPI1_1 |
| 63 | |
Evan Cheng | e7e0d62 | 2009-11-06 22:24:13 +0000 | [diff] [blame] | 64 | ; LinuxPIC: .LPC1_0: |
Chris Lattner | 7bf4bc5 | 2009-10-19 18:27:56 +0000 | [diff] [blame] | 65 | ; LinuxPIC: add r0, pc, r0 |
Johnny Chen | 9e08876 | 2010-03-17 17:52:21 +0000 | [diff] [blame] | 66 | ; LinuxPIC: ldr r0, [r1, r0] |
Chris Lattner | 7bf4bc5 | 2009-10-19 18:27:56 +0000 | [diff] [blame] | 67 | ; LinuxPIC: ldr r0, [r0] |
| 68 | ; LinuxPIC: bx lr |
| 69 | |
Rafael Espindola | 2e2563b | 2010-01-26 20:21:43 +0000 | [diff] [blame] | 70 | ; LinuxPIC: .align 2 |
Chris Lattner | 7bf4bc5 | 2009-10-19 18:27:56 +0000 | [diff] [blame] | 71 | ; LinuxPIC: .LCPI1_0: |
Evan Cheng | e7e0d62 | 2009-11-06 22:24:13 +0000 | [diff] [blame] | 72 | ; LinuxPIC: .long _GLOBAL_OFFSET_TABLE_-(.LPC1_0+8) |
Rafael Espindola | 2e2563b | 2010-01-26 20:21:43 +0000 | [diff] [blame] | 73 | ; LinuxPIC: .align 2 |
Chris Lattner | 7bf4bc5 | 2009-10-19 18:27:56 +0000 | [diff] [blame] | 74 | ; LinuxPIC: .LCPI1_1: |
| 75 | ; LinuxPIC: .long G(GOT) |