diff mbox

[MIPS,RFA] Regression cleanup for nan2008 toolchain

Message ID B5E67142681B53468FAF6B7C313565624411910F@hhmail02.hh.imgtec.org
State New
Headers show

Commit Message

Robert Suchanek Jan. 26, 2015, 11:48 a.m. UTC
Hi,

Here is a patch to clean up a large number of reported failures when a toolchain
is configured with --with-nan=2008 for mips*-linux-gnu triplet and clean up a failures
for mips-img-linux-gnu where nan2008 is set by the default.

In the former case, regression involves testing e.g. -mips4 with default options which
causes emission of warnings that the -mips4 architecture does not support nan2008, and
hence, the test is classified as a fail ("test for excess errors" type of error).
The patch implies -mnan=legacy switch for all tests that are run for ISA rev < 2.

In the latter case, even if we decrease the ISA level for incompatible options for
the loongson vector extension tests, especially loongson-simd.c, a test that includes
stdint.h or stdlib.h will end up including the glibc header 'stubs-<abi>.h>' and will
fail as the mipsr6 toolchain will only have stubs-o32_hard_2008.h. A toolchain supporting
nan1985 will have the required stubs-o32_hard.h. The only neat solution AFAICS was to add
a new effective target that tries to compile and include stdlib.h to check if we have
the proper support for the legacy NaN marking the concerned tests as UNSUPPORTED. 

Regards,
Robert

2015-01-26  Robert Suchanek  <robert.suchanek@imgtec.com>

gcc/testsuite
	* lib/target-supports.exp (check_effective_target_mips_nanlegacy): New.
	* gcc.target/mips/loongson-simd.c: Require legacy NaN support.
	* gcc.target/mips/mips.exp (mips-dg-options): Imply -mnan=legacy for
	ISA rev < 2.
---
 gcc/testsuite/gcc.target/mips/loongson-simd.c |    1 +
 gcc/testsuite/gcc.target/mips/mips.exp        |    1 +
 gcc/testsuite/lib/target-supports.exp         |    9 +++++++++
 3 files changed, 11 insertions(+)

Comments

Moore, Catherine Jan. 26, 2015, 4:07 p.m. UTC | #1
> -----Original Message-----
> From: Robert Suchanek [mailto:Robert.Suchanek@imgtec.com]
> Sent: Monday, January 26, 2015 6:48 AM
> To: gcc-patches@gcc.gnu.org
> Cc: Matthew Fortune; Moore, Catherine
> Subject: [PATCH MIPS RFA] Regression cleanup for nan2008 toolchain
> 
> Hi,
> 
> Here is a patch to clean up a large number of reported failures when a
> toolchain
> is configured with --with-nan=2008 for mips*-linux-gnu triplet and clean up a
> failures
> for mips-img-linux-gnu where nan2008 is set by the default.
> 
> In the former case, regression involves testing e.g. -mips4 with default
> options which
> causes emission of warnings that the -mips4 architecture does not support
> nan2008, and
> hence, the test is classified as a fail ("test for excess errors" type of error).
> The patch implies -mnan=legacy switch for all tests that are run for ISA rev <
> 2.
> 
> In the latter case, even if we decrease the ISA level for incompatible options
> for
> the loongson vector extension tests, especially loongson-simd.c, a test that
> includes
> stdint.h or stdlib.h will end up including the glibc header 'stubs-<abi>.h>' and
> will
> fail as the mipsr6 toolchain will only have stubs-o32_hard_2008.h. A toolchain
> supporting
> nan1985 will have the required stubs-o32_hard.h. The only neat solution
> AFAICS was to add
> a new effective target that tries to compile and include stdlib.h to check if we
> have
> the proper support for the legacy NaN marking the concerned tests as
> UNSUPPORTED.
> 
> Regards,
> Robert
> 
> 2015-01-26  Robert Suchanek  <robert.suchanek@imgtec.com>
> 
> gcc/testsuite
> 	* lib/target-supports.exp (check_effective_target_mips_nanlegacy):
> New.
> 	* gcc.target/mips/loongson-simd.c: Require legacy NaN support.
> 	* gcc.target/mips/mips.exp (mips-dg-options): Imply -mnan=legacy
> for
> 	ISA rev < 2.
> ---

