Files
clang-p2996/llvm/test/CodeGen/Mips/compactbranches/compact-branches.ll
Daniel Sanders e8efff373a [mips] MIPS32R6 compact branch support
Summary:
MIPSR6 introduces a class of branches called compact branches. Unlike the
traditional MIPS branches which have a delay slot, compact branches do not
have a delay slot. The instruction following the compact branch is only
executed if the branch is not taken and must not be a branch.

It works by generating compact branches for MIPS32R6 when the delay slot
filler cannot fill a delay slot. Then, inspecting the generated code for
forbidden slot hazards (a compact branch with an adjacent branch or other
CTI) and inserting nops to clear this hazard.

Patch by Simon Dardis.

Reviewers: vkalintiris, dsanders

Subscribers: MatzeB, dsanders, llvm-commits

Differential Revision: http://reviews.llvm.org/D16353

llvm-svn: 263444
2016-03-14 16:24:05 +00:00

156 lines
3.5 KiB
LLVM

; RUN: llc -march=mipsel -mcpu=mips32r6 -relocation-model=static < %s | FileCheck %s
; Function Attrs: nounwind
define void @l() {
entry:
%call = tail call i32 @k()
%call1 = tail call i32 @j()
%cmp = icmp eq i32 %call, %call1
; CHECK: bnec
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry:
; CHECK: nop
; CHECK: jal
tail call void @f(i32 signext -2)
br label %if.end
if.end: ; preds = %if.then, %entry
ret void
}
declare i32 @k()
declare i32 @j()
declare void @f(i32 signext)
; Function Attrs: define void @l2() {
define void @l2() {
entry:
%call = tail call i32 @k()
%call1 = tail call i32 @i()
%cmp = icmp eq i32 %call, %call1
; CHECK beqc
br i1 %cmp, label %if.end, label %if.then
if.then: ; preds = %entry:
; CHECK: nop
; CHECK: jal
tail call void @f(i32 signext -1)
br label %if.end
if.end: ; preds = %entry, %if.then
ret void
}
declare i32 @i()
; Function Attrs: nounwind
define void @l3() {
entry:
%call = tail call i32 @k()
%cmp = icmp slt i32 %call, 0
; CHECK : bgez
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry:
; CHECK: nop
; CHECK: jal
tail call void @f(i32 signext 0)
br label %if.end
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nounwind
define void @l4() {
entry:
%call = tail call i32 @k()
%cmp = icmp slt i32 %call, 1
; CHECK: bgtzc
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry:
; CHECK: nop
; CHECK: jal
tail call void @f(i32 signext 1)
br label %if.end
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nounwind
define void @l5() {
entry:
%call = tail call i32 @k()
%cmp = icmp sgt i32 %call, 0
; CHECK: blezc
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry:
; CHECK: nop
; CHECK: jal
tail call void @f(i32 signext 2)
br label %if.end
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nounwind
define void @l6() {
entry:
%call = tail call i32 @k()
%cmp = icmp sgt i32 %call, -1
; CHECK: bltzc
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry:
; CHECK: nop
; CHECK: jal
tail call void @f(i32 signext 3)
br label %if.end
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nounwind
define void @l7() {
entry:
%call = tail call i32 @k()
%cmp = icmp eq i32 %call, 0
; CHECK: bnezc
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry:
; CHECK: nop
; CHECK: jal
tail call void @f(i32 signext 4)
br label %if.end
if.end: ; preds = %if.then, %entry
ret void
}
; Function Attrs: nounwind
define void @l8() {
entry:
%call = tail call i32 @k()
%cmp = icmp eq i32 %call, 0
; CHECK: beqzc
br i1 %cmp, label %if.end, label %if.then
if.then: ; preds = %entry:
; CHECK: nop
; CHECK: jal
tail call void @f(i32 signext 5)
br label %if.end
if.end: ; preds = %entry, %if.then
ret void
}