[PATCH, testsuite] Fix math testsuite failures on SPU
Ulrich Weigand
uweigand@de.ibm.com
Sun Jun 15 15:53:00 GMT 2008
Hello,
a large number of test cases fail on the SPU because its single-precision
floating point format is not quite compatible with IEEE in a number of
aspects:
- Inf and Nan are not supported; instead, the range of exponents for
normal numbers is increased by one.
- All operations always round towards zero (instead of the usual round
to nearest default).
- Subnormal numbers (while present in the format) are not respected by
operations (they are never produced, and are treated as zero on input).
The following patch disables all math-related test cases in the test suite
that fail because of these differences.
In some cases, this means simply skipping the whole test on the SPU; in
other cases (where both float and double behaviour is tested within a
single test), I've attempted to selectively disable only the "float"
tests (using #ifdef __SPU__).
Tested on spu-elf with no regressions, fixes all FAILs in all test cases
touched by the patch.
OK for mainline and 4.3 branch?
Bye,
Ulrich
ChangeLog:
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.
Index: gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.x
===================================================================
*** gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.x (revision 136680)
--- gcc/testsuite/gcc.c-torture/execute/ieee/mul-subnormal-single-1.x (working copy)
*************** if {[istarget "m68k-*-*"] && [check_effe
*** 8,11 ****
--- 8,16 ----
# 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: gcc/testsuite/gcc.c-torture/execute/ieee/inf-1.c
===================================================================
*** gcc/testsuite/gcc.c-torture/execute/ieee/inf-1.c (revision 136680)
--- gcc/testsuite/gcc.c-torture/execute/ieee/inf-1.c (working copy)
*************** extern void abort (void);
*** 2,8 ****
--- 2,11 ----
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();
*************** int main()
*** 10,31 ****
--- 13,40 ----
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: gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-1.x
===================================================================
*** gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-1.x (revision 0)
--- gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-1.x (revision 0)
***************
*** 0 ****
--- 1,6 ----
+ if [istarget "spu-*-*"] {
+ # The SPU single-precision floating point format does not
+ # support Nan & Inf.
+ return 1
+ }
+ return 0
Index: gcc/testsuite/gcc.c-torture/execute/ieee/920518-1.x
===================================================================
*** gcc/testsuite/gcc.c-torture/execute/ieee/920518-1.x (revision 0)
--- gcc/testsuite/gcc.c-torture/execute/ieee/920518-1.x (revision 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
Index: gcc/testsuite/gcc.c-torture/execute/ieee/20010114-2.x
===================================================================
*** gcc/testsuite/gcc.c-torture/execute/ieee/20010114-2.x (revision 0)
--- gcc/testsuite/gcc.c-torture/execute/ieee/20010114-2.x (revision 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
Index: gcc/testsuite/gcc.c-torture/execute/ieee/20030331-1.x
===================================================================
*** gcc/testsuite/gcc.c-torture/execute/ieee/20030331-1.x (revision 0)
--- gcc/testsuite/gcc.c-torture/execute/ieee/20030331-1.x (revision 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
Index: gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4f.x
===================================================================
*** gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4f.x (revision 0)
--- gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-4f.x (revision 0)
***************
*** 0 ****
--- 1,6 ----
+ if [istarget "spu-*-*"] {
+ # The SPU single-precision floating point format does not
+ # support Nan & Inf.
+ return 1
+ }
+ return 0
Index: gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-4.x
===================================================================
*** gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-4.x (revision 136680)
--- gcc/testsuite/gcc.c-torture/execute/ieee/compare-fp-4.x (working copy)
*************** if [istarget "arm*-*-vxworks*"] {
*** 13,17 ****
--- 13,23 ----
}
}
+ 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: gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8f.x
===================================================================
*** gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8f.x (revision 0)
--- gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-8f.x (revision 0)
***************
*** 0 ****
--- 1,6 ----
+ if [istarget "spu-*-*"] {
+ # The SPU single-precision floating point format does not
+ # support Nan & Inf.
+ return 1
+ }
+ return 0
Index: gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-2.x
===================================================================
*** gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-2.x (revision 136680)
--- gcc/testsuite/gcc.c-torture/execute/ieee/fp-cmp-2.x (working copy)
*************** if [istarget "arm*-*-vxworks*"] {
*** 13,16 ****
--- 13,22 ----
}
}
+ if [istarget "spu-*-*"] {
+ # The SPU single-precision floating point format does not
+ # support Nan & Inf.
+ return 1
+ }
+
return 0
Index: gcc/testsuite/gcc.dg/pr15784-3.c
===================================================================
*** gcc/testsuite/gcc.dg/pr15784-3.c (revision 136680)
--- gcc/testsuite/gcc.dg/pr15784-3.c (working copy)
***************
*** 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: gcc/testsuite/gcc.dg/builtins-44.c
===================================================================
*** gcc/testsuite/gcc.dg/builtins-44.c (revision 136680)
--- gcc/testsuite/gcc.dg/builtins-44.c (working copy)
*************** int
*** 12,26 ****
--- 12,31 ----
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)
*************** main ()
*** 28,37 ****
--- 33,44 ----
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: gcc/testsuite/gcc.dg/float-range-4.c
===================================================================
*** gcc/testsuite/gcc.dg/float-range-4.c (revision 136680)
--- gcc/testsuite/gcc.dg/float-range-4.c (working copy)
***************
*** 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: gcc/testsuite/gcc.dg/fold-overflow-1.c
===================================================================
*** gcc/testsuite/gcc.dg/fold-overflow-1.c (revision 136680)
--- gcc/testsuite/gcc.dg/fold-overflow-1.c (working copy)
***************
*** 1,5 ****
--- 1,6 ----
/* { dg-compile } */
/* { dg-skip-if "consts are shorts, not longs" { "m32c-*-*" } { "*" } { "" } } */
+ /* { dg-skip-if "No Inf support" { spu-*-* } } */
/* { dg-options "-O -ftrapping-math" } */
/* There should be exactly 2 +Inf in the assembly file. */
Index: gcc/testsuite/gcc.dg/torture/builtin-math-2.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/builtin-math-2.c (revision 136680)
--- gcc/testsuite/gcc.dg/torture/builtin-math-2.c (working copy)
*************** extern void fool (long double);
*** 59,73 ****
--- 59,79 ----
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()));
*************** void bar()
*** 130,153 ****
--- 136,171 ----
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()));
*************** void bar()
*** 235,251 ****
--- 253,277 ----
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("")));
*************** void bar()
*** 291,297 ****
}
/* { dg-final { scan-tree-dump-times "exp2 " 9 "original" } } */
! /* { dg-final { scan-tree-dump-times "exp2f" 9 "original" } } */
/* { 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" } } */
--- 317,324 ----
}
/* { dg-final { scan-tree-dump-times "exp2 " 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" } } */
*************** void bar()
*** 321,327 ****
/* { 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 "powl" 13 "original" } } */
/* { dg-final { scan-tree-dump-times "fma " 3 "original" } } */
/* { dg-final { scan-tree-dump-times "fmaf" 3 "original" } } */
--- 348,355 ----
/* { 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" { 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" } } */
*************** void bar()
*** 342,348 ****
/* { 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 "ilogbl" 6 "original" } } */
/* { dg-final { scan-tree-dump-times "y0 " 3 "original" } } */
/* { dg-final { scan-tree-dump-times "y0f" 3 "original" } } */
--- 370,377 ----
/* { 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" { 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: gcc/testsuite/gcc.dg/torture/builtin-logb-1.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/builtin-logb-1.c (revision 136680)
--- gcc/testsuite/gcc.dg/torture/builtin-logb-1.c (working copy)
*************** extern void link_error(int);
*** 47,52 ****
--- 47,53 ----
/* 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))) \
*************** extern void link_error(int);
*** 58,63 ****
--- 59,75 ----
|| 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: gcc/testsuite/gcc.dg/torture/builtin-modf-1.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/builtin-modf-1.c (revision 136680)
--- gcc/testsuite/gcc.dg/torture/builtin-modf-1.c (working copy)
*************** extern void link_error(int);
*** 62,67 ****
--- 62,68 ----
/* 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 \
*************** extern void link_error(int);
*** 80,89 ****
--- 81,107 ----
|| 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))) \
*************** extern void link_error(int);
*** 102,107 ****
--- 120,141 ----
|| 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: gcc/testsuite/gcc.dg/torture/builtin-ldexp-1.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/builtin-ldexp-1.c (revision 136680)
--- gcc/testsuite/gcc.dg/torture/builtin-ldexp-1.c (working copy)
*************** extern void link_error(int);
*** 45,50 ****
--- 45,51 ----
/* 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))) \
*************** extern void link_error(int);
*** 56,61 ****
--- 57,73 ----
|| 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: gcc/testsuite/gcc.dg/torture/type-generic-1.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/type-generic-1.c (revision 136680)
--- gcc/testsuite/gcc.dg/torture/type-generic-1.c (working copy)
***************
*** 3,8 ****
--- 3,9 ----
/* { dg-do run } */
/* { dg-options "-mieee" { target sh*-*-* } } */
+ /* { dg-skip-if "No Inf/NaN support" { spu-*-* } } */
#include "../tg-tests.h"
Index: gcc/testsuite/gcc.dg/torture/fp-int-convert-float.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/fp-int-convert-float.c (revision 136680)
--- gcc/testsuite/gcc.dg/torture/fp-int-convert-float.c (working copy)
***************
*** 2,7 ****
--- 2,8 ----
/* 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: gcc/testsuite/gcc.dg/torture/builtin-frexp-1.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/builtin-frexp-1.c (revision 136680)
--- gcc/testsuite/gcc.dg/torture/builtin-frexp-1.c (working copy)
*************** extern void link_error(int);
*** 53,58 ****
--- 53,59 ----
/* 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)) \
*************** extern void link_error(int);
*** 68,73 ****
--- 69,88 ----
|| 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: gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c (revision 136680)
--- gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c (working copy)
***************
*** 9,15 ****
--- 9,18 ----
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: gcc/testsuite/gcc.dg/builtins-43.c
===================================================================
*** gcc/testsuite/gcc.dg/builtins-43.c (revision 136680)
--- gcc/testsuite/gcc.dg/builtins-43.c (working copy)
*************** int
*** 12,26 ****
--- 12,31 ----
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: gcc/testsuite/gcc.dg/builtins-45.c
===================================================================
*** gcc/testsuite/gcc.dg/builtins-45.c (revision 136680)
--- gcc/testsuite/gcc.dg/builtins-45.c (working copy)
*************** int
*** 12,35 ****
--- 12,45 ----
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: gcc/testsuite/gcc.dg/builtins-1.c
===================================================================
*** gcc/testsuite/gcc.dg/builtins-1.c (revision 136680)
--- gcc/testsuite/gcc.dg/builtins-1.c (working copy)
*************** FPTEST2ARG2_REENT (gamma, int *) /* gamm
*** 144,150 ****
FPTEST0 (huge_val)
FPTEST2 (hypot)
FPTEST1 (ilogb)
! FPTEST0 (inf)
FPTEST1 (j0)
FPTEST1 (j1)
FPTEST2ARG1 (jn, int)
--- 144,150 ----
FPTEST0 (huge_val)
FPTEST2 (hypot)
FPTEST1 (ilogb)
! FPTEST0 (inf) /* { dg-warning "target format does not support infinity" "inf" {target spu-*-*} } */
FPTEST1 (j0)
FPTEST1 (j1)
FPTEST2ARG1 (jn, int)
Index: gcc/testsuite/gcc.dg/pr28796-2.c
===================================================================
*** gcc/testsuite/gcc.dg/pr28796-2.c (revision 136680)
--- gcc/testsuite/gcc.dg/pr28796-2.c (working copy)
***************
*** 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: gcc/testsuite/gcc.dg/float-range-1.c
===================================================================
*** gcc/testsuite/gcc.dg/float-range-1.c (revision 136680)
--- gcc/testsuite/gcc.dg/float-range-1.c (working copy)
***************
*** 4,9 ****
--- 4,10 ----
/* 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: gcc/testsuite/gcc.dg/float-range-3.c
===================================================================
*** gcc/testsuite/gcc.dg/float-range-3.c (revision 136680)
--- gcc/testsuite/gcc.dg/float-range-3.c (working copy)
***************
*** 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: gcc/testsuite/gcc.dg/builtin-inf-1.c
===================================================================
*** gcc/testsuite/gcc.dg/builtin-inf-1.c (revision 136680)
--- gcc/testsuite/gcc.dg/builtin-inf-1.c (working copy)
*************** float fh = __builtin_huge_valf();
*** 8,13 ****
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 } */
--- 8,13 ----
double dh = __builtin_huge_val();
long double lh = __builtin_huge_vall();
! /* { 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: gcc/testsuite/gcc.dg/float-range-5.c
===================================================================
*** gcc/testsuite/gcc.dg/float-range-5.c (revision 136680)
--- gcc/testsuite/gcc.dg/float-range-5.c (working copy)
***************
*** 2,7 ****
--- 2,8 ----
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: gcc/testsuite/g++.dg/torture/type-generic-1.C
===================================================================
*** gcc/testsuite/g++.dg/torture/type-generic-1.C (revision 136680)
--- gcc/testsuite/g++.dg/torture/type-generic-1.C (working copy)
***************
*** 3,8 ****
--- 3,9 ----
/* { dg-do run } */
/* { dg-options "-mieee" { target sh*-*-* } } */
+ /* { dg-skip-if "No Inf/NaN support" { spu-*-* } } */
#include "../../gcc.dg/tg-tests.h"
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
More information about the Gcc-patches
mailing list