This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[committed] Tweak gcc.dg MIPS tests
- From: Richard Sandiford <rsandifo at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 27 Jan 2005 19:59:39 +0000
- Subject: [committed] Tweak gcc.dg MIPS tests
Many gcc.dg MIPS tests implicitly assume -mhard-float and use dg-options
like -mips4. Since the multilib flags override the dg-options, these
tests sometimes fail when testing non-default multilibs.
The patch below makes the tests check whether the right options were
actually used and inserts dummy asms if not. I wondered about using
dg-skip-if instead, but this seemed slightly simpler. It also means
we'll test the integer conditional move stuff on MIPS IV soft-float
targets.
Tested on mips-elf, mips64-elf and mipsisa64-elf. It removes bogus FAILs
when testing -msoft-float on mips-elf and mips64-elf and similar -mips32
failures on mipsisa64-elf. Applied to mainline.
Richard
* gcc.dg/mips-movcc-1.c, gcc.dg/mips-movcc-2.c, gcc.dg/mips-movcc-3.c,
* gcc.dg/mips-nmadd-1.c, gcc.dg/mips-nmadd-2.c, gcc.dg/mips-rsqrt-1.c,
* gcc.dg/mips-rsqrt-2, gcc.dg/mips-rsqrt-3.c: Add dummy asm statements
to cope with cases where the multilib options override the dg-options.
Index: testsuite/gcc.dg/mips-movcc-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/mips-movcc-1.c,v
retrieving revision 1.2
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.2 mips-movcc-1.c
--- testsuite/gcc.dg/mips-movcc-1.c 27 Nov 2004 09:54:10 -0000 1.2
+++ testsuite/gcc.dg/mips-movcc-1.c 27 Jan 2005 12:29:42 -0000
@@ -6,6 +6,9 @@
void ext_int (int);
+#if __mips < 4
+asm ("# movz movn");
+#else
int
sub1 (int i, int j, int k)
{
@@ -17,9 +20,14 @@ sub2 (int i, int j, long l)
{
ext_int (!l ? i : j);
}
+#endif
+#if __mips < 4 || __mips_soft_float
+asm ("# movt");
+#else
int
sub3 (int i, int j, float f)
{
ext_int (f ? i : j);
}
+#endif
Index: testsuite/gcc.dg/mips-movcc-2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/mips-movcc-2.c,v
retrieving revision 1.2
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.2 mips-movcc-2.c
--- testsuite/gcc.dg/mips-movcc-2.c 27 Nov 2004 09:54:10 -0000 1.2
+++ testsuite/gcc.dg/mips-movcc-2.c 27 Jan 2005 12:29:42 -0000
@@ -6,6 +6,9 @@
void ext_long (long);
+#if __mips < 4
+asm ("# movz movn");
+#else
long
sub4 (long i, long j, long k)
{
@@ -17,9 +20,14 @@ sub5 (long i, long j, int k)
{
ext_long (!k ? i : j);
}
+#endif
+#if __mips < 4 || __mips_soft_float
+asm ("# movf");
+#else
long
sub6 (long i, long j, float f)
{
ext_long (!f ? i : j);
}
+#endif
Index: testsuite/gcc.dg/mips-movcc-3.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/mips-movcc-3.c,v
retrieving revision 1.2
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.2 mips-movcc-3.c
--- testsuite/gcc.dg/mips-movcc-3.c 27 Nov 2004 09:54:10 -0000 1.2
+++ testsuite/gcc.dg/mips-movcc-3.c 27 Jan 2005 12:29:42 -0000
@@ -7,6 +7,9 @@
/* { dg-final { scan-assembler "movn.d" } } */
/* { dg-final { scan-assembler "movf.d" } } */
+#if __mips < 4 || __mips_soft_float
+asm ("# movz.s movn.s movt.s movz.d movn.d movf.d");
+#else
void ext_float (float);
void ext_double (double);
@@ -45,3 +48,4 @@ subc (double f, double g, double h)
{
ext_double (!h ? f : g);
}
+#endif
Index: testsuite/gcc.dg/mips-nmadd-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/mips-nmadd-1.c,v
retrieving revision 1.1
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.1 mips-nmadd-1.c
--- testsuite/gcc.dg/mips-nmadd-1.c 17 Aug 2004 21:42:44 -0000 1.1
+++ testsuite/gcc.dg/mips-nmadd-1.c 27 Jan 2005 12:29:42 -0000
@@ -5,6 +5,9 @@
/* { dg-final { scan-assembler "nmsub.s" } } */
/* { dg-final { scan-assembler "nmsub.d" } } */
+#if (__mips != 4 && __mips != 64) || __mips_soft_float
+asm ("# nmadd.s nmadd.d nmsub.s nmsub.d");
+#else
float
sub1 (float f, float g, float h)
{
@@ -28,3 +31,4 @@ sub4 (double f, double g, double h)
{
return -((f * g) - h);
}
+#endif
Index: testsuite/gcc.dg/mips-nmadd-2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/mips-nmadd-2.c,v
retrieving revision 1.2
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.2 mips-nmadd-2.c
--- testsuite/gcc.dg/mips-nmadd-2.c 17 Aug 2004 21:56:20 -0000 1.2
+++ testsuite/gcc.dg/mips-nmadd-2.c 27 Jan 2005 12:29:42 -0000
@@ -5,6 +5,9 @@
/* { dg-final { scan-assembler "nmsub.s" } } */
/* { dg-final { scan-assembler "nmsub.d" } } */
+#if (__mips != 4 && __mips != 64) || __mips_soft_float
+asm ("# nmadd.s nmadd.d nmsub.s nmsub.d");
+#else
float
sub1 (float f, float g, float h)
{
@@ -28,3 +31,4 @@ sub4 (double f, double g, double h)
{
return -((f * g) - h);
}
+#endif
Index: testsuite/gcc.dg/mips-rsqrt-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/mips-rsqrt-1.c,v
retrieving revision 1.1
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.1 mips-rsqrt-1.c
--- testsuite/gcc.dg/mips-rsqrt-1.c 10 Aug 2004 17:43:02 -0000 1.1
+++ testsuite/gcc.dg/mips-rsqrt-1.c 27 Jan 2005 12:29:42 -0000
@@ -3,6 +3,9 @@
/* { dg-final { scan-assembler "rsqrt.d" } } */
/* { dg-final { scan-assembler "rsqrt.s" } } */
+#if (__mips != 4 && __mips != 64) || __mips_soft_float
+asm ("# rsqrt.d rsqrt.s");
+#else
extern double sqrt(double);
extern float sqrtf(float);
@@ -15,4 +18,4 @@ float bar(float x)
{
return 1.0f/sqrtf(x);
}
-
+#endif
Index: testsuite/gcc.dg/mips-rsqrt-2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/mips-rsqrt-2.c,v
retrieving revision 1.1
diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.1 mips-rsqrt-2.c
--- testsuite/gcc.dg/mips-rsqrt-2.c 10 Aug 2004 17:43:02 -0000 1.1
+++ testsuite/gcc.dg/mips-rsqrt-2.c 27 Jan 2005 12:29:42 -0000
@@ -3,6 +3,9 @@
/* { dg-final { scan-assembler "rsqrt.d" } } */
/* { dg-final { scan-assembler "rsqrt.s" } } */
+#if (__mips != 4 && __mips != 64) || __mips_soft_float
+asm ("# rsqrt.d rsqrt.s");
+#else
extern double sqrt(double);
extern float sqrtf(float);
@@ -15,4 +18,4 @@ float bar(float x)
{
return sqrtf(1.0f/x);
}
-
+#endif