1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-25 14:02:52 +02:00
llvm-mirror/test/CodeGen/Mips/compactbranches/compact-branches.ll
Daniel Sanders 14a7ad6b92 [mips] Don't derive the default ABI from the CPU in the backend.
Summary:
The backend has no reason to behave like a driver and should generally do
as it's told (and error out if it can't) instead of trying to figure out
what the API user meant. The default ABI is still derived from the arch
component as a concession to backwards compatibility.

API-users that previously passed an explicit CPU and a triple that was
inconsistent with the CPU (e.g. mips-linux-gnu and mips64r2) may get a
different ABI to what they got before. However, it's expected that there
are no such users on the basis that CodeGen has been asserting that the
triple is consistent with the selected ABI for several releases. API-users
that were consistent or passed '' or 'generic' as the CPU will see no
difference.

Reviewers: sdardis, rafael

Subscribers: rafael, dsanders, sdardis, llvm-commits

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

llvm-svn: 273557
2016-06-23 12:42:53 +00:00

207 lines
4.7 KiB
LLVM

; RUN: llc -march=mipsel -mcpu=mips32r6 -relocation-model=static -disable-mips-delay-filler < %s | FileCheck %s -check-prefix=STATIC32
; RUN: llc -march=mipsel -mcpu=mips64r6 -target-abi n64 -disable-mips-delay-filler < %s | FileCheck %s -check-prefix=PIC
; Function Attrs: nounwind
define void @l() {
entry:
; PIC: jalrc $25
%call = tail call i32 @k()
; PIC: jalrc $25
%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:
; STATIC: nop
; STATIC: jal
; PIC: jalrc $25
tail call void @f(i32 signext -2)
br label %if.end
if.end: ; preds = %if.then, %entry
; CHECK: jrc $ra
ret void
}
declare i32 @k()
declare i32 @j()
declare void @f(i32 signext)
; Function Attrs: define void @l2() {
define void @l2() {
entry:
; PIC: jalrc $25
%call = tail call i32 @k()
; PIC: jalrc $25
%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:
; STATIC: nop
; STATIC: jal
; PIC: jalrc $25
tail call void @f(i32 signext -1)
br label %if.end
if.end: ; preds = %entry, %if.then
; CHECK: jrc $ra
ret void
}
declare i32 @i()
; Function Attrs: nounwind
define void @l3() {
entry:
; PIC: jalrc $25
%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:
; STATIC: nop
; STATIC: jal
; PIC: jalrc $25
tail call void @f(i32 signext 0)
br label %if.end
if.end: ; preds = %if.then, %entry
; CHECK: jrc $ra
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:
; STATIC: nop
; STATIC: jal
tail call void @f(i32 signext 1)
br label %if.end
if.end: ; preds = %if.then, %entry
; CHECK: jrc $ra
ret void
}
; Function Attrs: nounwind
define void @l5() {
entry:
; PIC: jalrc $25
%call = tail call i32 @k()
; PIC: jalrc $25
%cmp = icmp sgt i32 %call, 0
; CHECK: blezc
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry:
; STATIC: nop
; STATIC: jal
; PIC: jalrc $25
tail call void @f(i32 signext 2)
br label %if.end
if.end: ; preds = %if.then, %entry
; CHECK: jrc $ra
ret void
}
; Function Attrs: nounwind
define void @l6() {
entry:
; PIC: jalrc $25
%call = tail call i32 @k()
; PIC: jalrc $25
%cmp = icmp sgt i32 %call, -1
; CHECK: bltzc
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry:
; STATIC: nop
; STATIC: jal
; PIC: jalrc $25
tail call void @f(i32 signext 3)
br label %if.end
if.end: ; preds = %if.then, %entry
; CHECK: jrc $ra
ret void
}
; Function Attrs: nounwind
define void @l7() {
entry:
; PIC: jalrc $25
%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:
; STATIC: nop
; STATIC: jal
; PIC: jalrc $25
tail call void @f(i32 signext 4)
br label %if.end
if.end: ; preds = %if.then, %entry
; CHECK: jrc $ra
ret void
}
; Function Attrs: nounwind
define void @l8() {
entry:
; PIC: jalrc $25
%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:
; STATIC: nop
; STATIC: jal
; PIC: jalrc $25
tail call void @f(i32 signext 5)
br label %if.end
if.end: ; preds = %entry, %if.then
; CHECK: jrc $ra
ret void
}
define i32 @l9(i8* ()* %i) #0 {
entry:
%i.addr = alloca i8* ()*, align 4
store i8* ()* %i, i8* ()** %i.addr, align 4
; STATIC32: jal
; STATIC32: nop
; PIC: jalrc $25
%call = call i32 @k()
; PIC: jalrc $25
%cmp = icmp ne i32 %call, 0
; CHECK: beqzc
br i1 %cmp, label %if.then, label %if.end
if.then: ; preds = %entry
%0 = load i8* ()*, i8* ()** %i.addr, align 4
; CHECK: jalrc $25
%call1 = call i8* %0()
br label %if.end
if.end: ; preds = %if.then, %entry
; CHECK: jrc $ra
ret i32 -1
}