* gcc.target/mips/mips.exp: Minor formatting. Call setup_mips_tests.
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 18 Apr 2005 20:34:36 +0000 (20:34 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 18 Apr 2005 20:34:36 +0000 (20:34 +0000)
(setup_mips_tests, dg-mips-options): New procedures.
* gcc.target/mips/asm-1.c, gcc.target/mips/fix-vr4130-1.c,
* gcc.target/mips/fix-vr4130-2.c, gcc.target/mips/fix-vr4130-3.c
* gcc.target/mips/fix-vr4130-4.c, gcc.target/mips/mips-3d-1.c,
* gcc.target/mips/mips-3d-2.c, gcc.target/mips/mips-3d-3.c,
* gcc.target/mips/mips-3d-4.c, gcc.target/mips/mips-3d-5.c,
* gcc.target/mips/mips-3d-6.c, gcc.target/mips/mips-3d-7.c,
* gcc.target/mips/mips-3d-8.c, gcc.target/mips/mips-3d-9.c,
* gcc.target/mips/mips-3d-2.c, gcc.target/mips/mips-3d-3.c,
* gcc.target/mips/mips-ps-1.c, gcc.target/mips/mips-ps-2.c,
* gcc.target/mips/mips-ps-3.c, gcc.target/mips/mips-ps-4.c,
* gcc.target/mips/mips-ps-type.c, gcc.target/mips/sb1-1.c: Use
dg-mips-options instead of dg-options.  Remove now-redundant
preprocessor guards.
* gcc.dg/mips-args-1.c, gcc.dg/mips-args-2.c, gcc.dg/mips-args-3.c,
* 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.c, gcc.dg/mips-rsqrt-3.c, gcc.dg/vr-mult-1.c,
* gcc.dg/vr-mult-2.c: Delete.
* gcc.target/mips/args-1.c, gcc.target/mips/args-2.c,
* gcc.target/mips/args-3.c, gcc.target/mips/movcc-1.c,
* gcc.target/mips/movcc-2.c, gcc.target/mips/movcc-3.c,
* gcc.target/mips/nmadd-1.c, gcc.target/mips/nmadd-2.c,
* gcc.target/mips/rsqrt-1.c, gcc.target/mips/rsqrt-2.c,
* gcc.target/mips/rsqrt-3.c, gcc.target/mips/vr-mult-1.c,
* gcc.target/mips/vr-mult-2.c: New tests, based on the old gcc.dg ones.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98345 138bc75d-0d04-0410-961f-82ee72b054a4

39 files changed:
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/mips-movcc-1.c [deleted file]
gcc/testsuite/gcc.dg/mips-movcc-2.c [deleted file]
gcc/testsuite/gcc.dg/vr-mult-1.c [deleted file]
gcc/testsuite/gcc.dg/vr-mult-2.c [deleted file]
gcc/testsuite/gcc.target/mips/args-1.c [moved from gcc/testsuite/gcc.dg/mips-args-1.c with 95% similarity]
gcc/testsuite/gcc.target/mips/args-2.c [moved from gcc/testsuite/gcc.dg/mips-args-2.c with 87% similarity]
gcc/testsuite/gcc.target/mips/args-3.c [moved from gcc/testsuite/gcc.dg/mips-args-3.c with 95% similarity]
gcc/testsuite/gcc.target/mips/asm-1.c
gcc/testsuite/gcc.target/mips/fix-vr4130-1.c
gcc/testsuite/gcc.target/mips/fix-vr4130-2.c
gcc/testsuite/gcc.target/mips/fix-vr4130-3.c
gcc/testsuite/gcc.target/mips/fix-vr4130-4.c
gcc/testsuite/gcc.target/mips/mips-3d-1.c
gcc/testsuite/gcc.target/mips/mips-3d-2.c
gcc/testsuite/gcc.target/mips/mips-3d-3.c
gcc/testsuite/gcc.target/mips/mips-3d-4.c
gcc/testsuite/gcc.target/mips/mips-3d-5.c
gcc/testsuite/gcc.target/mips/mips-3d-6.c
gcc/testsuite/gcc.target/mips/mips-3d-7.c
gcc/testsuite/gcc.target/mips/mips-3d-8.c
gcc/testsuite/gcc.target/mips/mips-3d-9.c
gcc/testsuite/gcc.target/mips/mips-ps-1.c
gcc/testsuite/gcc.target/mips/mips-ps-2.c
gcc/testsuite/gcc.target/mips/mips-ps-3.c
gcc/testsuite/gcc.target/mips/mips-ps-4.c
gcc/testsuite/gcc.target/mips/mips-ps-type.c
gcc/testsuite/gcc.target/mips/mips.exp
gcc/testsuite/gcc.target/mips/movcc-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/mips/movcc-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/mips/movcc-3.c [moved from gcc/testsuite/gcc.dg/mips-movcc-3.c with 69% similarity]
gcc/testsuite/gcc.target/mips/nmadd-1.c [moved from gcc/testsuite/gcc.dg/mips-nmadd-1.c with 70% similarity]
gcc/testsuite/gcc.target/mips/nmadd-2.c [moved from gcc/testsuite/gcc.dg/mips-nmadd-2.c with 69% similarity]
gcc/testsuite/gcc.target/mips/rsqrt-1.c [moved from gcc/testsuite/gcc.dg/mips-rsqrt-1.c with 56% similarity]
gcc/testsuite/gcc.target/mips/rsqrt-2.c [moved from gcc/testsuite/gcc.dg/mips-rsqrt-2.c with 56% similarity]
gcc/testsuite/gcc.target/mips/rsqrt-3.c [moved from gcc/testsuite/gcc.dg/mips-rsqrt-3.c with 81% similarity]
gcc/testsuite/gcc.target/mips/sb1-1.c
gcc/testsuite/gcc.target/mips/vr-mult-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/mips/vr-mult-2.c [new file with mode: 0644]

index 8ca1eb0..28dfc14 100644 (file)
@@ -1,3 +1,33 @@
+2005-04-18  Richard Sandiford  <rsandifo@redhat.com>
+
+       * gcc.target/mips/mips.exp: Minor formatting.  Call setup_mips_tests.
+       (setup_mips_tests, dg-mips-options): New procedures.
+       * gcc.target/mips/asm-1.c, gcc.target/mips/fix-vr4130-1.c,
+       * gcc.target/mips/fix-vr4130-2.c, gcc.target/mips/fix-vr4130-3.c
+       * gcc.target/mips/fix-vr4130-4.c, gcc.target/mips/mips-3d-1.c,
+       * gcc.target/mips/mips-3d-2.c, gcc.target/mips/mips-3d-3.c,
+       * gcc.target/mips/mips-3d-4.c, gcc.target/mips/mips-3d-5.c,
+       * gcc.target/mips/mips-3d-6.c, gcc.target/mips/mips-3d-7.c,
+       * gcc.target/mips/mips-3d-8.c, gcc.target/mips/mips-3d-9.c,
+       * gcc.target/mips/mips-3d-2.c, gcc.target/mips/mips-3d-3.c,
+       * gcc.target/mips/mips-ps-1.c, gcc.target/mips/mips-ps-2.c,
+       * gcc.target/mips/mips-ps-3.c, gcc.target/mips/mips-ps-4.c,
+       * gcc.target/mips/mips-ps-type.c, gcc.target/mips/sb1-1.c: Use
+       dg-mips-options instead of dg-options.  Remove now-redundant
+       preprocessor guards.
+       * gcc.dg/mips-args-1.c, gcc.dg/mips-args-2.c, gcc.dg/mips-args-3.c,
+       * 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.c, gcc.dg/mips-rsqrt-3.c, gcc.dg/vr-mult-1.c,
+       * gcc.dg/vr-mult-2.c: Delete.
+       * gcc.target/mips/args-1.c, gcc.target/mips/args-2.c,
+       * gcc.target/mips/args-3.c, gcc.target/mips/movcc-1.c,
+       * gcc.target/mips/movcc-2.c, gcc.target/mips/movcc-3.c,
+       * gcc.target/mips/nmadd-1.c, gcc.target/mips/nmadd-2.c,
+       * gcc.target/mips/rsqrt-1.c, gcc.target/mips/rsqrt-2.c,
+       * gcc.target/mips/rsqrt-3.c, gcc.target/mips/vr-mult-1.c,
+       * gcc.target/mips/vr-mult-2.c: New tests, based on the old gcc.dg ones.
+
 2005-04-18  Laurent GUERBY  <laurent@guerby.net>
 
        * ada/acats/run_all.sh: Use sync when executable not present.
diff --git a/gcc/testsuite/gcc.dg/mips-movcc-1.c b/gcc/testsuite/gcc.dg/mips-movcc-1.c
deleted file mode 100644 (file)
index 70a7dc7..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/* { dg-do compile { target "mips*-*-*" } } */
-/* { dg-options "-O2 -mips4" } */
-/* { dg-final { scan-assembler "movz" } } */
-/* { dg-final { scan-assembler "movn" } } */
-/* { dg-final { scan-assembler "movt" } } */
-
-void ext_int (int);
-
-#if __mips < 4
-asm ("# movz movn");
-#else
-int
-sub1 (int i, int j, int k)
-{
-  ext_int (k ? i : j);
-}
-
-int
-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
diff --git a/gcc/testsuite/gcc.dg/mips-movcc-2.c b/gcc/testsuite/gcc.dg/mips-movcc-2.c
deleted file mode 100644 (file)
index 22d58e9..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/* { dg-do compile { target "mips*-*-*" } } */
-/* { dg-options "-O2 -mips4" } */
-/* { dg-final { scan-assembler "movz" } } */
-/* { dg-final { scan-assembler "movn" } } */
-/* { dg-final { scan-assembler "movf" } } */
-
-void ext_long (long);
-
-#if __mips < 4
-asm ("# movz movn");
-#else
-long
-sub4 (long i, long j, long k)
-{
-  ext_long (k ? i : j);
-}
-
-long
-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
diff --git a/gcc/testsuite/gcc.dg/vr-mult-1.c b/gcc/testsuite/gcc.dg/vr-mult-1.c
deleted file mode 100644 (file)
index a208067..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/* Make sure that mul/addu is preferred over mtlo/macc on targets that
-   support both.  */
-/* { dg-do compile { target mips*-*-* } } */
-/* { dg-options "-O2" } */
-#if defined (_MIPS_ARCH_VR5400) || defined (_MIPS_ARCH_VR5500)
-int f (int a, int b, int c) { return a + b * c; }
-#else
-void f () { asm volatile ("mul/addu"); }
-#endif
-/* { dg-final { scan-assembler "mul.*addu" } } */
diff --git a/gcc/testsuite/gcc.dg/vr-mult-2.c b/gcc/testsuite/gcc.dg/vr-mult-2.c
deleted file mode 100644 (file)
index 4a3ad98..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/* Make sure that mul/subu is preferred over mtlo/msac on targets that
-   support both.  */
-/* { dg-do compile { target mips*-*-* } } */
-/* { dg-options "-O2" } */
-#if defined (_MIPS_ARCH_VR5400) || defined (_MIPS_ARCH_VR5500)
-int f (int a, int b, int c) { return a - b * c; }
-#else
-void f () { asm volatile ("mul/subu"); }
-#endif
-/* { dg-final { scan-assembler "mul.*subu" } } */
similarity index 95%
rename from gcc/testsuite/gcc.dg/mips-args-1.c
rename to gcc/testsuite/gcc.target/mips/args-1.c
index 891843e..56def94 100644 (file)
@@ -1,6 +1,6 @@
 /* Check that certain preprocessor macros are defined, and do some
    consistency checks.  */
-/* { dg-do compile { target mips*-*-* } } */
+/* { dg-do compile } */
 
 const char *compiled_for = _MIPS_ARCH;
 const char *optimized_for = _MIPS_TUNE;
similarity index 87%
rename from gcc/testsuite/gcc.dg/mips-args-2.c
rename to gcc/testsuite/gcc.target/mips/args-2.c
index c34751c..1927565 100644 (file)
@@ -1,5 +1,5 @@
 /* Check the _MIPSEB and _MIPSEL macros are accurate.  */
-/* { dg-do run { target mips*-*-* } } */
+/* { dg-do run } */
 extern void abort (void);
 extern void exit (int);
 
similarity index 95%
rename from gcc/testsuite/gcc.dg/mips-args-3.c
rename to gcc/testsuite/gcc.target/mips/args-3.c
index e1fde86..e91816f 100644 (file)
@@ -1,6 +1,6 @@
 /* __mips, and related defines, guarantee that certain assembly
    instructions can be used.  Check a few examples.  */
-/* { dg-do run { target mips*-*-* } } */
+/* { dg-do run } */
 extern void abort (void);
 extern void exit (int);
 
index 0082905..aed5b8c 100644 (file)
@@ -1,8 +1,7 @@
 /* PR target/17565.  GCC used to put the asm into the delay slot
    of the call.  */
 /* { dg-do assemble } */
-/* { dg-options "-O" } */
-#ifndef __mips16
+/* { dg-mips-options "-O -mno-mips16" } */
 int foo (int n)
 {
   register int k asm ("$16") = n;
@@ -13,4 +12,3 @@ int foo (int n)
     }
   return k;
 }
