Commit 729fd517 by Richard Sandiford Committed by Richard Sandiford

mips.exp (setup_mips_tests): Set mips_abi to the default ABI.

gcc/testsuite/
	* gcc.target/mips/mips.exp (setup_mips_tests): Set mips_abi to the
	default ABI.  Split mips_forced_abi into mips_forced_abi and
	mips_forced_regs.
	(is_gp32_flag): Return true for -mabi=32.
	(is_gp64_flag): New function.  Handle 64-bit -mabi options.
	(dg-mips-options): Use is_gp64_flag instead of checking specifically
	for -mgp64.  Update after the mips_forced_abi split.  Handle -mabi=*.
	Don't force an ABI for -mgp32 or -mfp32 if the flags contain -mabi=*.
	* gcc.target/mips/pr33256.c: Remove -mips3 requirement.
	* gcc.target/mips/save-restore-1.c: Use -mabi=32 instead of -mgp32.
	* gcc.target/mips/save-restore-2.c: Likewise.
	* gcc.target/mips/save-restore-3.c: Likewise.
	* gcc.target/mips/save-restore-4.c: Likewise.

From-SVN: r128966
parent 16089886
2007-10-02 Richard Sandiford <rsandifo@nildram.co.uk> 2007-10-02 Richard Sandiford <rsandifo@nildram.co.uk>
* gcc.target/mips/mips.exp (setup_mips_tests): Set mips_abi to the
default ABI. Split mips_forced_abi into mips_forced_abi and
mips_forced_regs.
(is_gp32_flag): Return true for -mabi=32.
(is_gp64_flag): New function. Handle 64-bit -mabi options.
(dg-mips-options): Use is_gp64_flag instead of checking specifically
for -mgp64. Update after the mips_forced_abi split. Handle -mabi=*.
Don't force an ABI for -mgp32 or -mfp32 if the flags contain -mabi=*.
* gcc.target/mips/pr33256.c: Remove -mips3 requirement.
* gcc.target/mips/save-restore-1.c: Use -mabi=32 instead of -mgp32.
* gcc.target/mips/save-restore-2.c: Likewise.
* gcc.target/mips/save-restore-3.c: Likewise.
* gcc.target/mips/save-restore-4.c: Likewise.
2007-10-02 Richard Sandiford <rsandifo@nildram.co.uk>
PR middle-end/33617 PR middle-end/33617
* gcc.c-torture/compile/pr33617.c: New test. * gcc.c-torture/compile/pr33617.c: New test.
...@@ -33,9 +33,11 @@ load_lib gcc-dg.exp ...@@ -33,9 +33,11 @@ load_lib gcc-dg.exp
# $mips_gp64: 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_fp64: true if 64-bit FPRs are selected
# $mips_float: "hard" or "soft" # $mips_float: "hard" or "soft"
# $mips_abi: the ABI specified by _MIPS_SIM
# #
# $mips_forced_isa: true if the command line uses -march=* or -mips* # $mips_forced_isa: true if the command line uses -march=* or -mips*
# $mips_forced_abi: true if the command line uses -mabi=* or -mgp* # $mips_forced_abi: true if the command line uses -mabi=*
# $mips_forced_regs: true if the command line uses -mgp* or -mfp*
# $mips_forced_float: true if the command line uses -mhard/soft-float # $mips_forced_float: true if the command line uses -mhard/soft-float
# $mips_forced_le true if the command line uses -EL or -mel # $mips_forced_le true if the command line uses -EL or -mel
# $mips_forced_gp true if the command line forces a particular GP mode # $mips_forced_gp true if the command line forces a particular GP mode
...@@ -46,6 +48,7 @@ proc setup_mips_tests {} { ...@@ -46,6 +48,7 @@ proc setup_mips_tests {} {
global mips_gp64 global mips_gp64
global mips_fp64 global mips_fp64
global mips_float global mips_float
global mips_abi
global mips_forced_isa global mips_forced_isa
global mips_forced_abi global mips_forced_abi
...@@ -53,6 +56,7 @@ proc setup_mips_tests {} { ...@@ -53,6 +56,7 @@ proc setup_mips_tests {} {
global mips_forced_le global mips_forced_le
global mips_forced_gp global mips_forced_gp
global mips_forced_no_er global mips_forced_no_er
global mips_forced_regs
global compiler_flags global compiler_flags
global tool global tool
...@@ -73,6 +77,17 @@ proc setup_mips_tests {} { ...@@ -73,6 +77,17 @@ proc setup_mips_tests {} {
#else #else
const char *float = "soft"; const char *float = "soft";
#endif #endif
#if !defined _MIPS_SIM
const char *abi = "eabi";
#elif _MIPS_SIM=_ABIO32
const char *abi = "32";
#elif _MIPS_SIM=_ABIO64
const char *abi = "o64";
#elif _MIPS_SIM=_ABIN32
const char *abi = "n32";
#else
const char *abi = "64";
#endif
} }
close $f close $f
set output [${tool}_target_compile $src "" preprocess ""] set output [${tool}_target_compile $src "" preprocess ""]
...@@ -83,9 +98,11 @@ proc setup_mips_tests {} { ...@@ -83,9 +98,11 @@ proc setup_mips_tests {} {
set mips_gp64 [regexp {gp64 = 1} $output] set mips_gp64 [regexp {gp64 = 1} $output]
set mips_fp64 [regexp {fp64 = 1} $output] set mips_fp64 [regexp {fp64 = 1} $output]
regexp {float = "([^"]*)} $output dummy mips_float regexp {float = "([^"]*)} $output dummy mips_float
regexp {abi = "([^"]*)} $output dummy mips_abi
set mips_forced_isa [regexp -- {(-mips[1-5][[:>:]]|-mips32*|-mips64*|-march)} $compiler_flags] set mips_forced_isa [regexp -- {(-mips[1-5][[:>:]]|-mips32*|-mips64*|-march)} $compiler_flags]
set mips_forced_abi [regexp -- {(-mgp|-mfp|-mabi)} $compiler_flags] set mips_forced_abi [regexp -- {-mabi} $compiler_flags]
set mips_forced_regs [regexp -- {(-mgp|-mfp)} $compiler_flags]
set mips_forced_float [regexp -- {-m(hard|soft)-float} $compiler_flags] set mips_forced_float [regexp -- {-m(hard|soft)-float} $compiler_flags]
set mips_forced_le [regexp -- {-(EL|mel)[[:>:]]} $compiler_flags] set mips_forced_le [regexp -- {-(EL|mel)[[:>:]]} $compiler_flags]
set mips_forced_gp [regexp -- {-(G|m(|no-)((extern|local)-sdata|gpopt)|mabicalls|mrtp)} $compiler_flags] set mips_forced_gp [regexp -- {-(G|m(|no-)((extern|local)-sdata|gpopt)|mabicalls|mrtp)} $compiler_flags]
...@@ -99,11 +116,23 @@ proc is_gp32_flag {flag} { ...@@ -99,11 +116,23 @@ proc is_gp32_flag {flag} {
-mips[12] - -mips[12] -
-mips32* - -mips32* -
-march=mips32* - -march=mips32* -
-mabi=32 -
-mgp32 { return 1 } -mgp32 { return 1 }
default { return 0 } default { return 0 }
} }
} }
# Return true if command-line option FLAG forces 64-bit code.
proc is_gp64_flag {flag} {
switch -glob -- $flag {
-mabi=64 -
-mabi=o64 -
-mabi=n32 -
-mgp64 { return 1 }
default { return 0 }
}
}
# Like dg-options, but treats certain MIPS-specific options specially: # Like dg-options, but treats certain MIPS-specific options specially:
# #
# -mgp32 # -mgp32
...@@ -116,6 +145,10 @@ proc is_gp32_flag {flag} { ...@@ -116,6 +145,10 @@ proc is_gp32_flag {flag} {
# if the other flags don't do so. Skip the test if the multilib # if the other flags don't do so. Skip the test if the multilib
# flags force a 32-bit ABI or a 32-bit architecture. # flags force a 32-bit ABI or a 32-bit architecture.
# #
# -mabi=*
# Force a particular ABI. Skip the test if the multilib flags
# force a specific ABI or a different register size.
#
# -march=* # -march=*
# -mips* # -mips*
# Select the target architecture. Skip the test if the multilib # Select the target architecture. Skip the test if the multilib
...@@ -150,9 +183,11 @@ proc dg-mips-options {args} { ...@@ -150,9 +183,11 @@ proc dg-mips-options {args} {
global mips_gp64 global mips_gp64
global mips_fp64 global mips_fp64
global mips_float global mips_float
global mips_abi
global mips_forced_isa global mips_forced_isa
global mips_forced_abi global mips_forced_abi
global mips_forced_regs
global mips_forced_float global mips_forced_float
global mips_forced_le global mips_forced_le
global mips_forced_gp global mips_forced_gp
...@@ -166,16 +201,18 @@ proc dg-mips-options {args} { ...@@ -166,16 +201,18 @@ proc dg-mips-options {args} {
if {[is_gp32_flag $flag] if {[is_gp32_flag $flag]
&& ($mips_gp64 && ($mips_gp64
|| ($mips_fp64 && [lsearch $flags -mfp64] < 0)) } { || ($mips_fp64 && [lsearch $flags -mfp64] < 0)) } {
if {$mips_forced_abi} { if {$mips_forced_regs || $mips_forced_abi} {
set matches 0 set matches 0
} else { } elseif {[lsearch $flags "-mabi=*"] < 0} {
append flags " -mabi=32" append flags " -mabi=32"
} }
} elseif {$flag == "-mgp64" && !$mips_gp64} { } elseif {[is_gp64_flag $flag] && !$mips_gp64} {
if {$mips_forced_abi} { if {$mips_forced_regs || $mips_forced_abi} {
set matches 0 set matches 0
} else { } else {
append flags " -mabi=o64" if {[lsearch $flags "-mabi=*"] < 0} {
append flags " -mabi=o64"
}
if {[lsearch -regexp $flags {^(-mips|-march)}] < 0} { if {[lsearch -regexp $flags {^(-mips|-march)}] < 0} {
append flags " -mips3" append flags " -mips3"
} }
...@@ -188,6 +225,10 @@ proc dg-mips-options {args} { ...@@ -188,6 +225,10 @@ proc dg-mips-options {args} {
if {$mips_isa < 33 || $mips_float != "hard"} { if {$mips_isa < 33 || $mips_float != "hard"} {
set matches 0 set matches 0
} }
} elseif {[regexp -- {^-mabi=(.*)} $flag dummy abi]} {
if {$abi != $mips_abi && $mips_forced_abi} {
set matches 0
}
} elseif {[regexp -- {^-march=(.*)} $flag dummy arch]} { } elseif {[regexp -- {^-march=(.*)} $flag dummy arch]} {
if {$arch != $mips_arch && $mips_forced_isa} { if {$arch != $mips_arch && $mips_forced_isa} {
set matches 0 set matches 0
......
/* GCC used to report an ICE for this test because we generated a LO_SUM /* GCC used to report an ICE for this test because we generated a LO_SUM
for an illegitimate constant. */ for an illegitimate constant. */
/* { dg-mips-options "-mabi=64 -mips3 -msym32 -O2 -EB -mno-abicalls" } */ /* { dg-mips-options "-mabi=64 -msym32 -O2 -EB -mno-abicalls" } */
extern unsigned long a[]; extern unsigned long a[];
int b (int); int b (int);
......
/* Check that we can use the save instruction to save varargs. */ /* Check that we can use the save instruction to save varargs. */
/* { dg-do compile { target mips16_attribute } } */ /* { dg-do compile { target mips16_attribute } } */
/* { dg-mips-options "-mips32r2 -mgp32 -O2" } */ /* { dg-mips-options "-mips32r2 -mabi=32 -O2" } */
/* { dg-add-options mips16_attribute } */ /* { dg-add-options mips16_attribute } */
#include <stdarg.h> #include <stdarg.h>
......
/* Check that we can use the save instruction to save spilled arguments. */ /* Check that we can use the save instruction to save spilled arguments. */
/* { dg-do compile { target mips16_attribute } } */ /* { dg-do compile { target mips16_attribute } } */
/* { dg-mips-options "-mips32r2 -mgp32 -O2" } */ /* { dg-mips-options "-mips32r2 -mabi=32 -O2" } */
/* { dg-add-options mips16_attribute } */ /* { dg-add-options mips16_attribute } */
MIPS16 void MIPS16 void
......
/* Check that we can use the save instruction to save spilled arguments /* Check that we can use the save instruction to save spilled arguments
when the argument save area is out of range of a direct load or store. */ when the argument save area is out of range of a direct load or store. */
/* { dg-do compile { target mips16_attribute } } */ /* { dg-do compile { target mips16_attribute } } */
/* { dg-mips-options "-mips32r2 -mgp32 -O2" } */ /* { dg-mips-options "-mips32r2 -mabi=32 -O2" } */
/* { dg-add-options mips16_attribute } */ /* { dg-add-options mips16_attribute } */
void bar (int *); void bar (int *);
......
/* Check that we can use the save instruction to save $16, $17 and $31. */ /* Check that we can use the save instruction to save $16, $17 and $31. */
/* { dg-do compile { target mips16_attribute } } */ /* { dg-do compile { target mips16_attribute } } */
/* { dg-mips-options "-mips32r2 -mgp32 -O2" } */ /* { dg-mips-options "-mips32r2 -mabi=32 -O2" } */
/* { dg-add-options mips16_attribute } */ /* { dg-add-options mips16_attribute } */
void bar (void); void bar (void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment