]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
mips.exp (setup_mips_tests): Set mips_abi to the default ABI.
authorRichard Sandiford <rsandifo@nildram.co.uk>
Tue, 2 Oct 2007 20:56:47 +0000 (20:56 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Tue, 2 Oct 2007 20:56:47 +0000 (20:56 +0000)
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

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/mips/mips.exp
gcc/testsuite/gcc.target/mips/pr33256.c
gcc/testsuite/gcc.target/mips/save-restore-1.c
gcc/testsuite/gcc.target/mips/save-restore-2.c
gcc/testsuite/gcc.target/mips/save-restore-3.c
gcc/testsuite/gcc.target/mips/save-restore-4.c

index 65f08872e8925d11b67c2b5bf9db13c87d9e3c8a..2e45a08cff4b53d2b7ba974e5a36954edaa2b8e9 100644 (file)
@@ -1,3 +1,19 @@
+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
index 00fdb5ec23e74c51110dc2d3774f57e43f73ca7e..7e2b781456bf0dbbb3f4ea9d95f3fddf93b60c39 100644 (file)
@@ -33,9 +33,11 @@ load_lib gcc-dg.exp
 #    $mips_gp64:        true if 64-bit output is selected
 #    $mips_fp64:        true if 64-bit FPRs are selected
 #    $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_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_le    true if the command line uses -EL or -mel
 #    $mips_forced_gp    true if the command line forces a particular GP mode
@@ -46,6 +48,7 @@ proc setup_mips_tests {} {
     global mips_gp64
     global mips_fp64
     global mips_float
+    global mips_abi
 
     global mips_forced_isa
     global mips_forced_abi
@@ -53,6 +56,7 @@ proc setup_mips_tests {} {
     global mips_forced_le
     global mips_forced_gp
     global mips_forced_no_er
+    global mips_forced_regs
 
     global compiler_flags
     global tool
@@ -73,6 +77,17 @@ proc setup_mips_tests {} {
        #else
        const char *float = "soft";
        #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
     set output [${tool}_target_compile $src "" preprocess ""]
@@ -83,9 +98,11 @@ proc setup_mips_tests {} {
     set mips_gp64 [regexp {gp64 = 1} $output]
     set mips_fp64 [regexp {fp64 = 1} $output]
     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_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_le [regexp -- {-(EL|mel)[[:>:]]} $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} {
        -mips[12] -
        -mips32* -
        -march=mips32* -
+       -mabi=32 -
        -mgp32 { return 1 }
        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:
 #
 #    -mgp32
@@ -116,6 +145,10 @@ proc is_gp32_flag {flag} {
 #      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.
 #
+#    -mabi=*
+#      Force a particular ABI.  Skip the test if the multilib flags
+#      force a specific ABI or a different register size.
+#
 #    -march=*
 #    -mips*
 #      Select the target architecture.  Skip the test if the multilib
@@ -150,9 +183,11 @@ proc dg-mips-options {args} {
     global mips_gp64
     global mips_fp64
     global mips_float
+    global mips_abi
 
     global mips_forced_isa
     global mips_forced_abi
+    global mips_forced_regs
     global mips_forced_float
     global mips_forced_le
     global mips_forced_gp
@@ -166,16 +201,18 @@ proc dg-mips-options {args} {
        if {[is_gp32_flag $flag]
            && ($mips_gp64
                || ($mips_fp64 && [lsearch $flags -mfp64] < 0)) } {
-           if {$mips_forced_abi} {
+           if {$mips_forced_regs || $mips_forced_abi} {
                set matches 0
-           } else {
+           } elseif {[lsearch $flags "-mabi=*"] < 0} {
                append flags " -mabi=32"
            }
-       } elseif {$flag == "-mgp64" && !$mips_gp64} {
-           if {$mips_forced_abi} {
+       } elseif {[is_gp64_flag $flag] && !$mips_gp64} {
+           if {$mips_forced_regs || $mips_forced_abi} {
                set matches 0
            } else {
-               append flags " -mabi=o64"
+               if {[lsearch $flags "-mabi=*"] < 0} {
+                   append flags " -mabi=o64"
+               }
                if {[lsearch -regexp $flags {^(-mips|-march)}] < 0} {
                    append flags " -mips3"
                }
@@ -188,6 +225,10 @@ proc dg-mips-options {args} {
            if {$mips_isa < 33 || $mips_float != "hard"} {
                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]} {
            if {$arch != $mips_arch && $mips_forced_isa} {
                set matches 0
index d5db110fba599d4dc2d05fa145c8fb1549205d55..e19c93291a26125de39a86d9aa62143d56c673e7 100644 (file)
@@ -1,6 +1,6 @@
 /* GCC used to report an ICE for this test because we generated a LO_SUM
    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[];
 int b (int);
 
index 721d60122718fc849a5680c61ecf457c55d0a3ec..9c8017c7c6595886e02e1aaca94ffa1c139a5118 100644 (file)
@@ -1,6 +1,6 @@
 /* Check that we can use the save instruction to save varargs.  */
 /* { dg-do compile { target mips16_attribute } } */
-/* { dg-mips-options "-mips32r2 -mgp32 -O2" } */
+/* { dg-mips-options "-mips32r2 -mabi=32 -O2" } */
 /* { dg-add-options mips16_attribute } */
 
 #include <stdarg.h>
index b7f8c07e3c2bb8fb87cdc11b26b617d77efa4e56..de082d331cda9d8a5e809aa24b8494add6b393c9 100644 (file)
@@ -1,6 +1,6 @@
 /* Check that we can use the save instruction to save spilled arguments.  */
 /* { dg-do compile { target mips16_attribute } } */
-/* { dg-mips-options "-mips32r2 -mgp32 -O2" } */
+/* { dg-mips-options "-mips32r2 -mabi=32 -O2" } */
 /* { dg-add-options mips16_attribute } */
 
 MIPS16 void
index 18b871f830ab8be122eb3c185cb171e45733327a..674072dd7b0253104a3ace4984238e6bf50c5eee 100644 (file)
@@ -1,7 +1,7 @@
 /* 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.  */
 /* { dg-do compile { target mips16_attribute } } */
-/* { dg-mips-options "-mips32r2 -mgp32 -O2" } */
+/* { dg-mips-options "-mips32r2 -mabi=32 -O2" } */
 /* { dg-add-options mips16_attribute } */
 
 void bar (int *);
index 4a8f13634ed7636ddf16eff9f8fe58d8a2026e1e..13f1f0454ee74c94b6ee35d3f1c593be2f4264a5 100644 (file)
@@ -1,6 +1,6 @@
 /* Check that we can use the save instruction to save $16, $17 and $31.  */
 /* { dg-do compile { target mips16_attribute } } */
-/* { dg-mips-options "-mips32r2 -mgp32 -O2" } */
+/* { dg-mips-options "-mips32r2 -mabi=32 -O2" } */
 /* { dg-add-options mips16_attribute } */
 
 void bar (void);