Chris Lattner | 494cb89 | 2009-07-15 04:12:33 +0000 | [diff] [blame] | 1 | ; RUN: llvm-as < %s | llc -relocation-model=static | FileCheck %s -check-prefix=STATIC |
| 2 | ; RUN: llvm-as < %s | llc -relocation-model=pic | FileCheck %s -check-prefix=PIC |
| 3 | ; RUN: llvm-as < %s | llc -relocation-model=dynamic-no-pic | FileCheck %s -check-prefix=DYNAMIC |
| 4 | ; PR4482 |
| 5 | target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" |
| 6 | target triple = "armv6-apple-darwin2" |
| 7 | |
| 8 | define i32 @foo(i64 %x) nounwind { |
| 9 | entry: |
| 10 | ; STATIC: _foo: |
| 11 | ; STATIC: bl _exact_log2 |
| 12 | ; STATIC: ldmfd sp!, {r7, pc} |
| 13 | ; STATIC: .subsections_via_symbols |
| 14 | |
| 15 | ; PIC: _foo: |
| 16 | ; PIC: bl L_exact_log2$stub |
| 17 | ; PIC: ldmfd sp!, {r7, pc} |
| 18 | |
| 19 | ; DYNAMIC: _foo: |
| 20 | ; DYNAMIC: bl L_exact_log2$stub |
| 21 | ; DYNAMIC: ldmfd sp!, {r7, pc} |
| 22 | |
| 23 | %A = call i32 @exact_log2(i64 %x) |
| 24 | ret i32 %A |
| 25 | } |
| 26 | |
| 27 | define available_externally i32 @exact_log2(i64 %x) nounwind { |
| 28 | ret i32 4 |
| 29 | } |
| 30 | |
| 31 | |
| 32 | ; PIC: .section __TEXT,__picsymbolstub4,symbol_stubs,none,16 |
| 33 | ; PIC: L_exact_log2$stub: |
| 34 | ; PIC: .indirect_symbol _exact_log2 |
| 35 | ; PIC: ldr ip, L_exact_log2$slp |
| 36 | ; PIC: L_exact_log2$scv: |
| 37 | ; PIC: add ip, pc, ip |
| 38 | ; PIC: ldr pc, [ip, #0] |
| 39 | ; PIC: L_exact_log2$slp: |
| 40 | ; PIC: .long L_exact_log2$lazy_ptr-(L_exact_log2$scv+8) |
| 41 | |
| 42 | ; PIC: .lazy_symbol_pointer |
| 43 | ; PIC: L_exact_log2$lazy_ptr: |
| 44 | ; PIC: .indirect_symbol _exact_log2 |
| 45 | ; PIC: .long dyld_stub_binding_helper |
| 46 | |
| 47 | ; PIC: .subsections_via_symbols |
| 48 | |
| 49 | |
| 50 | ; DYNAMIC: .section __TEXT,__symbol_stub4,symbol_stubs,none,12 |
| 51 | ; DYNAMIC: L_exact_log2$stub: |
| 52 | ; DYNAMIC: .indirect_symbol _exact_log2 |
| 53 | ; DYNAMIC: ldr ip, L_exact_log2$slp |
| 54 | ; DYNAMIC: ldr pc, [ip, #0] |
| 55 | ; DYNAMIC: L_exact_log2$slp: |
| 56 | ; DYNAMIC: .long L_exact_log2$lazy_ptr |
| 57 | |
| 58 | ; DYNAMIC: .lazy_symbol_pointer |
| 59 | ; DYNAMIC: L_exact_log2$lazy_ptr: |
| 60 | ; DYNAMIC: .indirect_symbol _exact_log2 |
| 61 | ; DYNAMIC: .long dyld_stub_binding_helper |
| 62 | ; DYNAMIC: .subsections_via_symbols |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |