blob: fdead7dd8b342761d9083545ed7564f09e819b8d [file] [log] [blame]
Dan Gohmanfce288f2009-09-09 00:09:15 +00001; RUN: llc < %s -relocation-model=static | FileCheck %s -check-prefix=STATIC
2; RUN: llc < %s -relocation-model=pic | FileCheck %s -check-prefix=PIC
3; RUN: llc < %s -relocation-model=dynamic-no-pic | FileCheck %s -check-prefix=DYNAMIC
Chris Lattner4fb75e52009-07-01 16:53:44 +00004; PR4482
5target 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"
6target triple = "powerpc-apple-darwin8"
7
8define i32 @foo(i64 %x) nounwind {
9entry:
Chris Lattnera9aa3522009-07-15 01:43:31 +000010; STATIC: _foo:
11; STATIC: bl _exact_log2
12; STATIC: blr
13; STATIC: .subsections_via_symbols
14
15; PIC: _foo:
16; PIC: bl L_exact_log2$stub
17; PIC: blr
18
19; DYNAMIC: _foo:
20; DYNAMIC: bl L_exact_log2$stub
21; DYNAMIC: blr
22
Chris Lattner0bc26722009-07-15 01:32:33 +000023 %A = call i32 @exact_log2(i64 %x) nounwind
24 ret i32 %A
Chris Lattner4fb75e52009-07-01 16:53:44 +000025}
26
27define available_externally i32 @exact_log2(i64 %x) nounwind {
28entry:
Chris Lattner0bc26722009-07-15 01:32:33 +000029 ret i32 42
Chris Lattner4fb75e52009-07-01 16:53:44 +000030}
Chris Lattnera9aa3522009-07-15 01:43:31 +000031
32
33; PIC: .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
34; PIC: L_exact_log2$stub:
35; PIC: .indirect_symbol _exact_log2
36; PIC: mflr r0
Chris Lattner392db3e2009-07-15 02:56:53 +000037; PIC: bcl 20,31,L_exact_log2$stub$tmp
Chris Lattnera9aa3522009-07-15 01:43:31 +000038
Chris Lattner392db3e2009-07-15 02:56:53 +000039; PIC: L_exact_log2$stub$tmp:
Chris Lattnera9aa3522009-07-15 01:43:31 +000040; PIC: mflr r11
Chris Lattner392db3e2009-07-15 02:56:53 +000041; PIC: addis r11,r11,ha16(L_exact_log2$lazy_ptr-L_exact_log2$stub$tmp)
Chris Lattnera9aa3522009-07-15 01:43:31 +000042; PIC: mtlr r0
Chris Lattner392db3e2009-07-15 02:56:53 +000043; PIC: lwzu r12,lo16(L_exact_log2$lazy_ptr-L_exact_log2$stub$tmp)(r11)
Chris Lattnera9aa3522009-07-15 01:43:31 +000044; PIC: mtctr r12
45; PIC: bctr
46
Chris Lattnerff4bc462009-08-10 01:39:42 +000047; PIC: .section __DATA,__la_symbol_ptr,lazy_symbol_pointers
Chris Lattnera9aa3522009-07-15 01:43:31 +000048; PIC: L_exact_log2$lazy_ptr:
49; PIC: .indirect_symbol _exact_log2
50; PIC: .long dyld_stub_binding_helper
51
52; PIC: .subsections_via_symbols
53
54
55; DYNAMIC: .section __TEXT,__symbol_stub1,symbol_stubs,pure_instructions,16
56; DYNAMIC: L_exact_log2$stub:
57; DYNAMIC: .indirect_symbol _exact_log2
58; DYNAMIC: lis r11,ha16(L_exact_log2$lazy_ptr)
59; DYNAMIC: lwzu r12,lo16(L_exact_log2$lazy_ptr)(r11)
60; DYNAMIC: mtctr r12
61; DYNAMIC: bctr
62
Chris Lattnerff4bc462009-08-10 01:39:42 +000063; DYNAMIC: .section __DATA,__la_symbol_ptr,lazy_symbol_pointers
Chris Lattnera9aa3522009-07-15 01:43:31 +000064; DYNAMIC: L_exact_log2$lazy_ptr:
65; DYNAMIC: .indirect_symbol _exact_log2
66; DYNAMIC: .long dyld_stub_binding_helper
67
68
69
70
71