-#endif
index d6d2a5a..1ddf547 100644 (file)
@@ -1,9 +1,4 @@
-/* { dg-do compile { target mips*-*-* } } */
-/* { dg-skip-if "" { mips-sgi-irix* } { "-mabi=32" } { "" } } */
-/* { dg-options "-mfix-vr4130 -march=vr4130" } */
-#if _MIPS_ARCH_VR4130 && !__mips16
+/* { dg-do compile } */
+/* { dg-mips-options "-march=vr4130 -mfix-vr4130" } */
 int foo (void) { int r; asm ("# foo" : "=h" (r)); return r; }
-#else
-asm ("#\tmacchi\t");
-#endif
 /* { dg-final { scan-assembler "\tmacchi\t" } } */
index dcb4899..633eae6 100644 (file)
@@ -1,9 +1,4 @@
-/* { dg-do compile { target mips*-*-* } } */
-/* { dg-skip-if "" { mips-sgi-irix* } { "-mabi=32" } { "" } } */
-/* { dg-options "-mfix-vr4130 -march=vr4130" } */
-#if _MIPS_ARCH_VR4130 && !__mips16
+/* { dg-do compile } */
+/* { dg-mips-options "-march=vr4130 -mfix-vr4130" } */
 int foo (void) { int r; asm ("# foo" : "=l" (r)); return r; }
