Home | History | Annotate | Download | only in Mips
      1 ; RUN: llc -march=mips -mattr=-long-calls %s -o - \
      2 ; RUN:   | FileCheck -check-prefix=OFF %s
      3 ; RUN: llc -march=mips -mattr=+long-calls,+noabicalls %s -o - \
      4 ; RUN:   | FileCheck -check-prefix=ON32 %s
      5 
      6 ; RUN: llc -march=mips -mattr=+long-calls,-noabicalls %s -o - \
      7 ; RUN:   | FileCheck -check-prefix=OFF %s
      8 
      9 ; RUN: llc -march=mips64 -target-abi n32 -mattr=-long-calls %s -o - \
     10 ; RUN:   | FileCheck -check-prefix=OFF %s
     11 ; RUN: llc -march=mips64 -target-abi n32 -mattr=+long-calls,+noabicalls %s -o - \
     12 ; RUN:   | FileCheck -check-prefix=ON32 %s
     13 
     14 ; RUN: llc -march=mips64 -target-abi n64 -mattr=-long-calls %s -o - \
     15 ; RUN:   | FileCheck -check-prefix=OFF %s
     16 ; RUN: llc -march=mips64 -target-abi n64 -mattr=+long-calls,+noabicalls %s -o - \
     17 ; RUN:   | FileCheck -check-prefix=ON64 %s
     18 
     19 declare void @callee()
     20 declare void @llvm.memset.p0i8.i32(i8* nocapture writeonly, i8, i32, i1)
     21 
     22 @val = internal unnamed_addr global [20 x i32] zeroinitializer, align 4
     23 
     24 define void @caller() {
     25 
     26 ; Use `jal` instruction with R_MIPS_26 relocation.
     27 ; OFF: jal callee
     28 ; OFF: jal memset
     29 
     30 ; Save the `callee` and `memset` addresses in $25 register
     31 ; and use `jalr` for the jumps.
     32 ; ON32: lui    $1, %hi(callee)
     33 ; ON32: addiu  $25, $1, %lo(callee)
     34 ; ON32: jalr   $25
     35 
     36 ; ON32: addiu  $1, $zero, %lo(memset)
     37 ; ON32: lui    $2, %hi(memset)
     38 ; ON32: addu   $25, $2, $1
     39 ; ON32: jalr   $25
     40 
     41 ; ON64: lui     $1, %highest(callee)
     42 ; ON64: daddiu  $1, $1, %higher(callee)
     43 ; ON64: daddiu  $1, $1, %hi(callee)
     44 ; ON64: daddiu  $25, $1, %lo(callee)
     45 ; ON64: jalr    $25
     46 
     47 ; ON64: daddiu  $1, $zero, %higher(memset)
     48 ; ON64: lui     $2, %highest(memset)
     49 ; ON64: lui     $2, %hi(memset)
     50 ; ON64: daddiu  $2, $zero, %lo(memset)
     51 ; ON64: daddu   $25, $1, $2
     52 ; ON64: jalr    $25
     53 
     54   call void @callee()
     55   call void @llvm.memset.p0i8.i32(i8* align 4 bitcast ([20 x i32]* @val to i8*), i8 0, i32 80, i1 false)
     56   ret  void
     57 }
     58