From 729fd517d9bafae406f62b348bfb74e0e2f14d61 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Tue, 2 Oct 2007 20:56:47 +0000 Subject: [PATCH] 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 --- gcc/testsuite/ChangeLog | 16 ++++++++ gcc/testsuite/gcc.target/mips/mips.exp | 55 ++++++++++++++++++++++---- gcc/testsuite/gcc.target/mips/pr33256.c | 2 +- gcc/testsuite/gcc.target/mips/save-restore-1.c | 2 +- gcc/testsuite/gcc.target/mips/save-restore-2.c | 2 +- gcc/testsuite/gcc.target/mips/save-restore-3.c | 2 +- gcc/testsuite/gcc.target/mips/save-restore-4.c | 2 +- 7 files changed, 69 insertions(+), 12 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 65f08872e89..2e45a08cff4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,21 @@ 2007-10-02 Richard Sandiford + * 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 + PR middle-end/33617 * gcc.c-torture/compile/pr33617.c: New test. diff --git a/gcc/testsuite/gcc.target/mips/mips.exp b/gcc/testsuite/gcc.target/mips/mips.exp index 00fdb5ec23e..7e2b781456b 100644 --- a/gcc/testsuite/gcc.target/mips/mips.exp +++ b/gcc/testsuite/gcc.target/mips/mips.exp @@ -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 diff --git a/gcc/testsuite/gcc.target/mips/pr33256.c b/gcc/testsuite/gcc.target/mips/pr33256.c index d5db110fba5..e19c93291a2 100644 --- a/gcc/testsuite/gcc.target/mips/pr33256.c +++ b/gcc/testsuite/gcc.target/mips/pr33256.c @@ -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); diff --git a/gcc/testsuite/gcc.target/mips/save-restore-1.c b/gcc/testsuite/gcc.target/mips/save-restore-1.c index 721d6012271..9c8017c7c65 100644 --- a/gcc/testsuite/gcc.target/mips/save-restore-1.c +++ b/gcc/testsuite/gcc.target/mips/save-restore-1.c @@ -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 diff --git a/gcc/testsuite/gcc.target/mips/save-restore-2.c b/gcc/testsuite/gcc.target/mips/save-restore-2.c index b7f8c07e3c2..de082d331cd 100644 --- a/gcc/testsuite/gcc.target/mips/save-restore-2.c +++ b/gcc/testsuite/gcc.target/mips/save-restore-2.c @@ -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 diff --git a/gcc/testsuite/gcc.target/mips/save-restore-3.c b/gcc/testsuite/gcc.target/mips/save-restore-3.c index 18b871f830a..674072dd7b0 100644 --- a/gcc/testsuite/gcc.target/mips/save-restore-3.c +++ b/gcc/testsuite/gcc.target/mips/save-restore-3.c @@ -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 *); diff --git a/gcc/testsuite/gcc.target/mips/save-restore-4.c b/gcc/testsuite/gcc.target/mips/save-restore-4.c index 4a8f13634ed..13f1f0454ee 100644 --- a/gcc/testsuite/gcc.target/mips/save-restore-4.c +++ b/gcc/testsuite/gcc.target/mips/save-restore-4.c @@ -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); -- 2.11.4.GIT