-#else
-asm ("#\tmacc\t");
-#endif
 /* { dg-final { scan-assembler "\tmacc\t" } } */
index ff258ba..58f07b5 100644 (file)
@@ -1,9 +1,4 @@
-/* { dg-do compile { target mips*-*-* } } */
-/* { dg-skip-if "" { mips-sgi-irix* } { "-mabi=32" } { "" } } */
-/* { dg-options "-mfix-vr4130 -march=vr4130" } */
-#if _MIPS_ARCH_VR4130 && !__mips16 && __mips64
+/* { dg-do compile } */
+/* { dg-mips-options "-march=vr4130 -mgp64 -mfix-vr4130" } */
 long long foo (void) { long long r; asm ("# foo" : "=h" (r)); return r; }
-#else
-asm ("#\tdmacchi\t");
-#endif
 /* { dg-final { scan-assembler "\tdmacchi\t" } } */
index acb2d08..64752a8 100644 (file)
@@ -1,9 +1,4 @@
-/* { dg-do compile { target mips*-*-* } } */
-/* { dg-skip-if "" { mips-sgi-irix* } { "-mabi=32" } { "" } } */
-/* { dg-options "-mfix-vr4130 -march=vr4130" } */
-#if _MIPS_ARCH_VR4130 && !__mips16 && __mips64
+/* { dg-do compile } */
+/* { dg-mips-options "-march=vr4130 -mgp64 -mfix-vr4130" } */
 long long foo (void) { long long r; asm ("# foo" : "=l" (r)); return r; }
