Home | History | Annotate | Download | only in Mips
      1 ; RUN: llc  < %s -march=mipsel | FileCheck %s
      2 
      3 @caller.sf1 = internal unnamed_addr global void (...)* null, align 4
      4 @gf1 = external global void (...)*
      5 @.str = private unnamed_addr constant [3 x i8] c"f2\00"
      6 
      7 define i32 @main(i32 %argc, i8** nocapture %argv) nounwind {
      8 entry:
      9 ; CHECK: lw $[[R0:[0-9]+]], %got(f2)($gp)
     10 ; CHECK: addiu $25, $[[R0]], %lo(f2)
     11   tail call fastcc void @f2()
     12   ret i32 0
     13 }
     14 
     15 define void @caller(i32 %a0, i32 %a1) nounwind {
     16 entry:
     17 ; CHECK: lw  $[[R1:[0-9]+]], %got(caller.sf1)($gp)
     18 ; CHECK: lw  $25, %lo(caller.sf1)($[[R1]])
     19   %tobool = icmp eq i32 %a1, 0
     20   br i1 %tobool, label %if.end, label %if.then
     21 
     22 if.then:                                          ; preds = %entry
     23   %tmp1 = load void (...)** @caller.sf1, align 4
     24   tail call void (...)* %tmp1() nounwind
     25   br label %if.end
     26 
     27 if.end:                                           ; preds = %entry, %if.then
     28 ; CHECK: lw  $[[R2:[0-9]+]], %got(sf2)($gp)
     29 ; CHECK: addiu ${{[0-9]+}}, $[[R2]], %lo(sf2)
     30 ; CHECK: lw  $[[R3:[0-9]+]], %got(caller.sf1)($gp)
     31 ; CHECK: sw  ${{[0-9]+}}, %lo(caller.sf1)($[[R3]])
     32   %tobool3 = icmp ne i32 %a0, 0
     33   %tmp4 = load void (...)** @gf1, align 4
     34   %cond = select i1 %tobool3, void (...)* %tmp4, void (...)* bitcast (void ()* @sf2 to void (...)*)
     35   store void (...)* %cond, void (...)** @caller.sf1, align 4
     36   ret void
     37 }
     38 
     39 define internal void @sf2() nounwind {
     40 entry:
     41   %call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0)) nounwind
     42   ret void
     43 }
     44 
     45 declare i32 @printf(i8* nocapture, ...) nounwind
     46 
     47 define internal fastcc void @f2() nounwind noinline {
     48 entry:
     49   %call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([3 x i8]* @.str, i32 0, i32 0)) nounwind
     50   ret void
     51 }
     52 
     53