Home | History | Annotate | Download | only in indirect-jump-hazard
      1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
      2 ; RUN: llc -mtriple=mips-unknwon-linux-gnu -mcpu=mips32r2 \
      3 ; RUN:   -mattr=+use-indirect-jump-hazard,+long-calls,+noabicalls %s -o - \
      4 ; RUN:   -verify-machineinstrs | FileCheck -check-prefix=O32 %s
      5 
      6 ; RUN: llc -mtriple=mips64-unknown-linux-gnu -mcpu=mips64r2 -target-abi n32 \
      7 ; RUN:   -mattr=+use-indirect-jump-hazard,+long-calls,+noabicalls %s -o - \
      8 ; RUN:   -verify-machineinstrs | FileCheck -check-prefix=N32 %s
      9 
     10 ; RUN: llc -mtriple=mips64-unknown-linux-gnu -mcpu=mips64r2 -target-abi n64 \
     11 ; RUN:   -mattr=+use-indirect-jump-hazard,+long-calls,+noabicalls %s -o - \
     12 ; RUN:   -verify-machineinstrs | FileCheck -check-prefix=N64 %s
     13 
     14 declare void @callee()
     15 declare void @llvm.memset.p0i8.i32(i8* nocapture writeonly, i8, i32, i1)
     16 
     17 @val = internal unnamed_addr global [20 x i32] zeroinitializer, align 4
     18 
     19 ; Test that the long call sequence uses the hazard barrier instruction variant.
     20 define void @caller() {
     21 ; O32-LABEL: caller:
     22 ; O32:       # %bb.0:
     23 ; O32-NEXT:    addiu $sp, $sp, -24
     24 ; O32-NEXT:    .cfi_def_cfa_offset 24
     25 ; O32-NEXT:    sw $ra, 20($sp) # 4-byte Folded Spill
     26 ; O32-NEXT:    .cfi_offset 31, -4
     27 ; O32-NEXT:    lui $1, %hi(callee)
     28 ; O32-NEXT:    addiu $25, $1, %lo(callee)
     29 ; O32-NEXT:    jalr.hb $25
     30 ; O32-NEXT:    nop
     31 ; O32-NEXT:    addiu $1, $zero, %lo(memset)
     32 ; O32-NEXT:    lui $2, %hi(memset)
     33 ; O32-NEXT:    addu $25, $2, $1
     34 ; O32-NEXT:    lui $1, %hi(val)
     35 ; O32-NEXT:    addiu $4, $1, %lo(val)
     36 ; O32-NEXT:    addiu $5, $zero, 0
     37 ; O32-NEXT:    jalr.hb $25
     38 ; O32-NEXT:    addiu $6, $zero, 80
     39 ; O32-NEXT:    lw $ra, 20($sp) # 4-byte Folded Reload
     40 ; O32-NEXT:    jr $ra
     41 ; O32-NEXT:    addiu $sp, $sp, 24
     42 ;
     43 ; N32-LABEL: caller:
     44 ; N32:       # %bb.0:
     45 ; N32-NEXT:    addiu $sp, $sp, -16
     46 ; N32-NEXT:    .cfi_def_cfa_offset 16
     47 ; N32-NEXT:    sd $ra, 8($sp) # 8-byte Folded Spill
     48 ; N32-NEXT:    .cfi_offset 31, -8
     49 ; N32-NEXT:    lui $1, %hi(callee)
     50 ; N32-NEXT:    addiu $25, $1, %lo(callee)
     51 ; N32-NEXT:    jalr.hb $25
     52 ; N32-NEXT:    nop
     53 ; N32-NEXT:    addiu $1, $zero, %lo(memset)
     54 ; N32-NEXT:    lui $2, %hi(memset)
     55 ; N32-NEXT:    addu $25, $2, $1
     56 ; N32-NEXT:    lui $1, %hi(val)
     57 ; N32-NEXT:    addiu $4, $1, %lo(val)
     58 ; N32-NEXT:    daddiu $5, $zero, 0
     59 ; N32-NEXT:    jalr.hb $25
     60 ; N32-NEXT:    daddiu $6, $zero, 80
     61 ; N32-NEXT:    ld $ra, 8($sp) # 8-byte Folded Reload
     62 ; N32-NEXT:    jr $ra
     63 ; N32-NEXT:    addiu $sp, $sp, 16
     64 ;
     65 ; N64-LABEL: caller:
     66 ; N64:       # %bb.0:
     67 ; N64-NEXT:    daddiu $sp, $sp, -16
     68 ; N64-NEXT:    .cfi_def_cfa_offset 16
     69 ; N64-NEXT:    sd $ra, 8($sp) # 8-byte Folded Spill
     70 ; N64-NEXT:    .cfi_offset 31, -8
     71 ; N64-NEXT:    lui $1, %highest(callee)
     72 ; N64-NEXT:    daddiu $1, $1, %higher(callee)
     73 ; N64-NEXT:    dsll $1, $1, 16
     74 ; N64-NEXT:    daddiu $1, $1, %hi(callee)
     75 ; N64-NEXT:    dsll $1, $1, 16
     76 ; N64-NEXT:    daddiu $25, $1, %lo(callee)
     77 ; N64-NEXT:    jalr.hb $25
     78 ; N64-NEXT:    nop
     79 ; N64-NEXT:    daddiu $1, $zero, %higher(memset)
     80 ; N64-NEXT:    lui $2, %highest(memset)
     81 ; N64-NEXT:    daddu $1, $2, $1
     82 ; N64-NEXT:    dsll $1, $1, 16
     83 ; N64-NEXT:    lui $2, %hi(memset)
     84 ; N64-NEXT:    daddu $1, $1, $2
     85 ; N64-NEXT:    dsll $1, $1, 16
     86 ; N64-NEXT:    daddiu $2, $zero, %lo(memset)
     87 ; N64-NEXT:    daddu $25, $1, $2
     88 ; N64-NEXT:    lui $1, %highest(val)
     89 ; N64-NEXT:    daddiu $1, $1, %higher(val)
     90 ; N64-NEXT:    dsll $1, $1, 16
     91 ; N64-NEXT:    daddiu $1, $1, %hi(val)
     92 ; N64-NEXT:    dsll $1, $1, 16
     93 ; N64-NEXT:    daddiu $4, $1, %lo(val)
     94 ; N64-NEXT:    daddiu $5, $zero, 0
     95 ; N64-NEXT:    jalr.hb $25
     96 ; N64-NEXT:    daddiu $6, $zero, 80
     97 ; N64-NEXT:    ld $ra, 8($sp) # 8-byte Folded Reload
     98 ; N64-NEXT:    jr $ra
     99 ; N64-NEXT:    daddiu $sp, $sp, 16
    100   call void @callee()
    101   call void @llvm.memset.p0i8.i32(i8* align 4 bitcast ([20 x i32]* @val to i8*), i8 0, i32 80, i1 false)
    102   ret  void
    103 }
    104 
    105