Start static relocation implementation for mips16.
[oota-llvm.git] / test / CodeGen / Mips / helloworld.ll
1 ; RUN: llc  -march=mipsel -mcpu=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=C1
2 ; RUN: llc  -march=mipsel -mcpu=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=C2
3 ; RUN: llc  -march=mipsel -mcpu=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=PE
4 ; RUN: llc  -march=mipsel -mcpu=mips16 -relocation-model=static -O3 < %s | FileCheck %s -check-prefix=ST1
5 ; RUN: llc  -march=mipsel -mcpu=mips16 -relocation-model=static -O3 < %s | FileCheck %s -check-prefix=ST2
6 ;
7 ; re-enable this when mips16's jalr is fixed.
8 ; DISABLED: llc  -march=mipsel -mcpu=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=SR
9
10
11 @.str = private unnamed_addr constant [13 x i8] c"hello world\0A\00", align 1
12
13 define i32 @main() nounwind {
14 entry:
15   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([13 x i8]* @.str, i32 0, i32 0))
16   ret i32 0
17
18 ; SR:   .set    mips16                  # @main
19
20 ; SR:   save    $ra, [[FS:[0-9]+]]
21 ; PE:   li      $[[T1:[0-9]+]], %hi(_gp_disp)
22 ; PE:   addiu   $[[T2:[0-9]+]], $pc, %lo(_gp_disp)
23 ; PE:   sll     $[[T3:[0-9]+]], $[[T1]], 16
24 ; C1:   lw      ${{[0-9]+}}, %got($.str)(${{[0-9]+}})
25 ; C2:   lw      ${{[0-9]+}}, %call16(printf)(${{[0-9]+}})
26 ; C1:   addiu   ${{[0-9]+}}, %lo($.str)
27 ; C2:   move    $25, ${{[0-9]+}}
28 ; C1:   move    $gp, ${{[0-9]+}}
29 ; C1:   jalrc   ${{[0-9]+}}
30 ; SR:   restore         $ra, [[FS]]
31 ; PE:   li      $2, 0
32 ; PE:   jrc     $ra
33
34 ; ST1:  li      ${{[0-9]+}}, %hi($.str)
35 ; ST1:  sll     ${{[0-9]+}}, ${{[0-9]+}}, 16
36 ; ST1:  addiu   ${{[0-9]+}}, %lo($.str)
37 ; ST2:  li      ${{[0-9]+}}, %hi($.str)
38 ; ST2:  jal     printf
39 }
40
41 declare i32 @printf(i8*, ...)