summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorReed Kotler <rkotler@mips.com>2013-12-10 14:29:38 +0000
committerReed Kotler <rkotler@mips.com>2013-12-10 14:29:38 +0000
commit526522728ccac69dc8df2aa91735ec5c7495fa20 (patch)
tree385d401809a1e466112061f3b755402d444bb29c /test
parent8a8581ca4b4c9ca1797ec5f4fa7d5524a59239ea (diff)
downloadllvm-526522728ccac69dc8df2aa91735ec5c7495fa20.tar.gz
llvm-526522728ccac69dc8df2aa91735ec5c7495fa20.tar.bz2
llvm-526522728ccac69dc8df2aa91735ec5c7495fa20.tar.xz
Next step in Mips16 prologue/epilogue cleanup.
Save S2(reg 18) only when we are calling floating point stubs that have a return value of float or complex. Some more work to make this better but this is the first step. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196921 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/Mips/align16.ll4
-rw-r--r--test/CodeGen/Mips/alloca16.ll2
-rw-r--r--test/CodeGen/Mips/ex2.ll7
-rw-r--r--test/CodeGen/Mips/helloworld.ll4
-rw-r--r--test/CodeGen/Mips/s2rem.ll95
5 files changed, 103 insertions, 9 deletions
diff --git a/test/CodeGen/Mips/align16.ll b/test/CodeGen/Mips/align16.ll
index 1b724e9fc8..32ec94bd20 100644
--- a/test/CodeGen/Mips/align16.ll
+++ b/test/CodeGen/Mips/align16.ll
@@ -25,7 +25,7 @@ entry:
call void @p(i32* %arrayidx1)
ret void
}
-; 16: save $ra, $16, $17, $18, 2040
+; 16: save $ra, $16, $17, 2040
; 16: addiu $sp, -56 # 16 bit inst
; 16: addiu $sp, 56 # 16 bit inst
-; 16: restore $ra, $16, $17, $18, 2040
+; 16: restore $ra, $16, $17, 2040
diff --git a/test/CodeGen/Mips/alloca16.ll b/test/CodeGen/Mips/alloca16.ll
index a836d12488..5bdf4dd783 100644
--- a/test/CodeGen/Mips/alloca16.ll
+++ b/test/CodeGen/Mips/alloca16.ll
@@ -20,7 +20,7 @@ entry:
define void @test() nounwind {
entry:
; 16: .frame $sp,24,$ra
-; 16: save $ra, $16, $17, $18, 24
+; 16: save $ra, $16, $17, 24
; 16: move $16, $sp
; 16: move ${{[0-9]+}}, $sp
; 16: subu $[[REGISTER:[0-9]+]], ${{[0-9]+}}, ${{[0-9]+}}
diff --git a/test/CodeGen/Mips/ex2.ll b/test/CodeGen/Mips/ex2.ll
index 5b3463e509..75562156cf 100644
--- a/test/CodeGen/Mips/ex2.ll
+++ b/test/CodeGen/Mips/ex2.ll
@@ -6,12 +6,11 @@
define i32 @main() {
; 16-LABEL: main:
; 16: .cfi_startproc
-; 16: save $ra, $16, $17, $18, 40
+; 16: save $ra, $16, $17, 40
; 16: .cfi_def_cfa_offset 40
-; 16: .cfi_offset 18, -8
-; 16: .cfi_offset 17, -12
-; 16: .cfi_offset 16, -16
; 16: .cfi_offset 31, -4
+; 16: .cfi_offset 17, -8
+; 16: .cfi_offset 16, -12
; 16: .cfi_endproc
entry:
%retval = alloca i32, align 4
diff --git a/test/CodeGen/Mips/helloworld.ll b/test/CodeGen/Mips/helloworld.ll
index 32bc45fba3..d363006a55 100644
--- a/test/CodeGen/Mips/helloworld.ll
+++ b/test/CodeGen/Mips/helloworld.ll
@@ -25,7 +25,7 @@ entry:
; SR32: .set noreorder
; SR32: .set nomacro
; SR32: .set noat
-; SR: save $ra, $16, $17, $18, [[FS:[0-9]+]]
+; SR: save $ra, $16, $17, [[FS:[0-9]+]]
; PE: .ent main
; PE: .align 2
; PE-NEXT: li $[[T1:[0-9]+]], %hi(_gp_disp)
@@ -37,7 +37,7 @@ entry:
; C2: move $25, ${{[0-9]+}}
; C1: move $gp, ${{[0-9]+}}
; C1: jalrc ${{[0-9]+}}
-; SR: restore $ra, $16, $17, $18, [[FS]]
+; SR: restore $ra, $16, $17, [[FS]]
; PE: li $2, 0
; PE: jrc $ra
diff --git a/test/CodeGen/Mips/s2rem.ll b/test/CodeGen/Mips/s2rem.ll
new file mode 100644
index 0000000000..0f0b3edade
--- /dev/null
+++ b/test/CodeGen/Mips/s2rem.ll
@@ -0,0 +1,95 @@
+; RUN: llc -mtriple=mipsel-linux-gnu -march=mipsel -mcpu=mips16 -relocation-model=pic < %s | FileCheck %s -check-prefix=NEG
+
+; RUN: llc -mtriple=mipsel-linux-gnu -march=mipsel -mcpu=mips16 -relocation-model=static < %s | FileCheck %s -check-prefix=NEG
+
+; RUN: llc -mtriple=mipsel-linux-gnu -march=mipsel -mcpu=mips16 -relocation-model=pic < %s | FileCheck %s
+
+; RUN: llc -mtriple=mipsel-linux-gnu -march=mipsel -mcpu=mips16 -relocation-model=static < %s | FileCheck %s
+
+@xi = common global i32 0, align 4
+@x = common global float 0.000000e+00, align 4
+@xd = common global double 0.000000e+00, align 8
+
+; Function Attrs: nounwind
+define void @it() #0 {
+entry:
+ %call = call i32 @i(i32 1)
+ store i32 %call, i32* @xi, align 4
+ ret void
+; CHECK: .ent it
+; NEG: .ent it
+; CHECK: save $ra, $16, $17, [[FS:[0-9]+]]
+; NEG-NOT: save $ra, $16, $17, [[FS:[0-9]+]], $18
+; CHECK: restore $ra, $16, $17, [[FS]]
+; NEG-NOT: restore $ra, $16, $17, [[FS:[0-9]+]], $18
+; CHECK: .end it
+; NEG: .end it
+}
+
+declare i32 @i(i32) #1
+
+; Function Attrs: nounwind
+define void @ft() #0 {
+entry:
+ %call = call float @f()
+ store float %call, float* @x, align 4
+ ret void
+; CHECK: .ent ft
+; CHECK: save $ra, $16, $17, [[FS:[0-9]+]], $18
+; CHECK: restore $ra, $16, $17, [[FS]], $18
+; CHECK: .end ft
+}
+
+declare float @f() #1
+
+; Function Attrs: nounwind
+define void @dt() #0 {
+entry:
+ %call = call double @d()
+ store double %call, double* @xd, align 8
+ ret void
+; CHECK: .ent dt
+; CHECK: save $ra, $16, $17, [[FS:[0-9]+]], $18
+; CHECK: restore $ra, $16, $17, [[FS]], $18
+; CHECK: .end dt
+}
+
+declare double @d() #1
+
+; Function Attrs: nounwind
+define void @fft() #0 {
+entry:
+ %0 = load float* @x, align 4
+ %call = call float @ff(float %0)
+ store float %call, float* @x, align 4
+ ret void
+; CHECK: .ent fft
+; CHECK: save $ra, $16, $17, [[FS:[0-9]+]], $18
+; CHECK: restore $ra, $16, $17, [[FS]], $18
+; CHECK: .end fft
+}
+
+declare float @ff(float) #1
+
+; Function Attrs: nounwind
+define void @vft() #0 {
+entry:
+ %0 = load float* @x, align 4
+ call void @vf(float %0)
+ ret void
+; CHECK: .ent vft
+; NEG: .ent vft
+; CHECK: save $ra, $16, $17, [[FS:[0-9]+]]
+; NEG-NOT: save $ra, $16, $17, [[FS:[0-9]+]], $18
+; CHECK: restore $ra, $16, $17, [[FS]]
+; NEG-NOT: restore $ra, $16, $17, [[FS:[0-9]+]], $18
+; CHECK: .end vft
+; NEG: .end vft
+}
+
+declare void @vf(float) #1
+
+attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+
+