SPU single-precision FP does not support subnormals:
authorUlrich Weigand <uweigand@de.ibm.com>
Wed, 2 Jul 2008 15:30:11 +0000 (15:30 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Wed, 2 Jul 2008 15:30:11 +0000 (15:30 +0000)
* gcc.c-torture/execute/ieee/mul-subnormal-single-1.x: New file.

SPU single-precision FP does not support Inf or Nan:
* gcc.c-torture/execute/ieee/inf-1.c: Disable "float" Inf test on SPU.
* gcc.c-torture/execute/ieee/compare-fp-1.x: New file.
* gcc.c-torture/execute/ieee/compare-fp-4.x: Disable test on SPU.
* gcc.c-torture/execute/ieee/fp-cmp-2.x: Disable test on SPU.
* gcc.c-torture/execute/ieee/fp-cmp-4f.x: New file.
* gcc.c-torture/execute/ieee/fp-cmp-8f.x: New file.
* gcc.dg/pr15784-3.c: Disable test on SPU.
* gcc.dg/pr28796-2.c: Likewise.
* gcc.dg/float-range-1.c: Likewise.
* gcc.dg/float-range-3.c: Likewise.
* gcc.dg/float-range-4.c: Likewise.
* gcc.dg/float-range-5.c: Likewise.
* gcc.dg/fold-overflow-1.c: Likewise.
* gcc.dg/builtins-1.c: SPU does not support __builtin_inff.
* gcc.dg/builtin-inf-1.c: SPU does not support __builtin_inff.
Check for error instead of warning "does not support infinity".
* gcc.dg/builtins-43.c: Disable "float" Inf/Nan tests on SPU.
* gcc.dg/builtins-44.c: Likewise.
* gcc.dg/builtins-45.c: Likewise.
* gcc.dg/torture/builtin-math-2.c: Likewise.
* gcc.dg/torture/builtin-logb-1.c: Likewise.
* gcc.dg/torture/builtin-modf-1.c: Likewise.
* gcc.dg/torture/builtin-ldexp-1.c: Likewise.
* gcc.dg/torture/builtin-frexp-1.c: Likewise.
* gcc.dg/torture/type-generic-1.c: Disable test on SPU.
* g++.dg/torture/type-generic-1.C: Likewise.

SPU single-precision FP always rounds towards zero:
* gcc.c-torture/execute/ieee/920518-1.x: New file.
* gcc.c-torture/execute/ieee/20010114-2.x: New file.
* gcc.c-torture/execute/ieee/20030331-1.x: New file.
* gcc.dg/torture/fp-int-convert-float.c: Disable test on SPU.
* gcc.dg/torture/fp-int-convert-timode.c: Disable "float" test on SPU.

From-SVN: r137357

32 files changed:
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/type-generic-1.C
gcc/testsuite/gcc.c-torture/execute/ieee/20010114-2.x [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/ieee/20030331-1.x [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/ieee/920518-1.x [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-1.x [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-4.x
gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-2.x
gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4f.x [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8f.x [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/ieee/inf-1.c
gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.x
gcc/testsuite/gcc.dg/builtin-inf-1.c
gcc/testsuite/gcc.dg/builtins-1.c
gcc/testsuite/gcc.dg/builtins-43.c
gcc/testsuite/gcc.dg/builtins-44.c
gcc/testsuite/gcc.dg/builtins-45.c
gcc/testsuite/gcc.dg/float-range-1.c
gcc/testsuite/gcc.dg/float-range-3.c
gcc/testsuite/gcc.dg/float-range-4.c
gcc/testsuite/gcc.dg/float-range-5.c
gcc/testsuite/gcc.dg/fold-overflow-1.c
gcc/testsuite/gcc.dg/pr15784-3.c
gcc/testsuite/gcc.dg/pr28796-2.c
gcc/testsuite/gcc.dg/torture/builtin-frexp-1.c
gcc/testsuite/gcc.dg/torture/builtin-ldexp-1.c
gcc/testsuite/gcc.dg/torture/builtin-logb-1.c
gcc/testsuite/gcc.dg/torture/builtin-math-2.c
gcc/testsuite/gcc.dg/torture/builtin-modf-1.c
gcc/testsuite/gcc.dg/torture/fp-int-convert-float.c
gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c
gcc/testsuite/gcc.dg/torture/type-generic-1.c

index ab606ceb560db0a95cca0c807405658404eebb6e..e8175a1208385a8d81d668f74987ae5ebea08cc0 100644 (file)
@@ -1,3 +1,43 @@
+2008-07-02  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+       SPU single-precision FP does not support subnormals:
+       * gcc.c-torture/execute/ieee/mul-subnormal-single-1.x: New file.
+
+       SPU single-precision FP does not support Inf or Nan:
+       * gcc.c-torture/execute/ieee/inf-1.c: Disable "float" Inf test on SPU.
+       * gcc.c-torture/execute/ieee/compare-fp-1.x: New file.
+       * gcc.c-torture/execute/ieee/compare-fp-4.x: Disable test on SPU.
+       * gcc.c-torture/execute/ieee/fp-cmp-2.x: Disable test on SPU.
+       * gcc.c-torture/execute/ieee/fp-cmp-4f.x: New file.
+       * gcc.c-torture/execute/ieee/fp-cmp-8f.x: New file.
+       * gcc.dg/pr15784-3.c: Disable test on SPU.
+       * gcc.dg/pr28796-2.c: Likewise.
+       * gcc.dg/float-range-1.c: Likewise.
+       * gcc.dg/float-range-3.c: Likewise.
+       * gcc.dg/float-range-4.c: Likewise.
+       * gcc.dg/float-range-5.c: Likewise.
+       * gcc.dg/fold-overflow-1.c: Likewise.
+       * gcc.dg/builtins-1.c: SPU does not support __builtin_inff.
+       * gcc.dg/builtin-inf-1.c: SPU does not support __builtin_inff.
+       Check for error instead of warning "does not support infinity".
+       * gcc.dg/builtins-43.c: Disable "float" Inf/Nan tests on SPU. 
+       * gcc.dg/builtins-44.c: Likewise.
+       * gcc.dg/builtins-45.c: Likewise.
+       * gcc.dg/torture/builtin-math-2.c: Likewise.
+       * gcc.dg/torture/builtin-logb-1.c: Likewise.
+       * gcc.dg/torture/builtin-modf-1.c: Likewise.
+       * gcc.dg/torture/builtin-ldexp-1.c: Likewise.
+       * gcc.dg/torture/builtin-frexp-1.c: Likewise.
+       * gcc.dg/torture/type-generic-1.c: Disable test on SPU.
+       * g++.dg/torture/type-generic-1.C: Likewise.
+
+       SPU single-precision FP always rounds towards zero:
+       * gcc.c-torture/execute/ieee/920518-1.x: New file.
+       * gcc.c-torture/execute/ieee/20010114-2.x: New file.
+       * gcc.c-torture/execute/ieee/20030331-1.x: New file.
+       * gcc.dg/torture/fp-int-convert-float.c: Disable test on SPU.
+       * gcc.dg/torture/fp-int-convert-timode.c: Disable "float" test on SPU.
+
 2008-07-02  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/36590
index 92dd9fcb7513079a313c475ef2c5dd5fe231f126..7db2e69d0a58de8ca49c0866c81bafb0e02e67e4 100644 (file)
@@ -3,6 +3,7 @@
 
 /* { dg-do run } */
 /* { dg-options "-mieee" { target sh*-*-* } } */
+/* { dg-skip-if "No Inf/NaN support" { spu-*-* } } */
 
 #include "../../gcc.dg/tg-tests.h"
 
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/20010114-2.x b/gcc/testsuite/gcc.c-torture/execute/ieee/20010114-2.x
new file mode 100644 (file)
index 0000000..73b18d1
--- /dev/null
@@ -0,0 +1,6 @@
+if [istarget "spu-*-*"] {
+    # This doesn't work on the SPU because single precision floats are
+    # always rounded toward 0.
+    return 1
+}
+return 0
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/20030331-1.x b/gcc/testsuite/gcc.c-torture/execute/ieee/20030331-1.x
new file mode 100644 (file)
index 0000000..73b18d1
--- /dev/null
@@ -0,0 +1,6 @@
+if [istarget "spu-*-*"] {
+    # This doesn't work on the SPU because single precision floats are
+    # always rounded toward 0.
+    return 1
+}
+return 0
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/920518-1.x b/gcc/testsuite/gcc.c-torture/execute/ieee/920518-1.x
new file mode 100644 (file)
index 0000000..73b18d1
--- /dev/null
@@ -0,0 +1,6 @@
+if [istarget "spu-*-*"] {
+    # This doesn't work on the SPU because single precision floats are
+    # always rounded toward 0.
+    return 1
+}
+return 0
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-1.x b/gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-1.x
new file mode 100644 (file)
index 0000000..2f7a4ec
--- /dev/null
@@ -0,0 +1,6 @@
+if [istarget "spu-*-*"] {
+    # The SPU single-precision floating point format does not
+    # support Nan & Inf. 
+    return 1
+}
+return 0
index 510a30909ea8e28e448f4a6c9eba71fe9243c077..d7ecd1100897d27c89cb9b71ba546278a0d9770e 100644 (file)
@@ -13,5 +13,11 @@ if [istarget "arm*-*-vxworks*"] {
     }
 }
 
+if [istarget "spu-*-*"] {
+    # The SPU single-precision floating point format does not
+    # support Nan & Inf.
+    return 1
+}
+
 lappend additional_flags "-fno-trapping-math"
 return 0
index 84c193fe0e47d13f0b71eb83a159dd47d0f2e20b..0fe5a98d375760301d285652e75e063cffa331e8 100644 (file)
@@ -13,4 +13,10 @@ if [istarget "arm*-*-vxworks*"] {
     }
 }
 
+if [istarget "spu-*-*"] {
+    # The SPU single-precision floating point format does not
+    # support Nan & Inf.
+    return 1
+}
+
 return 0
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4f.x b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4f.x
new file mode 100644 (file)
index 0000000..2f7a4ec
--- /dev/null
@@ -0,0 +1,6 @@
+if [istarget "spu-*-*"] {
+    # The SPU single-precision floating point format does not
+    # support Nan & Inf. 
+    return 1
+}
+return 0
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8f.x b/gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8f.x
new file mode 100644 (file)
index 0000000..2f7a4ec
--- /dev/null
@@ -0,0 +1,6 @@
+if [istarget "spu-*-*"] {
+    # The SPU single-precision floating point format does not
+    # support Nan & Inf. 
+    return 1
+}
+return 0
index 34f60f3f1c0095ae94013183e7d81d5f2edf82be..eee8c0130bacb6898f8aa274b3d63a869de948ee 100644 (file)
@@ -2,7 +2,10 @@ extern void abort (void);
 
 int main()
 {
+#ifndef __SPU__
+  /* The SPU single-precision floating point format does not support Inf.  */
   float fi = __builtin_inff();
+#endif
   double di = __builtin_inf();
   long double li = __builtin_infl();
 
@@ -10,22 +13,28 @@ int main()
   double dh = __builtin_huge_val();
   long double lh = __builtin_huge_vall();
 
+#ifndef __SPU__
   if (fi + fi != fi)
     abort ();
+#endif
   if (di + di != di)
     abort ();
   if (li + li != li)
     abort ();
 
+#ifndef __SPU__
   if (fi != fh)
     abort ();
+#endif
   if (di != dh)
     abort ();
   if (li != lh)
     abort ();
 
+#ifndef __SPU__
   if (fi <= 0)
     abort ();
+#endif
   if (di <= 0)
     abort ();
   if (li <= 0)
index ce771550b2ee24adf63cc3faaded1845fd922030..5978c94a8eae69c2d94e2db81f91943702ea791c 100644 (file)
@@ -8,4 +8,9 @@ if {[istarget "m68k-*-*"] && [check_effective_target_coldfire_fpu]} {
     # not aware of any system that has this.
     set torture_execute_xfail "m68k-*-*"
 }
+if [istarget "spu-*-*"] {
+    # The SPU single-precision floating point format does not
+    # support subnormals.
+    return 1
+}
 return 0
index fdb4612274cb226afe7018c8a1f89bf3d9f4d1c6..d96a5b6b3f506deda7ff39182ce7206a79d20fd7 100644 (file)
@@ -8,6 +8,6 @@ float fh = __builtin_huge_valf();
 double dh = __builtin_huge_val();
 long double lh = __builtin_huge_vall();
 
-/* { dg-warning "does not support infinity" "INF unsupported" { target vax-*-* } 3 } */
-/* { dg-warning "does not support infinity" "INF unsupported" { target vax-*-* } 4 } */
-/* { dg-warning "does not support infinity" "INF unsupported" { target vax-*-* } 5 } */
+/* { dg-error "does not support infinity" "INF unsupported" { target vax-*-* spu-*-* } 3 } */
+/* { dg-error "does not support infinity" "INF unsupported" { target vax-*-* } 4 } */
+/* { dg-error "does not support infinity" "INF unsupported" { target vax-*-* } 5 } */
index 573a879bd0099a54fef8669282413c5a1e72b159..5dab9fe0a4e0a410eea3f14c067430e52bc8fcca 100644 (file)
@@ -144,7 +144,7 @@ FPTEST2ARG2_REENT (gamma, int *) /* gamma_r */
 FPTEST0     (huge_val)
 FPTEST2     (hypot)
 FPTEST1     (ilogb)
-FPTEST0     (inf)
+FPTEST0     (inf)  /* { dg-warning "target format does not support infinity" "inf" {target spu-*-*} } */
 FPTEST1     (j0)
 FPTEST1     (j1)
 FPTEST2ARG1 (jn, int)
index 4256967ee53a8fe8a5439dac121edf23c488ac43..85d96b6cb0c45a1e857eef3614feb9ac00e533cf 100644 (file)
@@ -12,15 +12,20 @@ int
 main ()
 {
   double nan = __builtin_nan ("");
+#ifndef __SPU__
+  /* The SPU single-precision floating point format does not support NANs.  */
   float nanf = __builtin_nanf ("");
+#endif
   long double nanl = __builtin_nanl ("");
 
   if (!__builtin_isnan (nan))
     link_error ();
+#ifndef __SPU__
   if (!__builtin_isnan (nanf))
     link_error ();
   if (!__builtin_isnanf (nanf))
     link_error ();
+#endif
   if (!__builtin_isnan (nanl))
     link_error ();
   if (!__builtin_isnanl (nanl))
index b3916886a43c202f7e7d7988e027d461465ac8fe..9e19d774dfd78e7f9c82f4cf9df9184afa9f4a8c 100644 (file)
@@ -12,15 +12,20 @@ int
 main ()
 {
   double pinf = __builtin_inf ();
+#ifndef __SPU__
+  /* The SPU single-precision floating point format does not support Inf.  */
   float pinff = __builtin_inff ();
+#endif
   long double pinfl = __builtin_infl ();
 
   if (__builtin_isinf (pinf) != 1)
     link_error ();
+#ifndef __SPU__
   if (__builtin_isinf (pinff) != 1)
     link_error ();
   if (__builtin_isinff (pinff) != 1)
     link_error ();
+#endif
   if (__builtin_isinf (pinfl) != 1)
     link_error ();
   if (__builtin_isinfl (pinfl) != 1)
@@ -28,10 +33,12 @@ main ()
 
   if (__builtin_isinf (-pinf) != -1)
     link_error ();
+#ifndef __SPU__
   if (__builtin_isinf (-pinff) != -1)
     link_error ();
   if (__builtin_isinff (-pinff) != -1)
     link_error ();
+#endif
   if (__builtin_isinf (-pinfl) != -1)
     link_error ();
   if (__builtin_isinfl (-pinfl) != -1)
index ad9d39ec268ab021f14c971b08247a2cc484dc9e..15ec33af6771b3234e0beb9d5c256025578fd4f2 100644 (file)
@@ -12,24 +12,34 @@ int
 main ()
 {
   double nan = __builtin_nan ("");
+#ifndef __SPU__
+  /* The SPU single-precision floating point format does not support NANs.  */
   float nanf = __builtin_nanf ("");
+#endif
   long double nanl = __builtin_nanl ("");
 
   double pinf = __builtin_inf ();
+#ifndef __SPU__
+  /* The SPU single-precision floating point format does not support Inf.  */
   float pinff = __builtin_inff ();
+#endif
   long double pinfl = __builtin_infl ();
 
   if (__builtin_finite (pinf))
     link_error ();
+#ifndef __SPU__
   if (__builtin_finitef (pinff))
     link_error ();
+#endif
   if (__builtin_finitel (pinfl))
     link_error ();
 
   if (__builtin_finite (nan))
     link_error ();
+#ifndef __SPU__
   if (__builtin_finitef (nanf))
     link_error ();
+#endif
   if (__builtin_finitel (nanl))
     link_error ();
 
index bf050487a2f4b622df5a66349ad39a4ad52977d1..ddd7fd672072a1d41fd98fd823d934570df1fc0a 100644 (file)
@@ -4,6 +4,7 @@
 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
 /* { dg-do compile } */
 /* { dg-options "-ansi -pedantic-errors -Woverflow" } */
+/* { dg-skip-if "No Inf support" { spu-*-* } } */
 
 void
 f (void)
index 7fa766f526e36261f35c5f6ea82347db0c0bbc52..e018a1ebc16989116e95eebcf4006669a28442c5 100644 (file)
@@ -1,6 +1,7 @@
 /* PR 23572 : warnings for out of range floating-point constants.  */
 /* { dg-compile } */
 /* { dg-options "-std=c99" } */
+/* { dg-skip-if "No Inf support" { spu-*-* } } */
 #include <math.h>
 
 #ifndef INFINITY
index 2ec38c43bf669b33a0f8626ec637b0181b1d5ce5..fbb820f9b21f06f251f15875236cdfd60ae85988 100644 (file)
@@ -1,6 +1,7 @@
 /* PR 23572 : warnings for out of range floating-point constants.  */
 /* { dg-compile } */
 /* { dg-options "-Wno-overflow -std=c99" } */
+/* { dg-skip-if "No Inf support" { spu-*-* } } */
 #include <math.h>
 
 #ifndef INFINITY
index 49742e322bfdd84605a09762d3401afe55c8d153..89f00796aec9be16d5c5b9e58ba886654ac8ab48 100644 (file)
@@ -2,6 +2,7 @@
    Test that they are NOT pedantic warnings.  */
 /* { dg-compile } */
 /* { dg-options "-pedantic-errors -std=c99" } */
+/* { dg-skip-if "No Inf support" { spu-*-* } } */
 #include <math.h>
 
 #ifndef INFINITY
index e2b731b735aab83164575cf71b445b286b72c3bc..bd4d25a73ed23a227a4c0c46351e9970b49e66b7 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-compile } */
 /* { dg-skip-if "consts are shorts, not longs" { "m32c-*-*" "avr-*-*" } { "*" } { "" } } */
+/* { dg-skip-if "No Inf support" { spu-*-* } } */
 /* { dg-options "-O -ftrapping-math" } */
 
 /* There should be exactly 2 +Inf in the assembly file.  */
index a8bdc552cde26211ec56025591ed150b5f53c14c..746f9660e48fd6039d13f679f945d17aa1fffc4c 100644 (file)
@@ -1,4 +1,5 @@
 /* { dg-do compile } */
+/* { dg-skip-if "No NaN support" { spu-*-* } } */
 /* SH4 without -mieee defaults to -ffinite-math-only.  */
 /* { dg-options "-fdump-tree-gimple -fno-finite-math-only" } */
 /* Test for folding abs(x) where appropriate.  */
index f4900817581c5aba8616beabafb5faba0839f37b..17fd1584dde577a35c7a16cebd8accbf6d1a3600 100644 (file)
@@ -1,6 +1,7 @@
 /* { dg-do run } */
 /* { dg-options "-O2 -funsafe-math-optimizations -fno-finite-math-only -DUNSAFE" } */
 /* { dg-options "-mieee -O2 -funsafe-math-optimizations -fno-finite-math-only -DUNSAFE" { target alpha*-*-* } } */
+/* { dg-skip-if "No Inf/NaN support" { spu-*-* } } */
 
 #include "tg-tests.h"
 
index 2225f825b8288c6f326caa67f07f3a2b4c295312..3ef23648a341497455dd4792a93c17ef086209bf 100644 (file)
@@ -53,6 +53,7 @@ extern void link_error(int);
 
 /* Test that FUNCRES(frexp(NEG FUNCARG(ARGARG),&i)) is false.  Check
    the sign as well.  Ensure side-effects are evaluated in i.  */
+#ifndef __SPU__
 #define TESTIT_FREXP2(NEG,FUNCARG,ARGARG,FUNCRES) do { \
   int i=5; \
   if (!__builtin_##FUNCRES##f(__builtin_frexpf(NEG __builtin_##FUNCARG##f(ARGARG),&i)) \
@@ -68,6 +69,20 @@ extern void link_error(int);
       || CKEXP(i,8)) \
     link_error(__LINE__); \
   } while (0)
+#else
+#define TESTIT_FREXP2(NEG,FUNCARG,ARGARG,FUNCRES) do { \
+  int i=6; \
+  /* SPU single-precision floating point format does not support Inf or Nan.  */ \
+  if (!__builtin_##FUNCRES(__builtin_frexp(NEG __builtin_##FUNCARG(ARGARG),&i)) \
+      || CKSGN(__builtin_frexp(NEG __builtin_##FUNCARG(ARGARG),(i++,&i)), NEG __builtin_##FUNCARG(ARGARG)) \
+      || CKEXP(i,7)) \
+    link_error(__LINE__); \
+  if (!__builtin_##FUNCRES##l(__builtin_frexpl(NEG __builtin_##FUNCARG##l(ARGARG),&i)) \
+      || CKSGN_L(__builtin_frexpl(NEG __builtin_##FUNCARG##l(ARGARG),(i++,&i)), NEG __builtin_##FUNCARG##l(ARGARG)) \
+      || CKEXP(i,8)) \
+    link_error(__LINE__); \
+  } while (0)
+#endif
 
 void __attribute__ ((__noinline__))
 foo(void)
index 6efa870f837b28f903f17f4bd387710cafb7c253..94560a8abb42c0ffdf650643d383f0cfc7991144 100644 (file)
@@ -45,6 +45,7 @@ extern void link_error(int);
 
 /* Test that FUNCRES(FUNC(NEG FUNCARG(ARGARG),ARG2)) is false.  Check
    the sign as well.  */
+#ifndef __SPU__
 #define TESTIT3(FUNC,NEG,FUNCARG,ARGARG,ARG2,FUNCRES) do { \
   if (!__builtin_##FUNCRES##f(__builtin_##FUNC##f(NEG __builtin_##FUNCARG##f(ARGARG),ARG2)) \
       || CKSGN_F(__builtin_##FUNC##f(NEG __builtin_##FUNCARG##f(ARGARG),ARG2), NEG __builtin_##FUNCARG##f(ARGARG))) \
@@ -56,6 +57,17 @@ extern void link_error(int);
       || CKSGN_L(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG),ARG2), NEG __builtin_##FUNCARG##l(ARGARG))) \
     link_error(__LINE__); \
   } while (0)
+#else
+#define TESTIT3(FUNC,NEG,FUNCARG,ARGARG,ARG2,FUNCRES) do { \
+  /* SPU single-precision floating point format does not support Inf or Nan.  */ \
+  if (!__builtin_##FUNCRES(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG),ARG2)) \
+      || CKSGN(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG),ARG2), NEG __builtin_##FUNCARG(ARGARG))) \
+    link_error(__LINE__); \
+  if (!__builtin_##FUNCRES##l(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG),ARG2)) \
+      || CKSGN_L(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG),ARG2), NEG __builtin_##FUNCARG##l(ARGARG))) \
+    link_error(__LINE__); \
+  } while (0)
+#endif
 
 /* Using foo==MIN/MAX float values, test that FUNC(foo,EXP) == foo*exp2(EXP),
    and also that FUNC(foo,-EXP) == foo*exp2(-EXP).  */
index 7c8de654c83e44deae58c114cd61c54657b21947..25d0f91064e7c3fa42a20628a72e8411c068de73 100644 (file)
@@ -47,6 +47,7 @@ extern void link_error(int);
 
 /* Test if FUNCRES(FUNC(NEG FUNCARG(ARGARG))) is false.  Check the
    sign as well.  */
+#ifndef __SPU__
 #define TESTIT3(FUNC,NEG,FUNCARG,ARGARG,FUNCRES) do { \
   if (!__builtin_##FUNCRES##f(__builtin_##FUNC(NEG __builtin_##FUNCARG##f(ARGARG))) \
       || CKSGN_F(__builtin_##FUNC##f(NEG __builtin_##FUNCARG##f(ARGARG)), NEG __builtin_##FUNCARG##f(ARGARG))) \
@@ -58,6 +59,17 @@ extern void link_error(int);
       || CKSGN_L(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG)), NEG __builtin_##FUNCARG##l(ARGARG))) \
     link_error(__LINE__); \
   } while (0)
+#else
+#define TESTIT3(FUNC,NEG,FUNCARG,ARGARG,FUNCRES) do { \
+  /* SPU single-precision floating point format does not support Inf or Nan.  */ \
+  if (!__builtin_##FUNCRES(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG))) \
+      || CKSGN(__builtin_##FUNC(NEG __builtin_##FUNCARG(ARGARG)), NEG __builtin_##FUNCARG(ARGARG))) \
+    link_error(__LINE__); \
+  if (!__builtin_##FUNCRES##l(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG))) \
+      || CKSGN_L(__builtin_##FUNC##l(NEG __builtin_##FUNCARG##l(ARGARG)), NEG __builtin_##FUNCARG##l(ARGARG))) \
+    link_error(__LINE__); \
+  } while (0)
+#endif
 
 void __attribute__ ((__noinline__))
 foo(void)
index 214a3ef7c0436306591e1935b5d1e3440cdcdd65..5c402873ab786e4694dbad3c9b478428cdfa8655 100644 (file)
@@ -59,15 +59,21 @@ extern void fool (long double);
 void bar()
 {
   /* An argument of NaN is not evaluated at compile-time.  */
+#ifndef __SPU__
   foof (__builtin_exp2f (__builtin_nanf("")));
+#endif
   foo (__builtin_exp2 (__builtin_nan("")));
   fool (__builtin_exp2l (__builtin_nanl("")));
 
   /* An argument of Inf/-Inf is not evaluated at compile-time.  */
+#ifndef __SPU__
   foof (__builtin_exp2f (__builtin_inff()));
+#endif
   foo (__builtin_exp2 (__builtin_inf()));
   fool (__builtin_exp2l (__builtin_infl()));
+#ifndef __SPU__
   foof (__builtin_exp2f (-__builtin_inff()));
+#endif
   foo (__builtin_exp2 (-__builtin_inf()));
   fool (__builtin_exp2l (-__builtin_infl()));
 
@@ -130,24 +136,36 @@ void bar()
   TESTIT (tgamma, -3.0);
 
   /* An argument of NaN is not evaluated at compile-time.  */
+#ifndef __SPU__
   foof (__builtin_powf (__builtin_nanf(""), 2.5F));
+#endif
   foo (__builtin_pow (__builtin_nan(""), 2.5));
   fool (__builtin_powl (__builtin_nanl(""), 2.5L));
+#ifndef __SPU__
   foof (__builtin_powf (2.5F, __builtin_nanf("")));
+#endif
   foo (__builtin_pow (2.5, __builtin_nan("")));
   fool (__builtin_powl (2.5L, __builtin_nanl("")));
 
   /* An argument of Inf/-Inf is not evaluated at compile-time.  */
+#ifndef __SPU__
   foof (__builtin_powf (__builtin_inff(), 2.5F));
+#endif
   foo (__builtin_pow (__builtin_inf(), 2.5));
   fool (__builtin_powl (__builtin_infl(), 2.5L));
+#ifndef __SPU__
   foof (__builtin_powf (-__builtin_inff(), 2.5F));
+#endif
   foo (__builtin_pow (-__builtin_inf(), 2.5));
   fool (__builtin_powl (-__builtin_infl(), 2.5L));
+#ifndef __SPU__
   foof (__builtin_powf (2.5F, __builtin_inff()));
+#endif
   foo (__builtin_pow (2.5, __builtin_inf()));
   fool (__builtin_powl (2.5L, __builtin_infl()));
+#ifndef __SPU__
   foof (__builtin_powf (2.5F, -__builtin_inff()));
+#endif
   foo (__builtin_pow (2.5, -__builtin_inf()));
   fool (__builtin_powl (2.5L, -__builtin_infl()));
 
@@ -235,17 +253,25 @@ void bar()
   TESTIT (ilogb, 0.0);
   TESTIT (ilogb, -0.0);
 
+#ifndef __SPU__
   foof (__builtin_ilogbf (__builtin_inff()));
+#endif
   foo (__builtin_ilogb (__builtin_inf()));
   fool (__builtin_ilogbl (__builtin_infl()));
+#ifndef __SPU__
   foof (__builtin_ilogbf (-__builtin_inff()));
+#endif
   foo (__builtin_ilogb (-__builtin_inf()));
   fool (__builtin_ilogbl (-__builtin_infl()));
 
+#ifndef __SPU__
   foof (__builtin_ilogbf (__builtin_nanf("")));
+#endif
   foo (__builtin_ilogb (__builtin_nan("")));
   fool (__builtin_ilogbl (__builtin_nanl("")));
+#ifndef __SPU__
   foof (__builtin_ilogbf (-__builtin_nanf("")));
+#endif
   foo (__builtin_ilogb (-__builtin_nan("")));
   fool (__builtin_ilogbl (-__builtin_nanl("")));
 
@@ -291,7 +317,8 @@ void bar()
 }
 
 /* { dg-final { scan-tree-dump-times "exp2 " 9 "original" } } */
-/* { dg-final { scan-tree-dump-times "exp2f" 9 "original" } } */
+/* { dg-final { scan-tree-dump-times "exp2f" 9 "original" { target { ! { spu*-*-* } } } } } */
+/* { dg-final { scan-tree-dump-times "exp2f" 6 "original" { target { spu*-*-* } } } } */
 /* { dg-final { scan-tree-dump-times "exp2l" 9 "original" } } */
 /* { dg-final { scan-tree-dump-times "asin " 2 "original" } } */
 /* { dg-final { scan-tree-dump-times "asinf" 2 "original" } } */
@@ -321,7 +348,8 @@ void bar()
 /* { dg-final { scan-tree-dump-times "tgammaf" 5 "original" } } */
 /* { dg-final { scan-tree-dump-times "tgammal" 5 "original" } } */
 /* { dg-final { scan-tree-dump-times "pow " 13 "original" } } */
-/* { dg-final { scan-tree-dump-times "powf" 13 "original" } } */
+/* { dg-final { scan-tree-dump-times "powf" 13 "original" { target { ! { spu*-*-* } } } } } */
+/* { dg-final { scan-tree-dump-times "powf" 7 "original" { target { spu*-*-* } } } } */
 /* { dg-final { scan-tree-dump-times "powl" 13 "original" } } */
 /* { dg-final { scan-tree-dump-times "fma " 3 "original" } } */
 /* { dg-final { scan-tree-dump-times "fmaf" 3 "original" } } */
@@ -342,7 +370,8 @@ void bar()
 /* { dg-final { scan-tree-dump-times "_logbf" 2 "original" } } */
 /* { dg-final { scan-tree-dump-times "_logbl" 2 "original" } } */
 /* { dg-final { scan-tree-dump-times "ilogb " 6 "original" } } */
-/* { dg-final { scan-tree-dump-times "ilogbf" 6 "original" } } */
+/* { dg-final { scan-tree-dump-times "ilogbf" 6 "original" { target { ! { spu*-*-* } } } } } */
+/* { dg-final { scan-tree-dump-times "ilogbf" 2 "original" { target { spu*-*-* } } } } */
 /* { dg-final { scan-tree-dump-times "ilogbl" 6 "original" } } */
 /* { dg-final { scan-tree-dump-times "y0 " 3 "original" } } */
 /* { dg-final { scan-tree-dump-times "y0f" 3 "original" } } */
index 0bed72ba138840f77ce26e98f11b7b24e311ee2a..05e16ac2cc473bd98395653a69be8575a051b1af 100644 (file)
@@ -62,6 +62,7 @@ extern void link_error(int);
 /* Test that modf(NEG FUNCARG(ARGARG, &iptr)) == FRACRES &&
    FUNCRES(iptr) is true.  Check the sign of both as well.  This is
    for checking an argument of Inf.  */
+#ifndef __SPU__
 #define TESTIT_MODF2(NEG,FUNCARG,ARGARG,FUNCRES,FRACRES) do { \
   float iptrf = 0.5; double iptr = 0.5; long double iptrl = 0.5; \
   if (__builtin_modff(NEG __builtin_##FUNCARG##f(ARGARG),&iptrf) != FRACRES##f \
@@ -80,10 +81,27 @@ extern void link_error(int);
       || CKSGN_IPTR_L(iptrl,FRACRES##l)) \
     link_error(__LINE__); \
   } while (0)
+#else
+#define TESTIT_MODF2(NEG,FUNCARG,ARGARG,FUNCRES,FRACRES) do { \
+  /* SPU single-precision floating point format does not support Inf or Nan.  */ \
+  double iptr = 0.5; long double iptrl = 0.5; \
+  if (__builtin_modf(NEG __builtin_##FUNCARG(ARGARG),&iptr) != FRACRES \
+      || CKSGN(__builtin_modf(NEG __builtin_##FUNCARG(ARGARG),&iptr), FRACRES) \
+      || CKIPTR(!__builtin_##FUNCRES(iptr),0) \
+      || CKSGN_IPTR(iptr,FRACRES)) \
+    link_error(__LINE__); \
+  if (__builtin_modfl(NEG __builtin_##FUNCARG##l(ARGARG),&iptrl) != FRACRES##l \
+      || CKSGN_L(__builtin_modfl(NEG __builtin_##FUNCARG##l(ARGARG),&iptrl), FRACRES##l) \
+      || CKIPTR(!__builtin_##FUNCRES##l(iptrl),0) \
+      || CKSGN_IPTR_L(iptrl,FRACRES##l)) \
+    link_error(__LINE__); \
+  } while (0)
+#endif
 
 /* Test that FUNCRES(modf(NEG FUNCARG(ARGARG, &iptr))) is true &&
    FUNCRES(iptr) is true.  Check the sign of both as well.  This is
    for checking an argument of NaN.  */
+#ifndef __SPU__
 #define TESTIT_MODF3(NEG,FUNCARG,ARGARG,FUNCRES) do { \
   float iptrf = 0.5; double iptr = 0.5; long double iptrl = 0.5; \
   if (CKRES(!__builtin_##FUNCRES##f(__builtin_modff(NEG __builtin_##FUNCARG##f(ARGARG),&iptrf))) \
@@ -102,6 +120,22 @@ extern void link_error(int);
       || CKSGN_IPTR_L(iptrl,NEG 1)) \
     link_error(__LINE__); \
   } while (0)
+#else
+#define TESTIT_MODF3(NEG,FUNCARG,ARGARG,FUNCRES) do { \
+  /* SPU single-precision floating point format does not support Inf or Nan.  */ \
+  double iptr = 0.5; long double iptrl = 0.5; \
+  if (CKRES(!__builtin_##FUNCRES(__builtin_modf(NEG __builtin_##FUNCARG(ARGARG),&iptr))) \
+      || CKSGN(__builtin_modf(NEG __builtin_##FUNCARG(ARGARG),&iptr), NEG 1) \
+      || CKIPTR(!__builtin_##FUNCRES(iptr),0) \
+      || CKSGN_IPTR(iptr,NEG 1)) \
+    link_error(__LINE__); \
+  if (CKRES(!__builtin_##FUNCRES##l(__builtin_modfl(NEG __builtin_##FUNCARG##l(ARGARG),&iptrl))) \
+      || CKSGN_L(__builtin_modfl(NEG __builtin_##FUNCARG##l(ARGARG),&iptrl), NEG 1) \
+      || CKIPTR(!__builtin_##FUNCRES##l(iptrl),0) \
+      || CKSGN_IPTR_L(iptrl,NEG 1)) \
+    link_error(__LINE__); \
+  } while (0)
+#endif
 
 void __attribute__ ((__noinline__))
 foo(void)
index 7fca1df7adf2479b55093c9b579a738410fa0a2a..ca5a4f8b6d7106b1eebf4e3614b02f9bc23e7a0d 100644 (file)
@@ -2,6 +2,7 @@
 /* Origin: Joseph Myers <joseph@codesourcery.com> */
 /* { dg-do run } */
 /* { dg-options "" } */
+/* { dg-skip-if "Round to zero" { spu-*-* } } */
 
 #include <float.h>
 #include "fp-int-convert.h"
index 2b27153044cfe60abd0b93869e1614f1597ff11b..faeae6050d102bb000a7eb1280cc59fbe2745563 100644 (file)
@@ -9,7 +9,10 @@
 int
 main (void)
 {
+#ifndef __SPU__
+  /* Single-precision floating point on SPU always rounds to zero.  */
   TEST_I_F(TItype, UTItype, float, FLT_MANT_DIG);
+#endif
   TEST_I_F(TItype, UTItype, double, DBL_MANT_DIG);
   /* Disable the long double tests when using IBM Extended Doubles.
      They have variable precision, but constants calculated by gcc's
index 9b69e923055149ca7bca5f9bb06809d69f1fce6b..9a8e9d0048c72117ecefb08bcc67a58cbac723d5 100644 (file)
@@ -3,6 +3,7 @@
 
 /* { dg-do run } */
 /* { dg-options "-mieee" { target sh*-*-* } } */
+/* { dg-skip-if "No Inf/NaN support" { spu-*-* } } */
 
 #include "../tg-tests.h"