58 lines · plain
1; RUN: llc -mtriple=mips -mattr=-long-calls %s -o - \2; RUN: | FileCheck -check-prefix=OFF %s3; RUN: llc -mtriple=mips -mattr=+long-calls,+noabicalls %s -o - \4; RUN: | FileCheck -check-prefix=ON32 %s5 6; RUN: llc -mtriple=mips -mattr=+long-calls,-noabicalls %s -o - \7; RUN: | FileCheck -check-prefix=OFF %s8 9; RUN: llc -mtriple=mips64 -target-abi n32 -mattr=-long-calls %s -o - \10; RUN: | FileCheck -check-prefix=OFF %s11; RUN: llc -mtriple=mips64 -target-abi n32 -mattr=+long-calls,+noabicalls %s -o - \12; RUN: | FileCheck -check-prefix=ON32 %s13 14; RUN: llc -mtriple=mips64 -target-abi n64 -mattr=-long-calls %s -o - \15; RUN: | FileCheck -check-prefix=OFF %s16; RUN: llc -mtriple=mips64 -target-abi n64 -mattr=+long-calls,+noabicalls %s -o - \17; RUN: | FileCheck -check-prefix=ON64 %s18 19declare void @callee()20declare void @llvm.memset.p0.i32(ptr nocapture writeonly, i8, i32, i1)21 22@val = internal unnamed_addr global [20 x i32] zeroinitializer, align 423 24define void @caller() {25 26; Use `jal` instruction with R_MIPS_26 relocation.27; OFF: jal callee28; OFF: jal memset29 30; Save the `callee` and `memset` addresses in $25 register31; and use `jalr` for the jumps.32; ON32: lui $1, %hi(callee)33; ON32: addiu $25, $1, %lo(callee)34; ON32: jalr $2535 36; ON32: lui $1, %hi(memset)37; ON32: addiu $25, $1, %lo(memset)38; ON32: jalr $2539 40; ON64: lui $1, %highest(callee)41; ON64: daddiu $1, $1, %higher(callee)42; ON64: daddiu $1, $1, %hi(callee)43; ON64: daddiu $25, $1, %lo(callee)44; ON64: jalr $2545 46; ON64: lui $2, %highest(memset)47; ON64: daddiu $1, $2, %higher(memset)48; ON64: dsll $1, $1, 1649; ON64: daddiu $1, $1, %hi(memset)50; ON64: dsll $1, $1, 1651; ON64: daddiu $25, $1, %lo(memset)52; ON64: jalr $2553 54 call void @callee()55 call void @llvm.memset.p0.i32(ptr align 4 @val, i8 0, i32 80, i1 false)56 ret void57}58