From: Richard Sandiford Date: Mon, 18 Apr 2005 20:34:36 +0000 (+0000) Subject: mips.exp: Minor formatting. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=636423701a200b70a067327f5b5956619c215b3e;p=gcc.git mips.exp: Minor formatting. * 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. From-SVN: r98345 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8ca1eb0bead..28dfc142028 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,33 @@ +2005-04-18 Richard Sandiford + + * 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 * ada/acats/run_all.sh: Use sync when executable not present. diff --git a/gcc/testsuite/gcc.dg/mips-args-1.c b/gcc/testsuite/gcc.dg/mips-args-1.c deleted file mode 100644 index 891843ec7fa..00000000000 --- a/gcc/testsuite/gcc.dg/mips-args-1.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Check that certain preprocessor macros are defined, and do some - consistency checks. */ -/* { dg-do compile { target mips*-*-* } } */ - -const char *compiled_for = _MIPS_ARCH; -const char *optimized_for = _MIPS_TUNE; - -#if __mips_fpr != 32 && __mips_fpr != 64 -#error Bad __mips_fpr -#endif - -/* Test complementary macro pairs: exactly one of each pair - must be defined. */ - -#if defined (_R3000) == defined (_R4000) && !defined (__sgi__) -#error _R3000 / _R4000 mismatch -#endif - -#if defined (__mips_hard_float) == defined (__mips_soft_float) -#error __mips_hard_float / __mips_soft_float mismatch -#endif - -#if defined (_MIPSEL) == defined (_MIPSEB) -#error _MIPSEL / _MIPSEB mismatch -#endif - -/* Check for __mips64 consistency. */ - -#if defined (__mips64) != defined (_R4000) && !defined (__sgi__) -#error __mips64 / _R4000 mismatch -#endif - -#if defined (__mips64) && __mips != 3 && __mips != 4 && __mips != 64 -#error __mips64 / __mips mismatch -#endif diff --git a/gcc/testsuite/gcc.dg/mips-args-2.c b/gcc/testsuite/gcc.dg/mips-args-2.c deleted file mode 100644 index c34751c1c51..00000000000 --- a/gcc/testsuite/gcc.dg/mips-args-2.c +++ /dev/null @@ -1,18 +0,0 @@ -/* Check the _MIPSEB and _MIPSEL macros are accurate. */ -/* { dg-do run { target mips*-*-* } } */ -extern void abort (void); -extern void exit (int); - -short foo = 1; -int main () -{ - char *p = (char *) &foo; - -#ifdef _MIPSEB - if (p[0] != 0 || p[1] != 1) -#else - if (p[0] != 1 || p[1] != 0) -#endif - abort (); - exit (0); -} diff --git a/gcc/testsuite/gcc.dg/mips-args-3.c b/gcc/testsuite/gcc.dg/mips-args-3.c deleted file mode 100644 index e1fde8646df..00000000000 --- a/gcc/testsuite/gcc.dg/mips-args-3.c +++ /dev/null @@ -1,38 +0,0 @@ -/* __mips, and related defines, guarantee that certain assembly - instructions can be used. Check a few examples. */ -/* { dg-do run { target mips*-*-* } } */ -extern void abort (void); -extern void exit (int); - -typedef int int32 __attribute__ ((mode (SI))); -typedef int int64 __attribute__ ((mode (DI))); -int foo (float inf, int64 in64, int32 in32) -{ - int64 res64; - int32 res32; - -#if __mips != 1 && defined (__mips_hard_float) - __asm__ ("trunc.w.s %0, %1" : "=f" (res32) : "f" (inf)); - if (res32 != 11) - abort (); -#endif - -#if defined (__mips64) - __asm__ ("daddu %0, %1, %1" : "=r" (res64) : "r" (in64)); - if (res64 != 50) - abort (); -#endif - -#if (__mips == 4 || __mips == 32 || __mips == 64) && !defined (__mips16) - __asm__ ("move %0,%.\n\tmovn %0,%1,%2" - : "=&r" (res32) : "r" (in32), "r" (in64 != 0)); - if (res32 != 60) - abort (); -#endif -} - -int main () -{ - foo (11.4f, 25, 60); - exit (0); -} diff --git a/gcc/testsuite/gcc.dg/mips-movcc-1.c b/gcc/testsuite/gcc.dg/mips-movcc-1.c deleted file mode 100644 index 70a7dc738b5..00000000000 --- a/gcc/testsuite/gcc.dg/mips-movcc-1.c +++ /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 index 22d58e94a1e..00000000000 --- a/gcc/testsuite/gcc.dg/mips-movcc-2.c +++ /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/mips-movcc-3.c b/gcc/testsuite/gcc.dg/mips-movcc-3.c deleted file mode 100644 index 3a3a43be15d..00000000000 --- a/gcc/testsuite/gcc.dg/mips-movcc-3.c +++ /dev/null @@ -1,51 +0,0 @@ -/* { dg-do compile { target "mips*-*-*" } } */ -/* { dg-options "-O2 -mips4" } */ -/* { dg-final { scan-assembler "movz.s" } } */ -/* { dg-final { scan-assembler "movn.s" } } */ -/* { dg-final { scan-assembler "movt.s" } } */ -/* { dg-final { scan-assembler "movz.d" } } */ -/* { 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); - -float -sub7 (float f, float g, int i) -{ - ext_float (i ? f : g); -} - -float -sub8 (float f, float g, long l) -{ - ext_float (!l ? f : g); -} - -float -sub9 (float f, float g, float h) -{ - ext_float (h ? f : g); -} - -double -suba (double f, double g, int i) -{ - ext_double (i ? f : g); -} - -double -subb (double f, double g, long l) -{ - ext_double (!l ? f : g); -} - -double -subc (double f, double g, double h) -{ - ext_double (!h ? f : g); -} -#endif diff --git a/gcc/testsuite/gcc.dg/mips-nmadd-1.c b/gcc/testsuite/gcc.dg/mips-nmadd-1.c deleted file mode 100644 index 1bf7895f2a8..00000000000 --- a/gcc/testsuite/gcc.dg/mips-nmadd-1.c +++ /dev/null @@ -1,34 +0,0 @@ -/* { dg-do compile { target "mips*-*-*" } } */ -/* { dg-options "-O2 -ffast-math -mips4" } */ -/* { 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) -{ - return -((f * g) + h); -} - -double -sub2 (double f, double g, double h) -{ - return -((f * g) + h); -} - -float -sub3 (float f, float g, float h) -{ - return -((f * g) - h); -} - -double -sub4 (double f, double g, double h) -{ - return -((f * g) - h); -} -#endif diff --git a/gcc/testsuite/gcc.dg/mips-nmadd-2.c b/gcc/testsuite/gcc.dg/mips-nmadd-2.c deleted file mode 100644 index 20b83bd21ae..00000000000 --- a/gcc/testsuite/gcc.dg/mips-nmadd-2.c +++ /dev/null @@ -1,34 +0,0 @@ -/* { dg-do compile { target "mips*-*-*" } } */ -/* { dg-options "-O2 -fno-fast-math -mips4" } */ -/* { 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) -{ - return -((f * g) + h); -} - -double -sub2 (double f, double g, double h) -{ - return -((f * g) + h); -} - -float -sub3 (float f, float g, float h) -{ - return -((f * g) - h); -} - -double -sub4 (double f, double g, double h) -{ - return -((f * g) - h); -} -#endif diff --git a/gcc/testsuite/gcc.dg/mips-rsqrt-1.c b/gcc/testsuite/gcc.dg/mips-rsqrt-1.c deleted file mode 100644 index b228ddba296..00000000000 --- a/gcc/testsuite/gcc.dg/mips-rsqrt-1.c +++ /dev/null @@ -1,21 +0,0 @@ -/* { dg-do compile { target "mips*-*-*" } } */ -/* { dg-options "-O2 -ffast-math -mips4" } */ -/* { 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); - -double foo(double x) -{ - return 1.0/sqrt(x); -} - -float bar(float x) -{ - return 1.0f/sqrtf(x); -} -#endif diff --git a/gcc/testsuite/gcc.dg/mips-rsqrt-2.c b/gcc/testsuite/gcc.dg/mips-rsqrt-2.c deleted file mode 100644 index a4cddcd0a0d..00000000000 --- a/gcc/testsuite/gcc.dg/mips-rsqrt-2.c +++ /dev/null @@ -1,21 +0,0 @@ -/* { dg-do compile { target "mips*-*-*" } } */ -/* { dg-options "-O2 -ffast-math -mips4" } */ -/* { 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); - -double foo(double x) -{ - return sqrt(1.0/x); -} - -float bar(float x) -{ - return sqrtf(1.0f/x); -} -#endif diff --git a/gcc/testsuite/gcc.dg/mips-rsqrt-3.c b/gcc/testsuite/gcc.dg/mips-rsqrt-3.c deleted file mode 100644 index 870a5c9aa6a..00000000000 --- a/gcc/testsuite/gcc.dg/mips-rsqrt-3.c +++ /dev/null @@ -1,28 +0,0 @@ -/* { dg-do compile { target "mips*-*-*" } } */ -/* { dg-options "-O2 -mips4" } */ -/* { dg-final { scan-assembler-not "rsqrt.d" } } */ -/* { dg-final { scan-assembler-not "rsqrt.s" } } */ - -extern double sqrt(double); -extern float sqrtf(float); - -double foo(double x) -{ - return 1.0/sqrt(x); -} - -double bar(double x) -{ - return sqrt(1.0/x); -} - -float foof(float x) -{ - return 1.0f/sqrtf(x); -} - -float barf(float x) -{ - return sqrtf(1.0f/x); -} - diff --git a/gcc/testsuite/gcc.dg/vr-mult-1.c b/gcc/testsuite/gcc.dg/vr-mult-1.c deleted file mode 100644 index a208067fb7d..00000000000 --- a/gcc/testsuite/gcc.dg/vr-mult-1.c +++ /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 index 4a3ad98cc2a..00000000000 --- a/gcc/testsuite/gcc.dg/vr-mult-2.c +++ /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" } } */ diff --git a/gcc/testsuite/gcc.target/mips/args-1.c b/gcc/testsuite/gcc.target/mips/args-1.c new file mode 100644 index 00000000000..56def9488a3 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/args-1.c @@ -0,0 +1,35 @@ +/* Check that certain preprocessor macros are defined, and do some + consistency checks. */ +/* { dg-do compile } */ + +const char *compiled_for = _MIPS_ARCH; +const char *optimized_for = _MIPS_TUNE; + +#if __mips_fpr != 32 && __mips_fpr != 64 +#error Bad __mips_fpr +#endif + +/* Test complementary macro pairs: exactly one of each pair + must be defined. */ + +#if defined (_R3000) == defined (_R4000) && !defined (__sgi__) +#error _R3000 / _R4000 mismatch +#endif + +#if defined (__mips_hard_float) == defined (__mips_soft_float) +#error __mips_hard_float / __mips_soft_float mismatch +#endif + +#if defined (_MIPSEL) == defined (_MIPSEB) +#error _MIPSEL / _MIPSEB mismatch +#endif + +/* Check for __mips64 consistency. */ + +#if defined (__mips64) != defined (_R4000) && !defined (__sgi__) +#error __mips64 / _R4000 mismatch +#endif + +#if defined (__mips64) && __mips != 3 && __mips != 4 && __mips != 64 +#error __mips64 / __mips mismatch +#endif diff --git a/gcc/testsuite/gcc.target/mips/args-2.c b/gcc/testsuite/gcc.target/mips/args-2.c new file mode 100644 index 00000000000..192756525f8 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/args-2.c @@ -0,0 +1,18 @@ +/* Check the _MIPSEB and _MIPSEL macros are accurate. */ +/* { dg-do run } */ +extern void abort (void); +extern void exit (int); + +short foo = 1; +int main () +{ + char *p = (char *) &foo; + +#ifdef _MIPSEB + if (p[0] != 0 || p[1] != 1) +#else + if (p[0] != 1 || p[1] != 0) +#endif + abort (); + exit (0); +} diff --git a/gcc/testsuite/gcc.target/mips/args-3.c b/gcc/testsuite/gcc.target/mips/args-3.c new file mode 100644 index 00000000000..e91816f0806 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/args-3.c @@ -0,0 +1,38 @@ +/* __mips, and related defines, guarantee that certain assembly + instructions can be used. Check a few examples. */ +/* { dg-do run } */ +extern void abort (void); +extern void exit (int); + +typedef int int32 __attribute__ ((mode (SI))); +typedef int int64 __attribute__ ((mode (DI))); +int foo (float inf, int64 in64, int32 in32) +{ + int64 res64; + int32 res32; + +#if __mips != 1 && defined (__mips_hard_float) + __asm__ ("trunc.w.s %0, %1" : "=f" (res32) : "f" (inf)); + if (res32 != 11) + abort (); +#endif + +#if defined (__mips64) + __asm__ ("daddu %0, %1, %1" : "=r" (res64) : "r" (in64)); + if (res64 != 50) + abort (); +#endif + +#if (__mips == 4 || __mips == 32 || __mips == 64) && !defined (__mips16) + __asm__ ("move %0,%.\n\tmovn %0,%1,%2" + : "=&r" (res32) : "r" (in32), "r" (in64 != 0)); + if (res32 != 60) + abort (); +#endif +} + +int main () +{ + foo (11.4f, 25, 60); + exit (0); +} diff --git a/gcc/testsuite/gcc.target/mips/asm-1.c b/gcc/testsuite/gcc.target/mips/asm-1.c index 008290572d3..aed5b8cb285 100644 --- a/gcc/testsuite/gcc.target/mips/asm-1.c +++ b/gcc/testsuite/gcc.target/mips/asm-1.c @@ -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 diff --git a/gcc/testsuite/gcc.target/mips/fix-vr4130-1.c b/gcc/testsuite/gcc.target/mips/fix-vr4130-1.c index d6d2a5ad7f3..1ddf547f702 100644 --- a/gcc/testsuite/gcc.target/mips/fix-vr4130-1.c +++ b/gcc/testsuite/gcc.target/mips/fix-vr4130-1.c @@ -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" } } */ diff --git a/gcc/testsuite/gcc.target/mips/fix-vr4130-2.c b/gcc/testsuite/gcc.target/mips/fix-vr4130-2.c index dcb48998425..633eae691e6 100644 --- a/gcc/testsuite/gcc.target/mips/fix-vr4130-2.c +++ b/gcc/testsuite/gcc.target/mips/fix-vr4130-2.c @@ -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" } } */ diff --git a/gcc/testsuite/gcc.target/mips/fix-vr4130-3.c b/gcc/testsuite/gcc.target/mips/fix-vr4130-3.c index ff258bab897..58f07b576bb 100644 --- a/gcc/testsuite/gcc.target/mips/fix-vr4130-3.c +++ b/gcc/testsuite/gcc.target/mips/fix-vr4130-3.c @@ -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" } } */ diff --git a/gcc/testsuite/gcc.target/mips/fix-vr4130-4.c b/gcc/testsuite/gcc.target/mips/fix-vr4130-4.c index acb2d0807f3..64752a8dcfe 100644 --- a/gcc/testsuite/gcc.target/mips/fix-vr4130-4.c +++ b/gcc/testsuite/gcc.target/mips/fix-vr4130-4.c @@ -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" } } */ diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-1.c b/gcc/testsuite/gcc.target/mips/mips-3d-1.c index c351d8c63a5..765bc491084 100644 --- a/gcc/testsuite/gcc.target/mips/mips-3d-1.c +++ b/gcc/testsuite/gcc.target/mips/mips-3d-1.c @@ -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 diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-2.c b/gcc/testsuite/gcc.target/mips/mips-3d-2.c index e34022c7a49..fc70fa2de07 100644 --- a/gcc/testsuite/gcc.target/mips/mips-3d-2.c +++ b/gcc/testsuite/gcc.target/mips/mips-3d-2.c @@ -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 diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-3.c b/gcc/testsuite/gcc.target/mips/mips-3d-3.c index 7044fc952f0..81d6c25f93c 100644 --- a/gcc/testsuite/gcc.target/mips/mips-3d-3.c +++ b/gcc/testsuite/gcc.target/mips/mips-3d-3.c @@ -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 diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-4.c b/gcc/testsuite/gcc.target/mips/mips-3d-4.c index 9723047ff83..b2b6bfe14d5 100644 --- a/gcc/testsuite/gcc.target/mips/mips-3d-4.c +++ b/gcc/testsuite/gcc.target/mips/mips-3d-4.c @@ -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 diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-5.c b/gcc/testsuite/gcc.target/mips/mips-3d-5.c index bd4c857037d..7dc6d28e0ea 100644 --- a/gcc/testsuite/gcc.target/mips/mips-3d-5.c +++ b/gcc/testsuite/gcc.target/mips/mips-3d-5.c @@ -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 diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-6.c b/gcc/testsuite/gcc.target/mips/mips-3d-6.c index 0b54ef1fecb..5a7622dd0e8 100644 --- a/gcc/testsuite/gcc.target/mips/mips-3d-6.c +++ b/gcc/testsuite/gcc.target/mips/mips-3d-6.c @@ -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 diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-7.c b/gcc/testsuite/gcc.target/mips/mips-3d-7.c index 1d9a481ef65..3a512f4a113 100644 --- a/gcc/testsuite/gcc.target/mips/mips-3d-7.c +++ b/gcc/testsuite/gcc.target/mips/mips-3d-7.c @@ -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 diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-8.c b/gcc/testsuite/gcc.target/mips/mips-3d-8.c index 955c2664f90..601e5ff30a4 100644 --- a/gcc/testsuite/gcc.target/mips/mips-3d-8.c +++ b/gcc/testsuite/gcc.target/mips/mips-3d-8.c @@ -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 diff --git a/gcc/testsuite/gcc.target/mips/mips-3d-9.c b/gcc/testsuite/gcc.target/mips/mips-3d-9.c index 23a1f48f0fb..11d863f352d 100644 --- a/gcc/testsuite/gcc.target/mips/mips-3d-9.c +++ b/gcc/testsuite/gcc.target/mips/mips-3d-9.c @@ -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 diff --git a/gcc/testsuite/gcc.target/mips/mips-ps-1.c b/gcc/testsuite/gcc.target/mips/mips-ps-1.c index 78f5384aeff..1723933839f 100644 --- a/gcc/testsuite/gcc.target/mips/mips-ps-1.c +++ b/gcc/testsuite/gcc.target/mips/mips-ps-1.c @@ -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 diff --git a/gcc/testsuite/gcc.target/mips/mips-ps-2.c b/gcc/testsuite/gcc.target/mips/mips-ps-2.c index ef639e61203..178bb910d8c 100644 --- a/gcc/testsuite/gcc.target/mips/mips-ps-2.c +++ b/gcc/testsuite/gcc.target/mips/mips-ps-2.c @@ -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 diff --git a/gcc/testsuite/gcc.target/mips/mips-ps-3.c b/gcc/testsuite/gcc.target/mips/mips-ps-3.c index e4f4db2bdd7..8d29cc9b6be 100644 --- a/gcc/testsuite/gcc.target/mips/mips-ps-3.c +++ b/gcc/testsuite/gcc.target/mips/mips-ps-3.c @@ -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 diff --git a/gcc/testsuite/gcc.target/mips/mips-ps-4.c b/gcc/testsuite/gcc.target/mips/mips-ps-4.c index 9e0677e7dfa..41c39dcaa22 100644 --- a/gcc/testsuite/gcc.target/mips/mips-ps-4.c +++ b/gcc/testsuite/gcc.target/mips/mips-ps-4.c @@ -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 diff --git a/gcc/testsuite/gcc.target/mips/mips-ps-type.c b/gcc/testsuite/gcc.target/mips/mips-ps-type.c index b4d9a7b2085..cd5566fcbfa 100644 --- a/gcc/testsuite/gcc.target/mips/mips-ps-type.c +++ b/gcc/testsuite/gcc.target/mips/mips-ps-type.c @@ -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" } } */ diff --git a/gcc/testsuite/gcc.target/mips/mips.exp b/gcc/testsuite/gcc.target/mips/mips.exp index 56d1f4dbdb0..4600cab0eb6 100644 --- a/gcc/testsuite/gcc.target/mips/mips.exp +++ b/gcc/testsuite/gcc.target/mips/mips.exp @@ -17,25 +17,160 @@ # 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 index 00000000000..30a0aa7830c --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/movcc-1.c @@ -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 index 00000000000..57c2c507ce7 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/movcc-2.c @@ -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); +} diff --git a/gcc/testsuite/gcc.target/mips/movcc-3.c b/gcc/testsuite/gcc.target/mips/movcc-3.c new file mode 100644 index 00000000000..ad439f92293 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/movcc-3.c @@ -0,0 +1,63 @@ +/* { 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" } } */ +/* { dg-final { scan-assembler "movz.d" } } */ +/* { dg-final { scan-assembler "movn.d" } } */ +/* { dg-final { scan-assembler "movf.d" } } */ + +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) +{ + ext_float (i ? f : g); +} + +float +sub8 (float f, float g, long l) +{ + ext_float (!l ? f : g); +} + +float +sub9 (float f, float g, float h) +{ + ext_float (h ? f : g); +} + +double +suba (double f, double g, int i) +{ + ext_double (i ? f : g); +} + +double +subb (double f, double g, long l) +{ + ext_double (!l ? f : g); +} + +double +subc (double f, double g, double h) +{ + ext_double (!h ? f : g); +} diff --git a/gcc/testsuite/gcc.target/mips/nmadd-1.c b/gcc/testsuite/gcc.target/mips/nmadd-1.c new file mode 100644 index 00000000000..e027b07d6d7 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/nmadd-1.c @@ -0,0 +1,30 @@ +/* { 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" } } */ + +float +sub1 (float f, float g, float h) +{ + return -((f * g) + h); +} + +double +sub2 (double f, double g, double h) +{ + return -((f * g) + h); +} + +float +sub3 (float f, float g, float h) +{ + return -((f * g) - h); +} + +double +sub4 (double f, double g, double h) +{ + return -((f * g) - h); +} diff --git a/gcc/testsuite/gcc.target/mips/nmadd-2.c b/gcc/testsuite/gcc.target/mips/nmadd-2.c new file mode 100644 index 00000000000..522407a5119 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/nmadd-2.c @@ -0,0 +1,30 @@ +/* { 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" } } */ + +float +sub1 (float f, float g, float h) +{ + return -((f * g) + h); +} + +double +sub2 (double f, double g, double h) +{ + return -((f * g) + h); +} + +float +sub3 (float f, float g, float h) +{ + return -((f * g) - h); +} + +double +sub4 (double f, double g, double h) +{ + return -((f * g) - h); +} diff --git a/gcc/testsuite/gcc.target/mips/rsqrt-1.c b/gcc/testsuite/gcc.target/mips/rsqrt-1.c new file mode 100644 index 00000000000..34e712422f4 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/rsqrt-1.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-mips-options "-O2 -ffast-math -mips4 -mhard-float" } */ +/* { dg-final { scan-assembler "rsqrt.d" } } */ +/* { dg-final { scan-assembler "rsqrt.s" } } */ + +extern double sqrt(double); +extern float sqrtf(float); + +double foo(double x) +{ + return 1.0/sqrt(x); +} + +float bar(float x) +{ + return 1.0f/sqrtf(x); +} diff --git a/gcc/testsuite/gcc.target/mips/rsqrt-2.c b/gcc/testsuite/gcc.target/mips/rsqrt-2.c new file mode 100644 index 00000000000..4bc3e7f134b --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/rsqrt-2.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-mips-options "-O2 -ffast-math -mips4 -mhard-float" } */ +/* { dg-final { scan-assembler "rsqrt.d" } } */ +/* { dg-final { scan-assembler "rsqrt.s" } } */ + +extern double sqrt(double); +extern float sqrtf(float); + +double foo(double x) +{ + return sqrt(1.0/x); +} + +float bar(float x) +{ + return sqrtf(1.0f/x); +} diff --git a/gcc/testsuite/gcc.target/mips/rsqrt-3.c b/gcc/testsuite/gcc.target/mips/rsqrt-3.c new file mode 100644 index 00000000000..76cee835eb6 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/rsqrt-3.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-mips-options "-O2 -mips4 -mhard-float" } */ +/* { dg-final { scan-assembler-not "rsqrt.d" } } */ +/* { dg-final { scan-assembler-not "rsqrt.s" } } */ + +extern double sqrt(double); +extern float sqrtf(float); + +double foo(double x) +{ + return 1.0/sqrt(x); +} + +double bar(double x) +{ + return sqrt(1.0/x); +} + +float foof(float x) +{ + return 1.0f/sqrtf(x); +} + +float barf(float x) +{ + return sqrtf(1.0f/x); +} diff --git a/gcc/testsuite/gcc.target/mips/sb1-1.c b/gcc/testsuite/gcc.target/mips/sb1-1.c index b6d671b7756..c9de3a8dbbb 100644 --- a/gcc/testsuite/gcc.target/mips/sb1-1.c +++ b/gcc/testsuite/gcc.target/mips/sb1-1.c @@ -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 index 00000000000..47d639131b9 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/vr-mult-1.c @@ -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 index 00000000000..9112ed08c82 --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/vr-mult-2.c @@ -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" } } */