summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/mips
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-10 15:21:18 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-10 15:21:18 +0000
commit6c6dc52075a16822b622dba2a09ee1da00699913 (patch)
tree84b52cb4914fe1d57662b286e0ad66d3b56a337f /gcc/testsuite/gcc.target/mips
parent7938ee8cfc0017a56ad839e2624b953d6c5465af (diff)
downloadgcc-6c6dc52075a16822b622dba2a09ee1da00699913.tar.gz
gcc/
* config/mips/mips.c (mips_global_pointer): Check call_really_used_regs instead of call_used_regs. (mips_save_reg_p): Likewise. Save all call-saved registers if current_function_saves_all_registers. Fix indentation. No longer treat $18 as a special case. (compute_frame_size): Guard FPR loop with TARGET_HARD_FLOAT. gcc/testsuite/ * gcc.target/mips/call-saved-1.c: New test. * gcc.target/mips/call-saved-2.c: Likewise. * gcc.target/mips/call-saved-3.c: Likewise. * gcc.target/mips/mips.exp (setup_mips_tests): Set mips_gp64 instead of mips_mips64. Set mips_fp64 too. (is_gp32_flag): Return true for -mips1 and -mips2. (dg-mips-options): Use mips_gp64 instead of mips_mips64. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128347 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.target/mips')
-rw-r--r--gcc/testsuite/gcc.target/mips/call-saved-1.c20
-rw-r--r--gcc/testsuite/gcc.target/mips/call-saved-2.c18
-rw-r--r--gcc/testsuite/gcc.target/mips/call-saved-3.c21
-rw-r--r--gcc/testsuite/gcc.target/mips/mips.exp24
4 files changed, 76 insertions, 7 deletions
diff --git a/gcc/testsuite/gcc.target/mips/call-saved-1.c b/gcc/testsuite/gcc.target/mips/call-saved-1.c
new file mode 100644
index 00000000000..957b0c598bd
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/call-saved-1.c
@@ -0,0 +1,20 @@
+/* Check that we save all call-saved GPRs in a MIPS16 __builtin_eh_return
+ function. */
+/* { dg-mips-options "-mips2 -mips16 -mno-abicalls" } */
+
+void bar (void);
+void
+foo (int x)
+{
+ __builtin_unwind_init ();
+ __builtin_eh_return (x, bar);
+}
+/* { dg-final { scan-assembler "\\\$16" } } */
+/* { dg-final { scan-assembler "\\\$17" } } */
+/* { dg-final { scan-assembler "\\\$18" } } */
+/* { dg-final { scan-assembler "\\\$19" } } */
+/* { dg-final { scan-assembler "\\\$20" } } */
+/* { dg-final { scan-assembler "\\\$21" } } */
+/* { dg-final { scan-assembler "\\\$22" } } */
+/* { dg-final { scan-assembler "\\\$23" } } */
+/* { dg-final { scan-assembler "\\\$(30|fp)" } } */
diff --git a/gcc/testsuite/gcc.target/mips/call-saved-2.c b/gcc/testsuite/gcc.target/mips/call-saved-2.c
new file mode 100644
index 00000000000..89288967283
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/call-saved-2.c
@@ -0,0 +1,18 @@
+/* Check that we save non-MIPS16 GPRs if they are explicitly clobbered. */
+/* { dg-mips-options "-mips2 -mips16 -mno-abicalls -O2" } */
+
+void
+foo (void)
+{
+ asm volatile ("" ::: "$19", "$23", "$24", "$30");
+}
+/* { dg-final { scan-assembler-not "\\\$16" } } */
+/* { dg-final { scan-assembler-not "\\\$17" } } */
+/* { dg-final { scan-assembler-not "\\\$18" } } */
+/* { dg-final { scan-assembler "\\\$19" } } */
+/* { dg-final { scan-assembler-not "\\\$20" } } */
+/* { dg-final { scan-assembler-not "\\\$21" } } */
+/* { dg-final { scan-assembler-not "\\\$22" } } */
+/* { dg-final { scan-assembler "\\\$23" } } */
+/* { dg-final { scan-assembler-not "\\\$24" } } */
+/* { dg-final { scan-assembler "\\\$(30|fp)" } } */
diff --git a/gcc/testsuite/gcc.target/mips/call-saved-3.c b/gcc/testsuite/gcc.target/mips/call-saved-3.c
new file mode 100644
index 00000000000..f1d93793b3c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/call-saved-3.c
@@ -0,0 +1,21 @@
+/* Check that we save all call-saved GPRs in a MIPS16 __builtin_setjmp
+ function. */
+/* { dg-mips-options "-mips2 -mips16 -mno-abicalls -O2" } */
+
+void bar (void);
+extern int buf[];
+void
+foo (int x)
+{
+ if (__builtin_setjmp (buf) == 0)
+ bar();
+}
+/* { dg-final { scan-assembler "\\\$16" } } */
+/* { dg-final { scan-assembler "\\\$17" } } */
+/* { dg-final { scan-assembler "\\\$18" } } */
+/* { dg-final { scan-assembler "\\\$19" } } */
+/* { dg-final { scan-assembler "\\\$20" } } */
+/* { dg-final { scan-assembler "\\\$21" } } */
+/* { dg-final { scan-assembler "\\\$22" } } */
+/* { dg-final { scan-assembler "\\\$23" } } */
+/* { dg-final { scan-assembler "\\\$(30|fp)" } } */
diff --git a/gcc/testsuite/gcc.target/mips/mips.exp b/gcc/testsuite/gcc.target/mips/mips.exp
index fef50974903..c88edc0a507 100644
--- a/gcc/testsuite/gcc.target/mips/mips.exp
+++ b/gcc/testsuite/gcc.target/mips/mips.exp
@@ -31,7 +31,8 @@ load_lib gcc-dg.exp
# $mips_isa: the ISA level specified by __mips
# $mips_arch: the architecture specified by _MIPS_ARCH
# $mips_mips16: true if MIPS16 mode is selected
-# $mips_mips64: true if 64-bit output is selected
+# $mips_gp64: true if 64-bit output is selected
+# $mips_fp64: true if 64-bit FPRs are selected
# $mips_float: "hard" or "soft"
#
# $mips_forced_isa: true if the command line uses -march=* or -mips*
@@ -44,7 +45,8 @@ proc setup_mips_tests {} {
global mips_isa
global mips_arch
global mips_mips16
- global mips_mips64
+ global mips_gp64
+ global mips_fp64
global mips_float
global mips_forced_isa
@@ -66,7 +68,10 @@ proc setup_mips_tests {} {
int mips16 = 1;
#endif
#ifdef __mips64
- int mips64 = 1;
+ int gp64 = 1;
+ #endif
+ #if __mips_fpr==64
+ int fp64 = 1;
#endif
#ifdef __mips_hard_float
const char *float = "hard";
@@ -81,7 +86,8 @@ proc setup_mips_tests {} {
regexp {isa = ([^;]*)} $output dummy mips_isa
regexp {arch = "([^"]*)} $output dummy mips_arch
set mips_mips16 [regexp {mips16 = 1} $output]
- set mips_mips64 [regexp {mips64 = 1} $output]
+ set mips_gp64 [regexp {gp64 = 1} $output]
+ set mips_fp64 [regexp {fp64 = 1} $output]
regexp {float = "([^"]*)} $output dummy mips_float
set mips_forced_isa [regexp -- {(-mips|-march)} $compiler_flags]
@@ -96,6 +102,7 @@ proc setup_mips_tests {} {
proc is_gp32_flag {flag} {
switch -glob -- $flag {
-msmartmips -
+ -mips[12] -
-march=mips32* -
-mgp32 { return 1 }
default { return 0 }
@@ -149,7 +156,8 @@ proc dg-mips-options {args} {
global mips_isa
global mips_arch
global mips_mips16
- global mips_mips64
+ global mips_gp64
+ global mips_fp64
global mips_float
global mips_forced_isa
@@ -164,13 +172,15 @@ proc dg-mips-options {args} {
# First handle the -mgp* options. Add an architecture option if necessary.
foreach flag $flags {
- if {[is_gp32_flag $flag] && $mips_mips64} {
+ if {[is_gp32_flag $flag]
+ && ($mips_gp64
+ || ($mips_fp64 && [lsearch $flags -mfp64] < 0)) } {
if {$mips_forced_abi} {
set matches 0
} else {
append flags " -mabi=32"
}
- } elseif {$flag == "-mgp64" && !$mips_mips64} {
+ } elseif {$flag == "-mgp64" && !$mips_gp64} {
if {$mips_forced_abi} {
set matches 0
} else {