-#else
-asm ("#\tdmacc\t");
-#endif
 /* { dg-final { scan-assembler "\tdmacc\t" } } */
index c351d8c..765bc49 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run { target mipsisa64*-*-* } } */
-/* { dg-options "-mips64 -O2 -mips3d -mhard-float -mfp64" } */
+/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */
 
 /* Test MIPS-3D builtin functions */
 #include <stdlib.h>
index e34022c..fc70fa2 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run { target mipsisa64*-*-* } } */
-/* { dg-options "-mips64 -O2 -mips3d -mhard-float -mfp64" } */
+/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */
 
 /* Test MIPS-3D branch-if-any-two builtin functions */
 #include <stdlib.h>
index 7044fc9..81d6c25 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run { target mipsisa64*-*-* } } */
-/* { dg-options "-mips64 -O2 -mips3d -mhard-float -mfp64" } */
+/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */
 
 /* Test MIPS-3D absolute compare builtin functions */
 #include <stdlib.h>
index 9723047..b2b6bfe 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run { target mipsisa64*-*-* } } */
-/* { dg-options "-mips64 -O2 -mips3d -mhard-float -mfp64" } */
+/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */
 
 /* Test MIPS-3D branch-if-any-four builtin functions */
 #include <stdlib.h>
