Dan Gohman | fce288f | 2009-09-09 00:09:15 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -relocation-model=static | FileCheck %s -check-prefix=STATIC |
| 2 | ; RUN: llc < %s -relocation-model=pic | FileCheck %s -check-prefix=PIC |
Benjamin Kramer | 915558e | 2012-11-24 13:18:25 +0000 | [diff] [blame^] | 3 | ; RUN: llc < %s -relocation-model=pic -mtriple=powerpc64-apple-darwin8 | FileCheck %s -check-prefix=PIC64 |
Dan Gohman | fce288f | 2009-09-09 00:09:15 +0000 | [diff] [blame] | 4 | ; RUN: llc < %s -relocation-model=dynamic-no-pic | FileCheck %s -check-prefix=DYNAMIC |
Benjamin Kramer | 915558e | 2012-11-24 13:18:25 +0000 | [diff] [blame^] | 5 | ; RUN: llc < %s -relocation-model=dynamic-no-pic -mtriple=powerpc64-apple-darwin8 | FileCheck %s -check-prefix=DYNAMIC64 |
Chris Lattner | 4fb75e5 | 2009-07-01 16:53:44 +0000 | [diff] [blame] | 6 | ; PR4482 |
| 7 | 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" |
| 8 | target triple = "powerpc-apple-darwin8" |
| 9 | |
| 10 | define i32 @foo(i64 %x) nounwind { |
| 11 | entry: |
Chris Lattner | a9aa352 | 2009-07-15 01:43:31 +0000 | [diff] [blame] | 12 | ; STATIC: _foo: |
| 13 | ; STATIC: bl _exact_log2 |
| 14 | ; STATIC: blr |
| 15 | ; STATIC: .subsections_via_symbols |
| 16 | |
| 17 | ; PIC: _foo: |
| 18 | ; PIC: bl L_exact_log2$stub |
| 19 | ; PIC: blr |
| 20 | |
Benjamin Kramer | 915558e | 2012-11-24 13:18:25 +0000 | [diff] [blame^] | 21 | ; PIC64: _foo: |
| 22 | ; PIC64: bl L_exact_log2$stub |
| 23 | ; PIC64: blr |
| 24 | |
Chris Lattner | a9aa352 | 2009-07-15 01:43:31 +0000 | [diff] [blame] | 25 | ; DYNAMIC: _foo: |
| 26 | ; DYNAMIC: bl L_exact_log2$stub |
| 27 | ; DYNAMIC: blr |
| 28 | |
Benjamin Kramer | 915558e | 2012-11-24 13:18:25 +0000 | [diff] [blame^] | 29 | ; DYNAMIC64: _foo: |
| 30 | ; DYNAMIC64: bl L_exact_log2$stub |
| 31 | ; DYNAMIC64: blr |
| 32 | |
Chris Lattner | 0bc2672 | 2009-07-15 01:32:33 +0000 | [diff] [blame] | 33 | %A = call i32 @exact_log2(i64 %x) nounwind |
| 34 | ret i32 %A |
Chris Lattner | 4fb75e5 | 2009-07-01 16:53:44 +0000 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | define available_externally i32 @exact_log2(i64 %x) nounwind { |
| 38 | entry: |
Chris Lattner | 0bc2672 | 2009-07-15 01:32:33 +0000 | [diff] [blame] | 39 | ret i32 42 |
Chris Lattner | 4fb75e5 | 2009-07-01 16:53:44 +0000 | [diff] [blame] | 40 | } |
Chris Lattner | a9aa352 | 2009-07-15 01:43:31 +0000 | [diff] [blame] | 41 | |
| 42 | |
| 43 | ; PIC: .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 |
| 44 | ; PIC: L_exact_log2$stub: |
| 45 | ; PIC: .indirect_symbol _exact_log2 |
| 46 | ; PIC: mflr r0 |
Benjamin Kramer | 915558e | 2012-11-24 13:18:25 +0000 | [diff] [blame^] | 47 | ; PIC: bcl 20, 31, L_exact_log2$stub$tmp |
Chris Lattner | a9aa352 | 2009-07-15 01:43:31 +0000 | [diff] [blame] | 48 | |
Chris Lattner | 392db3e | 2009-07-15 02:56:53 +0000 | [diff] [blame] | 49 | ; PIC: L_exact_log2$stub$tmp: |
Chris Lattner | a9aa352 | 2009-07-15 01:43:31 +0000 | [diff] [blame] | 50 | ; PIC: mflr r11 |
Benjamin Kramer | 915558e | 2012-11-24 13:18:25 +0000 | [diff] [blame^] | 51 | ; PIC: addis r11, r11, ha16(L_exact_log2$lazy_ptr-L_exact_log2$stub$tmp) |
Chris Lattner | a9aa352 | 2009-07-15 01:43:31 +0000 | [diff] [blame] | 52 | ; PIC: mtlr r0 |
Benjamin Kramer | 915558e | 2012-11-24 13:18:25 +0000 | [diff] [blame^] | 53 | ; PIC: lwzu r12, lo16(L_exact_log2$lazy_ptr-L_exact_log2$stub$tmp)(r11) |
Chris Lattner | a9aa352 | 2009-07-15 01:43:31 +0000 | [diff] [blame] | 54 | ; PIC: mtctr r12 |
| 55 | ; PIC: bctr |
| 56 | |
Chris Lattner | ff4bc46 | 2009-08-10 01:39:42 +0000 | [diff] [blame] | 57 | ; PIC: .section __DATA,__la_symbol_ptr,lazy_symbol_pointers |
Chris Lattner | a9aa352 | 2009-07-15 01:43:31 +0000 | [diff] [blame] | 58 | ; PIC: L_exact_log2$lazy_ptr: |
| 59 | ; PIC: .indirect_symbol _exact_log2 |
| 60 | ; PIC: .long dyld_stub_binding_helper |
| 61 | |
| 62 | ; PIC: .subsections_via_symbols |
| 63 | |
Benjamin Kramer | 915558e | 2012-11-24 13:18:25 +0000 | [diff] [blame^] | 64 | ; PIC64: .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 |
| 65 | ; PIC64: L_exact_log2$stub: |
| 66 | ; PIC64: .indirect_symbol _exact_log2 |
| 67 | ; PIC64: mflr r0 |
| 68 | ; PIC64: bcl 20, 31, L_exact_log2$stub$tmp |
| 69 | |
| 70 | ; PIC64: L_exact_log2$stub$tmp: |
| 71 | ; PIC64: mflr r11 |
| 72 | ; PIC64: addis r11, r11, ha16(L_exact_log2$lazy_ptr-L_exact_log2$stub$tmp) |
| 73 | ; PIC64: mtlr r0 |
| 74 | ; PIC64: ldu r12, lo16(L_exact_log2$lazy_ptr-L_exact_log2$stub$tmp)(r11) |
| 75 | ; PIC64: mtctr r12 |
| 76 | ; PIC64: bctr |
| 77 | |
| 78 | ; PIC64: .section __DATA,__la_symbol_ptr,lazy_symbol_pointers |
| 79 | ; PIC64: L_exact_log2$lazy_ptr: |
| 80 | ; PIC64: .indirect_symbol _exact_log2 |
| 81 | ; PIC64: .quad dyld_stub_binding_helper |
| 82 | |
| 83 | ; PIC64: .subsections_via_symbols |
Chris Lattner | a9aa352 | 2009-07-15 01:43:31 +0000 | [diff] [blame] | 84 | |
| 85 | ; DYNAMIC: .section __TEXT,__symbol_stub1,symbol_stubs,pure_instructions,16 |
| 86 | ; DYNAMIC: L_exact_log2$stub: |
| 87 | ; DYNAMIC: .indirect_symbol _exact_log2 |
Benjamin Kramer | 915558e | 2012-11-24 13:18:25 +0000 | [diff] [blame^] | 88 | ; DYNAMIC: lis r11, ha16(L_exact_log2$lazy_ptr) |
| 89 | ; DYNAMIC: lwzu r12, lo16(L_exact_log2$lazy_ptr)(r11) |
Chris Lattner | a9aa352 | 2009-07-15 01:43:31 +0000 | [diff] [blame] | 90 | ; DYNAMIC: mtctr r12 |
| 91 | ; DYNAMIC: bctr |
| 92 | |
Chris Lattner | ff4bc46 | 2009-08-10 01:39:42 +0000 | [diff] [blame] | 93 | ; DYNAMIC: .section __DATA,__la_symbol_ptr,lazy_symbol_pointers |
Chris Lattner | a9aa352 | 2009-07-15 01:43:31 +0000 | [diff] [blame] | 94 | ; DYNAMIC: L_exact_log2$lazy_ptr: |
| 95 | ; DYNAMIC: .indirect_symbol _exact_log2 |
| 96 | ; DYNAMIC: .long dyld_stub_binding_helper |
| 97 | |
Benjamin Kramer | 915558e | 2012-11-24 13:18:25 +0000 | [diff] [blame^] | 98 | ; DYNAMIC64: .section __TEXT,__symbol_stub1,symbol_stubs,pure_instructions,16 |
| 99 | ; DYNAMIC64: L_exact_log2$stub: |
| 100 | ; DYNAMIC64: .indirect_symbol _exact_log2 |
| 101 | ; DYNAMIC64: lis r11, ha16(L_exact_log2$lazy_ptr) |
| 102 | ; DYNAMIC64: ldu r12, lo16(L_exact_log2$lazy_ptr)(r11) |
| 103 | ; DYNAMIC64: mtctr r12 |
| 104 | ; DYNAMIC64: bctr |
Chris Lattner | a9aa352 | 2009-07-15 01:43:31 +0000 | [diff] [blame] | 105 | |
Benjamin Kramer | 915558e | 2012-11-24 13:18:25 +0000 | [diff] [blame^] | 106 | ; DYNAMIC64: .section __DATA,__la_symbol_ptr,lazy_symbol_pointers |
| 107 | ; DYNAMIC64: L_exact_log2$lazy_ptr: |
| 108 | ; DYNAMIC64: .indirect_symbol _exact_log2 |
| 109 | ; DYNAMIC64: .quad dyld_stub_binding_helper |