1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
llvm-mirror/test/CodeGen/Mips/nacl-branch-delay.ll
Simon Dardis 9fd70b27da [mips] Enable tail calls by default
Enable tail calls by default for (micro)MIPS(64).

microMIPS is slightly more tricky than doing it for MIPS(R6) or microMIPSR6.
microMIPS has two instruction encodings: 16bit and 32bit along with some
restrictions on the size of the instruction that can fill the delay slot.
For safe tail calls for microMIPS, the delay slot filler attempts to find
a correct size instruction for the delay slot of TAILCALL pseudos.

Reviewers: dsanders, vkalintris

Subscribers: jfb, dsanders, sdardis, llvm-commits

Differential Revision: https://reviews.llvm.org/D21138

llvm-svn: 277708
2016-08-04 09:17:07 +00:00

72 lines
1.7 KiB
LLVM

; RUN: llc -filetype=asm -mtriple=mipsel-none-linux -relocation-model=static \
; RUN: -O3 < %s | FileCheck %s
; RUN: llc -filetype=asm -mtriple=mipsel-none-nacl -relocation-model=static \
; RUN: -O3 < %s | FileCheck %s -check-prefix=CHECK-NACL
@x = global i32 0, align 4
declare void @f1(i32)
declare void @f2()
define void @test1() {
%1 = load i32, i32* @x, align 4
call void @f1(i32 %1)
ret void
; CHECK-LABEL: test1
; We first make sure that for non-NaCl targets branch-delay slot contains
; dangerous instructions.
; Check that branch-delay slot is used to load argument from x before function
; call.
; CHECK: jal
; CHECK-NEXT: lw $4, %lo(x)(${{[0-9]+}})
; Check that branch-delay slot is used for adjusting sp before return.
; CHECK: jr $ra
; CHECK-NEXT: addiu $sp, $sp, {{[0-9]+}}
; For NaCl, check that branch-delay slot doesn't contain dangerous instructions.
; CHECK-NACL: jal
; CHECK-NACL-NEXT: nop
; CHECK-NACL: jr $ra
; CHECK-NACL-NEXT: nop
}
define void @test2() {
store i32 1, i32* @x, align 4
call void @f2()
ret void
; CHECK-LABEL: test2
; Check that branch-delay slot is used for storing to x before function call.
; CHECK: jal
; CHECK-NEXT: sw ${{[0-9]+}}, %lo(x)(${{[0-9]+}})
; Check that branch-delay slot is used for adjusting sp before return.
; CHECK: jr $ra
; CHECK-NEXT: addiu $sp, $sp, {{[0-9]+}}
; For NaCl, check that branch-delay slot doesn't contain dangerous instructions.
; CHECK-NACL: jal
; CHECK-NACL-NEXT: nop
; CHECK-NACL: jr $ra
; CHECK-NACL-NEXT: nop
}