index bd4c857..7dc6d28 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run { target mipsisa64*-*-* } } */
-/* { dg-options "-mips64 -O2 -mips3d -mhard-float -mfp64" } */
+/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */
 
 /* Test MIPS-3D absolute-compare & branch-if-any-four builtin functions */
 #include <stdlib.h>
index 0b54ef1..5a7622d 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run { target mipsisa64*-*-* } } */
-/* { dg-options "-mips64 -O2 -mips3d -mhard-float -mfp64" } */
+/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */
 
 /* Test MIPS-3D absolute compare (floats) builtin functions */
 #include <stdlib.h>
index 1d9a481..3a512f4 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run { target mipsisa64*-*-* } } */
-/* { dg-options "-mips64 -O2 -mips3d -mhard-float -mfp64" } */
+/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */
 
 /* Test MIPS-3D absolute compare (doubles) builtin functions */
 #include <stdlib.h>
index 955c266..601e5ff 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run { target mipsisa64*-*-* } } */
-/* { dg-options "-mips64 -O2 -mips3d -mhard-float -mfp64" } */
+/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */
 
 /* Test MIPS-3D absolute compare and conditional move builtin functions */
 #include <stdlib.h>
index 23a1f48..11d863f 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run { target mipsisa64*-*-* } } */
-/* { dg-options "-mips64 -O2 -mips3d -mhard-float -mfp64" } */
+/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */
 
 /* Matrix Multiplications */
 #include <stdlib.h>
index 78f5384..1723933 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run { target mipsisa64*-*-* } } */
-/* { dg-options "-mips64 -O2 -mpaired-single -mhard-float -mfp64" } */
+/* { dg-mips-options "-mips64 -O2 -mpaired-single -mhard-float -mgp64" } */
 
 /* Test v2sf calculations */
 #include <stdlib.h>
index ef639e6..178bb91 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run { target mipsisa64*-*-* } } */
-/* { dg-options "-mips64 -O2 -mpaired-single -mhard-float -mfp64" } */
+/* { dg-mips-options "-mips64 -O2 -mpaired-single -mhard-float -mgp64" } */
 
 /* Test MIPS paired-single builtin functions */
 #include <stdlib.h>
index e4f4db2..8d29cc9 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run { target mipsisa64*-*-* } } */
-/* { dg-options "-mips64 -O2 -mpaired-single -mhard-float -mfp64" } */
+/* { dg-mips-options "-mips64 -O2 -mpaired-single -mhard-float -mgp64" } */
 
 /* Test MIPS paired-single conditional move */
 #include <stdlib.h>
index 9e0677e..41c39dc 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run { target mipsisa64*-*-* } } */
-/* { dg-options "-mips64 -O2 -mpaired-single -mhard-float -mfp64" } */
+/* { dg-mips-options "-mips64 -O2 -mpaired-single -mhard-float -mgp64" } */
 
 /* Test MIPS paired-single comparisons */
 #include <stdlib.h>
index b4d9a7b..cd5566f 100644 (file)
@@ -1,6 +1,6 @@
 /* Test v2sf calculations */
-/* { dg-do compile { target mipsisa64*-*-* } } */ 
-/* { dg-options "-mips64 -O2 -mpaired-single -mhard-float -mfp64" } */ 
+/* { dg-do compile } */ 
+/* { dg-mips-options "-mips64 -O2 -mpaired-single -mhard-float -mgp64" } */
 /* { dg-final { scan-assembler "cvt.ps.s" } } */ 
 /* { dg-final { scan-assembler "mov.ps" } } */ 
 /* { dg-final { scan-assembler "ldc1" } } */ 
index 56d1f4d..4600cab 100644 (file)
 # GCC testsuite that uses the `dg.exp' driver.
 
 # Exit immediately if this isn't a MIPS target.