This patch is OK.
Robert Suchanek Jan. 28, 2015, 9:23 a.m. UTC | #2
> >
> > 2015-01-26  Robert Suchanek  <robert.suchanek@imgtec.com>
> >
> > gcc/testsuite
> > 	* lib/target-supports.exp (check_effective_target_mips_nanlegacy):
> > New.
> > 	* gcc.target/mips/loongson-simd.c: Require legacy NaN support.
> > 	* gcc.target/mips/mips.exp (mips-dg-options): Imply -mnan=legacy
> > for
> > 	ISA rev < 2.
> > ---
> 
> This patch is OK.

Committed as 220199.

Regards,
Robert
Richard Sandiford Jan. 31, 2015, 11:50 a.m. UTC | #3
Robert Suchanek <Robert.Suchanek@imgtec.com> writes:
> diff --git a/gcc/testsuite/gcc.target/mips/loongson-simd.c b/gcc/testsuite/gcc.target/mips/loongson-simd.c
> index 160da6b..949632e 100644
> --- a/gcc/testsuite/gcc.target/mips/loongson-simd.c
> +++ b/gcc/testsuite/gcc.target/mips/loongson-simd.c
> @@ -22,6 +22,7 @@ along with GCC; see the file COPYING3.  If not see
>  /* loongson.h does not handle or check for MIPS16ness or
>     microMIPSness.  There doesn't seem any good reason for it to, given
>     that the Loongson processors do not support either.  */
> +/* { dg-require-effective-target mips_nanlegacy } */
>  /* { dg-options "isa=loongson -mhard-float -mno-micromips -mno-mips16 -flax-vector-conversions" } */

Nit, but this splits the dg-options from the comment that explains
the options.

Please could you add a comment explaining that the mips_nanlegacy is there
because of the #include of system headers that might not compile with
-mnan=legacy?  I agree that that's a good reason, but it's not obvious
without a comment.  (And without a comment this could start a precendent
of things being skipped in cases where the mips.exp options machinery
could be updated instead.)

Thanks,
Richard
diff mbox

Patch

diff --git a/gcc/testsuite/gcc.target/mips/loongson-simd.c b/gcc/testsuite/gcc.target/mips/loongson-simd.c
index 160da6b..949632e 100644
--- a/gcc/testsuite/gcc.target/mips/loongson-simd.c
+++ b/gcc/testsuite/gcc.target/mips/loongson-simd.c
@@ -22,6 +22,7 @@  along with GCC; see the file COPYING3.  If not see
 /* loongson.h does not handle or check for MIPS16ness or
    microMIPSness.  There doesn't seem any good reason for it to, given
    that the Loongson processors do not support either.  */
+/* { dg-require-effective-target mips_nanlegacy } */
 /* { dg-options "isa=loongson -mhard-float -mno-micromips -mno-mips16 -flax-vector-conversions" } */
 
 #include "loongson.h"
diff --git a/gcc/testsuite/gcc.target/mips/mips.exp b/gcc/testsuite/gcc.target/mips/mips.exp
index b81d344..a0980a9 100644
--- a/gcc/testsuite/gcc.target/mips/mips.exp
+++ b/gcc/testsuite/gcc.target/mips/mips.exp
@@ -1300,6 +1300,7 @@  proc mips-dg-options { args } {
 	    mips_make_test_option options "-mno-dsp"
 	    mips_make_test_option options "-mno-synci"
 	    mips_make_test_option options "-mno-micromips"
+	    mips_make_test_option options "-mnan=legacy"
 	}
         if { $isa_rev > 5 } {
 	    mips_make_test_option options "-mno-dsp"
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index e51d07d..de2f599 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -3036,6 +3036,15 @@  proc check_effective_target_mips_loongson { } {
     }]
 }
 
+# Return 1 if this is a MIPS target that supports the legacy NAN.
+
+proc check_effective_target_mips_nanlegacy { } {
+    return [check_no_compiler_messages nanlegacy assembly {
+	#include <stdlib.h>
+	int main () { return 0; }
+    } "-mnan=legacy"]
+}
+
 # Return 1 if this is an ARM target that adheres to the ABI for the ARM
 # Architecture.