-if ![istarget mips*-*-*] then {
+if ![istarget mips*-*-*] {
   return
 }
 
 # Load support procs.
 load_lib gcc-dg.exp
 
-# If a testcase doesn't have special options, use these.
-global DEFAULT_CFLAGS
-if ![info exists DEFAULT_CFLAGS] then {
-    set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+# Find out which target is selected by the default compiler flags.
+# Also remember which aspects of the target are forced on the command
+# line (as opposed to being overridable defaults).
+#
+#    $mips_isa:                 the ISA level specified by __mips
+#    $mips_arch:        the architecture specified by _MIPS_ARCH
+#    $mips_mips16:      true if MIPS16 mode is selected
+#    $mips_mips64:      true if 64-bit output is selected
+#    $mips_float:       "hard" or "soft"
+#
+#    $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_float: true if the command line uses -mhard/soft-float
+proc setup_mips_tests {} {
+    global mips_isa
+    global mips_arch
+    global mips_mips16
+    global mips_mips64
+    global mips_float
+
+    global mips_forced_isa
+    global mips_forced_abi
+    global mips_forced_float
+
+    global compiler_flags
+    global tool
+
+    set src dummy[pid].c
+    set f [open $src "w"]
+    puts $f {
+       int isa = __mips;
+       const char *arch = _MIPS_ARCH;
+       #ifdef __mips16
+       int mips16 = 1;
+       #endif
+       #ifdef __mips64
+       int mips64 = 1;
+       #endif
+       #ifdef __mips_hard_float
+       const char *float = "hard";
+       #else
+       const char *float = "soft";
+       #endif
+    }
+    close $f
+    set output [${tool}_target_compile $src "" preprocess ""]
+    file delete $src
+
+    regexp {isa = ([^;]*)} $output dummy mips_isa
+    regexp {arch = "([^"]*)} $output dummy mips_arch
+    set mips_mips16 [regexp {mips16 = 1} $output]
+    set mips_mips64 [regexp {mips64 = 1} $output]
+    regexp {float = "([^"]*)} $output dummy mips_float
+
+    set mips_forced_isa [regexp -- {(-mips|-march)} $compiler_flags]
+    set mips_forced_abi [regexp -- {(-mgp|-mabi)} $compiler_flags]
+    set mips_forced_float [regexp -- {-m(hard|soft)-float} $compiler_flags]
 }
 
-# Initialize `dg'.
-dg-init
+# Like dg-options, but treats certain MIPS-specific options specially:
+#
+#    -mgp32
+#      Force 32-bit code.  Skip the test if the multilib flags force
+#      a 64-bit ABI.
+#
+#    -mgp64
+#      Force 64-bit code.  Also force a 64-bit target architecture
+#      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.
+#
+#    -mno-mips16
+#      Skip the test for MIPS16 targets.
+#
+#    -march=*
+#    -mips*
+#      Select the target architecture.  Skip the test for MIPS16 targets
+#      or if the multilib flags force a different architecture.
+#
+#    -msoft-float
+#    -mhard-float
+#      Select the given floating-point mode.  Skip the test if the
+#      multilib flags force a different selection.
+proc dg-mips-options {args} {
+    upvar dg-extra-tool-flags extra_tool_flags
+    upvar dg-do-what do_what
 
-# Main loop.
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
-       "" $DEFAULT_CFLAGS
+    global mips_isa
+    global mips_arch
+    global mips_mips16
+    global mips_mips64
+    global mips_float
 
-# All done.
+    global mips_forced_isa
+    global mips_forced_abi
+    global mips_forced_float
+
+    set flags [lindex $args 1]
+    set matches 1
+
+    # First handle the -mgp* options.  Add an architecture option if necessary.
+    foreach flag $flags {
+       if {$flag == "-mgp32" && $mips_mips64} {
+           if {$mips_forced_abi} {
+               set matches 0
+           } else {
+               append flags " -mabi=32"
+           }
+       } elseif {$flag == "-mgp64" && !$mips_mips64} {
+           if {$mips_forced_abi} {
+               set matches 0
+           } else {
+               append flags " -mabi=o64"
+               if {[lsearch -regexp $flags {^(-mips|-march)}] < 0} {
+                   append flags " -mips3"
+               }
+           }
+       }
+    }
+    # Handle the other options.
+    foreach flag $flags {
+       if {$flag == "-mno-mips16"} {
+           if {$mips_mips16} {
+               set matches 0
+           }
+       } elseif {[regexp -- {^-march=(.*)} $flag dummy arch]} {
+           if {$mips_mips16 || ($arch != $mips_arch && $mips_forced_isa)} {
+               set matches 0
+           }
+       } elseif {[regexp -- {^-mips(.*)} $flag dummy isa] && $isa != 16} {
+           if {$mips_mips16 || ($isa != $mips_isa && $mips_forced_isa)} {
+               set matches 0
+           }
+       } elseif {[regexp -- {^-m(hard|soft)-float} $flag dummy float]} {
+           if {$mips_float != $float && $mips_forced_float} {
+               set matches 0
+           }
+       }
+    }
+    if {$matches} {
+       set extra_tool_flags $flags
+    } else {
+       set do_what [list [lindex $do_what 0] "N" "P"]
+    }
+}
+
+setup_mips_tests
+
+dg-init
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] "" ""
 dg-finish
diff --git a/gcc/testsuite/gcc.target/mips/movcc-1.c b/gcc/testsuite/gcc.target/mips/movcc-1.c
new file mode 100644 (file)
index 0000000..30a0aa7
--- /dev/null
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-mips-options "-O2 -mips4" } */
+/* { dg-final { scan-assembler "movz" } } */
+/* { dg-final { scan-assembler "movn" } } */
+
+void ext_int (int);
+
+int
+sub1 (int i, int j, int k)
+{
+  ext_int (k ? i : j);
+}
+
+int
+sub2 (int i, int j, long l)
+{
+  ext_int (!l ? i : j);
+}
diff --git a/gcc/testsuite/gcc.target/mips/movcc-2.c b/gcc/testsuite/gcc.target/mips/movcc-2.c
new file mode 100644 (file)
index 0000000..57c2c50
--- /dev/null
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-mips-options "-O2 -mips4" } */
+/* { dg-final { scan-assembler "movz" } } */
+/* { dg-final { scan-assembler "movn" } } */
+
+void ext_long (long);
+
+long
+sub4 (long i, long j, long k)
+{
+  ext_long (k ? i : j);
+}
+
+long
+sub5 (long i, long j, int k)
+{
+  ext_long (!k ? i : j);
+}
similarity index 69%
rename from gcc/testsuite/gcc.dg/mips-movcc-3.c
rename to gcc/testsuite/gcc.target/mips/movcc-3.c
index 3a3a43b..ad439f9 100644 (file)
@@ -1,5 +1,7 @@
-/* { dg-do compile { target "mips*-*-*" } } */
-/* { dg-options "-O2 -mips4" } */
+/* { dg-do compile } */
+/* { dg-mips-options "-O2 -mips4 -mhard-float" } */
+/* { dg-final { scan-assembler "movt" } } */
+/* { dg-final { scan-assembler "movf" } } */
 /* { dg-final { scan-assembler "movz.s" } } */
 /* { dg-final { scan-assembler "movn.s" } } */
 /* { dg-final { scan-assembler "movt.s" } } */
@@ -7,12 +9,23 @@
 /* { 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_int (int);
+void ext_long (long);
 void ext_float (float);
 void ext_double (double);
 
+int
+sub3 (int i, int j, float f)
+{
+  ext_int (f ? i : j);
+}
+
+long
+sub6 (long i, long j, float f)
+{
+  ext_long (!f ? i : j);
+}
+
 float
 sub7 (float f, float g, int i)
 {
@@ -48,4 +61,3 @@ subc (double f, double g, double h)
 {
   ext_double (!h ? f : g);
 }
-#endif
similarity index 70%
rename from gcc/testsuite/gcc.dg/mips-nmadd-1.c
rename to gcc/testsuite/gcc.target/mips/nmadd-1.c
index 1bf7895..e027b07 100644 (file)
@@ -1,13 +1,10 @@
-/* { dg-do compile { target "mips*-*-*" } } */
-/* { dg-options "-O2 -ffast-math -mips4" } */
+/* { dg-do compile } */
+/* { dg-mips-options "-O2 -ffast-math -mips4 -mhard-float" } */
 /* { dg-final { scan-assembler "nmadd.s" } } */
 /* { dg-final { scan-assembler "nmadd.d" } } */
 /* { 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)
 {
@@ -31,4 +28,3 @@ sub4 (double f, double g, double h)
 {
   return -((f * g) - h);
 }
-#endif
similarity index 69%
rename from gcc/testsuite/gcc.dg/mips-nmadd-2.c
rename to gcc/testsuite/gcc.target/mips/nmadd-2.c
index 20b83bd..522407a 100644 (file)
@@ -1,13 +1,10 @@
-/* { dg-do compile { target "mips*-*-*" } } */
-/* { dg-options "-O2 -fno-fast-math -mips4" } */
+/* { dg-do compile } */
+/* { dg-mips-options "-O2 -fno-fast-math -mips4 -mhard-float" } */
 /* { dg-final { scan-assembler "nmadd.s" } } */
 /* { dg-final { scan-assembler "nmadd.d" } } */
 /* { 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)
 {
@@ -31,4 +28,3 @@ sub4 (double f, double g, double h)
 {
   return -((f * g) - h);
 }
-#endif
similarity index 56%
rename from gcc/testsuite/gcc.dg/mips-rsqrt-1.c
rename to gcc/testsuite/gcc.target/mips/rsqrt-1.c
index b228ddb..34e7124 100644 (file)
@@ -1,11 +1,8 @@
-/* { dg-do compile { target "mips*-*-*" } } */
-/* { dg-options "-O2 -ffast-math -mips4" } */
+/* { dg-do compile } */
+/* { dg-mips-options "-O2 -ffast-math -mips4 -mhard-float" } */
 /* { 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);
 
@@ -18,4 +15,3 @@ float bar(float x)
 {
   return 1.0f/sqrtf(x);
 }
-#endif
similarity index 56%
rename from gcc/testsuite/gcc.dg/mips-rsqrt-2.c
rename to gcc/testsuite/gcc.target/mips/rsqrt-2.c
index a4cddcd..4bc3e7f 100644 (file)
@@ -1,11 +1,8 @@
-/* { dg-do compile { target "mips*-*-*" } } */
-/* { dg-options "-O2 -ffast-math -mips4" } */
+/* { dg-do compile } */
+/* { dg-mips-options "-O2 -ffast-math -mips4 -mhard-float" } */
 /* { 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);
 
@@ -18,4 +15,3 @@ float bar(float x)
 {
   return sqrtf(1.0f/x);
 }
-#endif
similarity index 81%
rename from gcc/testsuite/gcc.dg/mips-rsqrt-3.c
rename to gcc/testsuite/gcc.target/mips/rsqrt-3.c
index 870a5c9..76cee83 100644 (file)
@@ -1,5 +1,5 @@
-/* { dg-do compile { target "mips*-*-*" } } */
-/* { dg-options "-O2 -mips4" } */
+/* { dg-do compile } */
+/* { dg-mips-options "-O2 -mips4 -mhard-float" } */
 /* { dg-final { scan-assembler-not "rsqrt.d" } } */
 /* { dg-final { scan-assembler-not "rsqrt.s" } } */
 
@@ -25,4 +25,3 @@ float barf(float x)
 {
   return sqrtf(1.0f/x);
 }
-
index b6d671b..c9de3a8 100644 (file)
@@ -1,6 +1,6 @@
 /* Test SB-1 v2sf extensions.  */
-/* { dg-do compile { target mipsisa64*-*-* } } */ 
-/* { dg-options "-march=sb1 -O2 -mpaired-single -mhard-float -mfp64 -ffast-math" } */ 
+/* { dg-do compile } */ 
+/* { dg-mips-options "-march=sb1 -O2 -mpaired-single -mhard-float -mgp64 -ffast-math" } */ 
 /* { dg-final { scan-assembler "div.ps" } } */ 
 /* { dg-final { scan-assembler "recip.ps" } } */ 
 /* { dg-final { scan-assembler "sqrt.ps" } } */ 
diff --git a/gcc/testsuite/gcc.target/mips/vr-mult-1.c b/gcc/testsuite/gcc.target/mips/vr-mult-1.c
new file mode 100644 (file)
index 0000000..47d6391
--- /dev/null
@@ -0,0 +1,7 @@
+/* Make sure that mul/addu is preferred over mtlo/macc and that mul/subu
+   is preferred over mtlo/msac.  */
+/* { dg-do compile } */
+/* { dg-mips-options "-O2 -march=vr5400" } */
+int f1 (int a, int b, int c) { return a + b * c; }
+int f2 (int a, int b, int c) { return a - b * c; }
+/* { dg-final { scan-assembler "\tmul\t.*\tmul\t" } } */
diff --git a/gcc/testsuite/gcc.target/mips/vr-mult-2.c b/gcc/testsuite/gcc.target/mips/vr-mult-2.c
new file mode 100644 (file)
index 0000000..9112ed0
--- /dev/null
@@ -0,0 +1,7 @@
+/* Make sure that mul/addu is preferred over mtlo/macc and that mul/subu
+   is preferred over mtlo/msac.  */
+/* { dg-do compile } */
+/* { dg-mips-options "-O2 -march=vr5500" } */
+int f1 (int a, int b, int c) { return a + b * c; }
+int f2 (int a, int b, int c) { return a - b * c; }
+/* { dg-final { scan-assembler "\tmul\t.*\tmul\t" } } */