From 976e9d281b2900f988e14ef541b5716dbdd4849e Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Thu, 26 Apr 2007 19:23:37 +0000 Subject: [PATCH] 2007-04-26 Patrick Mansfield * libc/include/ieeefp.h: use prefixed __ieeefp_ macros that can be overridden via machine/ieeefp.h. * libc/include/machine/ieeefp.h: Add SPU specific C99 and ieeefp macros for isnan and related macros. * libc/include/math.h: Allow C99 isfinite, isinf, and isnan to be overridden via machine/ieeefp.h. * libm/machine/spu/Makefile.am: Add new files. * libm/machine/spu/Makefile.in: Autogenerate with new files. * libm/machine/spu/sf_fpclassify.c: Add SPU specific __fpclassifyf. * libm/machine/spu/sf_finite.c: Add SPU specific finitef. * libm/machine/spu/sf_isinf.c: Add SPU specific isinff. * libm/machine/spu/sf_isinff.c: Add SPU specific __isinff. * libm/machine/spu/sf_isnan.c: Add SPU specific isnanf. * libm/machine/spu/sf_isnanf.c: Add SPU specific __isnanf. * libm/machine/spu/sf_nan.c: Add SPU specific nanf. --- newlib/ChangeLog | 18 ++++++++ newlib/libc/include/ieeefp.h | 20 ++++++--- newlib/libc/include/machine/ieeefp.h | 21 ++++++++- newlib/libc/include/math.h | 8 ++++ newlib/libm/machine/spu/Makefile.am | 4 +- newlib/libm/machine/spu/Makefile.in | 57 +++++++++++++++++++++++-- newlib/libm/machine/spu/sf_finite.c | 41 ++++++++++++++++++ newlib/libm/machine/spu/sf_fpclassify.c | 24 +++++++++++ newlib/libm/machine/spu/sf_isinf.c | 43 +++++++++++++++++++ newlib/libm/machine/spu/sf_isinff.c | 41 ++++++++++++++++++ newlib/libm/machine/spu/sf_isnan.c | 41 ++++++++++++++++++ newlib/libm/machine/spu/sf_isnanf.c | 41 ++++++++++++++++++ newlib/libm/machine/spu/sf_nan.c | 42 ++++++++++++++++++ 13 files changed, 390 insertions(+), 11 deletions(-) create mode 100644 newlib/libm/machine/spu/sf_finite.c create mode 100644 newlib/libm/machine/spu/sf_fpclassify.c create mode 100644 newlib/libm/machine/spu/sf_isinf.c create mode 100644 newlib/libm/machine/spu/sf_isinff.c create mode 100644 newlib/libm/machine/spu/sf_isnan.c create mode 100644 newlib/libm/machine/spu/sf_isnanf.c create mode 100644 newlib/libm/machine/spu/sf_nan.c diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 6ebceecd0..960af5192 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,21 @@ +2007-04-26 Patrick Mansfield + + * libc/include/ieeefp.h: use prefixed __ieeefp_ macros that can be + overridden via machine/ieeefp.h. + * libc/include/machine/ieeefp.h: Add SPU specific C99 and ieeefp + macros for isnan and related macros. + * libc/include/math.h: Allow C99 isfinite, isinf, and isnan to be + overridden via machine/ieeefp.h. + * libm/machine/spu/Makefile.am: Add new files. + * libm/machine/spu/Makefile.in: Autogenerate with new files. + * libm/machine/spu/sf_fpclassify.c: Add SPU specific __fpclassifyf. + * libm/machine/spu/sf_finite.c: Add SPU specific finitef. + * libm/machine/spu/sf_isinf.c: Add SPU specific isinff. + * libm/machine/spu/sf_isinff.c: Add SPU specific __isinff. + * libm/machine/spu/sf_isnan.c: Add SPU specific isnanf. + * libm/machine/spu/sf_isnanf.c: Add SPU specific __isnanf. + * libm/machine/spu/sf_nan.c: Add SPU specific nanf. + 2007-04-25 Jeff Johnston * libm/common/s_fpclassify.c (__fpclassifyf): Move this to... diff --git a/newlib/libc/include/ieeefp.h b/newlib/libc/include/ieeefp.h index e08fd0885..0b06fb786 100644 --- a/newlib/libc/include/ieeefp.h +++ b/newlib/libc/include/ieeefp.h @@ -213,14 +213,22 @@ int _EXFUN(finitef, (float)); #define __IEEE_DBL_NAN_EXP 0x7ff #define __IEEE_FLT_NAN_EXP 0xff +#ifndef __ieeefp_isnanf +#define __ieeefp_isnanf(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \ + ((*(long *)&(x) & 0x007fffffL)!=0000000000L)) +#endif +#define isnanf(x) __ieeefp_isnanf(x) -#define isnanf(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \ - ((*(long *)&(x) & 0x007fffffL)!=0000000000L)) +#ifndef __ieeefp_isinff +#define __ieeefp_isinff(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \ + ((*(long *)&(x) & 0x007fffffL)==0000000000L)) +#endif +#define isinff(x) __ieeefp_isinff(x) -#define isinff(x) (((*(long *)&(x) & 0x7f800000L)==0x7f800000L) && \ - ((*(long *)&(x) & 0x007fffffL)==0000000000L)) - -#define finitef(x) (((*(long *)&(x) & 0x7f800000L)!=0x7f800000L)) +#ifndef __ieeefp_finitef +#define __ieeefp_finitef(x) (((*(long *)&(x) & 0x7f800000L)!=0x7f800000L)) +#endif +#define finitef(x) __ieeefp_finitef(x) #ifdef _DOUBLE_IS_32BITS #undef __IEEE_DBL_EXPBIAS diff --git a/newlib/libc/include/machine/ieeefp.h b/newlib/libc/include/machine/ieeefp.h index 9e5b5aee0..b3e77945e 100644 --- a/newlib/libc/include/machine/ieeefp.h +++ b/newlib/libc/include/machine/ieeefp.h @@ -75,8 +75,27 @@ #ifdef __SPU__ #define __IEEE_BIG_ENDIAN -#endif +#define isfinite(y) \ + (__extension__ ({__typeof__(y) __y = (y); \ + (sizeof (__y) == sizeof (float)) ? (1) : \ + fpclassify(__y) != FP_INFINITE && fpclassify(__y) != FP_NAN;})) +#define isinf(x) \ + (__extension__ ({__typeof__(x) __x = (x); \ + (sizeof (__x) == sizeof (float)) ? (0) : __isinfd(__x);})) +#define isnan(x) \ + (__extension__ ({__typeof__(x) __x = (x); \ + (sizeof (__x) == sizeof (float)) ? (0) : __isnand(__x);})) + +/* + * Macros for use in ieeefp.h. We can't just define the real ones here + * (like those above) as we have name space issues when this is *not* + * included via generic the ieeefp.h. + */ +#define __ieeefp_isnanf(x) 0 +#define __ieeefp_isinff(x) 0 +#define __ieeefp_finitef(x) 1 +#endif #ifdef __sparc__ #ifdef __LITTLE_ENDIAN_DATA__ diff --git a/newlib/libc/include/math.h b/newlib/libc/include/math.h index 3e96757c8..63cc99286 100644 --- a/newlib/libc/include/math.h +++ b/newlib/libc/include/math.h @@ -131,21 +131,29 @@ extern int __signbitd (double x); (__extension__ ({__typeof__(x) __x = (x); \ (sizeof (__x) == sizeof (float)) ? __fpclassifyf(__x) : __fpclassifyd(__x);})) +#ifndef isfinite #define isfinite(y) \ (__extension__ ({__typeof__(y) __y = (y); \ fpclassify(__y) != FP_INFINITE && fpclassify(__y) != FP_NAN;})) +#endif /* Note: isinf and isnan were once functions in newlib that took double * arguments. C99 specifies that these names are reserved for macros * supporting multiple floating point types. Thus, they are * now defined as macros. Implementations of the old functions * taking double arguments still exist for compatibility purposes. */ +#ifndef isinf #define isinf(x) \ (__extension__ ({__typeof__(x) __x = (x); \ (sizeof (__x) == sizeof (float)) ? __isinff(__x) : __isinfd(__x);})) +#endif + +#ifndef isnan #define isnan(x) \ (__extension__ ({__typeof__(x) __x = (x); \ (sizeof (__x) == sizeof (float)) ? __isnanf(__x) : __isnand(__x);})) +#endif + #define isnormal(y) (fpclassify(y) == FP_NORMAL) #define signbit(x) \ (__extension__ ({__typeof__(x) __x = (x); \ diff --git a/newlib/libm/machine/spu/Makefile.am b/newlib/libm/machine/spu/Makefile.am index 74904f2c9..68a5c8da6 100644 --- a/newlib/libm/machine/spu/Makefile.am +++ b/newlib/libm/machine/spu/Makefile.am @@ -8,7 +8,9 @@ INCLUDES = -I $(newlib_basedir)/../newlib/libm/common $(NEWLIB_CFLAGS) \ LIB_SOURCES = \ feclearexcept.c fe_dfl_env.c fegetenv.c fegetexceptflag.c \ fegetround.c feholdexcept.c feraiseexcept.c fesetenv.c \ - fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c + fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c \ + sf_finite.c sf_fpclassify.c sf_isinf.c sf_isinff.c sf_isnanf.c \ + sf_isnan.c sf_nan.c noinst_LIBRARIES = lib.a lib_a_SOURCES = $(LIB_SOURCES) diff --git a/newlib/libm/machine/spu/Makefile.in b/newlib/libm/machine/spu/Makefile.in index b419f083d..e19c784e4 100644 --- a/newlib/libm/machine/spu/Makefile.in +++ b/newlib/libm/machine/spu/Makefile.in @@ -47,7 +47,11 @@ DIST_COMMON = $(srcdir)/../../../Makefile.shared \ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ - $(srcdir)/../../../../compile $(srcdir)/../../../../compile + $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ + $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ + $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ + $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ + $(srcdir)/../../../../compile subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../../../acinclude.m4 \ @@ -68,7 +72,10 @@ am__objects_1 = lib_a-feclearexcept.$(OBJEXT) \ lib_a-feholdexcept.$(OBJEXT) lib_a-feraiseexcept.$(OBJEXT) \ lib_a-fesetenv.$(OBJEXT) lib_a-fesetexceptflag.$(OBJEXT) \ lib_a-fesetround.$(OBJEXT) lib_a-fetestexcept.$(OBJEXT) \ - lib_a-feupdateenv.$(OBJEXT) + lib_a-feupdateenv.$(OBJEXT) lib_a-sf_finite.$(OBJEXT) \ + lib_a-sf_fpclassify.$(OBJEXT) lib_a-sf_isinf.$(OBJEXT) \ + lib_a-sf_isinff.$(OBJEXT) lib_a-sf_isnanf.$(OBJEXT) \ + lib_a-sf_isnan.$(OBJEXT) lib_a-sf_nan.$(OBJEXT) am_lib_a_OBJECTS = $(am__objects_1) lib_a_OBJECTS = $(am_lib_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) @@ -197,7 +204,9 @@ INCLUDES = -I $(newlib_basedir)/../newlib/libm/common $(NEWLIB_CFLAGS) \ LIB_SOURCES = \ feclearexcept.c fe_dfl_env.c fegetenv.c fegetexceptflag.c \ fegetround.c feholdexcept.c feraiseexcept.c fesetenv.c \ - fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c + fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c \ + sf_finite.c sf_fpclassify.c sf_isinf.c sf_isinff.c sf_isnanf.c \ + sf_isnan.c sf_nan.c noinst_LIBRARIES = lib.a lib_a_SOURCES = $(LIB_SOURCES) @@ -334,6 +343,48 @@ lib_a-feupdateenv.o: feupdateenv.c lib_a-feupdateenv.obj: feupdateenv.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-feupdateenv.obj `if test -f 'feupdateenv.c'; then $(CYGPATH_W) 'feupdateenv.c'; else $(CYGPATH_W) '$(srcdir)/feupdateenv.c'; fi` + +lib_a-sf_finite.o: sf_finite.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_finite.o `test -f 'sf_finite.c' || echo '$(srcdir)/'`sf_finite.c + +lib_a-sf_finite.obj: sf_finite.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_finite.obj `if test -f 'sf_finite.c'; then $(CYGPATH_W) 'sf_finite.c'; else $(CYGPATH_W) '$(srcdir)/sf_finite.c'; fi` + +lib_a-sf_fpclassify.o: sf_fpclassify.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_fpclassify.o `test -f 'sf_fpclassify.c' || echo '$(srcdir)/'`sf_fpclassify.c + +lib_a-sf_fpclassify.obj: sf_fpclassify.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_fpclassify.obj `if test -f 'sf_fpclassify.c'; then $(CYGPATH_W) 'sf_fpclassify.c'; else $(CYGPATH_W) '$(srcdir)/sf_fpclassify.c'; fi` + +lib_a-sf_isinf.o: sf_isinf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_isinf.o `test -f 'sf_isinf.c' || echo '$(srcdir)/'`sf_isinf.c + +lib_a-sf_isinf.obj: sf_isinf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_isinf.obj `if test -f 'sf_isinf.c'; then $(CYGPATH_W) 'sf_isinf.c'; else $(CYGPATH_W) '$(srcdir)/sf_isinf.c'; fi` + +lib_a-sf_isinff.o: sf_isinff.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_isinff.o `test -f 'sf_isinff.c' || echo '$(srcdir)/'`sf_isinff.c + +lib_a-sf_isinff.obj: sf_isinff.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_isinff.obj `if test -f 'sf_isinff.c'; then $(CYGPATH_W) 'sf_isinff.c'; else $(CYGPATH_W) '$(srcdir)/sf_isinff.c'; fi` + +lib_a-sf_isnanf.o: sf_isnanf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_isnanf.o `test -f 'sf_isnanf.c' || echo '$(srcdir)/'`sf_isnanf.c + +lib_a-sf_isnanf.obj: sf_isnanf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_isnanf.obj `if test -f 'sf_isnanf.c'; then $(CYGPATH_W) 'sf_isnanf.c'; else $(CYGPATH_W) '$(srcdir)/sf_isnanf.c'; fi` + +lib_a-sf_isnan.o: sf_isnan.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_isnan.o `test -f 'sf_isnan.c' || echo '$(srcdir)/'`sf_isnan.c + +lib_a-sf_isnan.obj: sf_isnan.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_isnan.obj `if test -f 'sf_isnan.c'; then $(CYGPATH_W) 'sf_isnan.c'; else $(CYGPATH_W) '$(srcdir)/sf_isnan.c'; fi` + +lib_a-sf_nan.o: sf_nan.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_nan.o `test -f 'sf_nan.c' || echo '$(srcdir)/'`sf_nan.c + +lib_a-sf_nan.obj: sf_nan.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_nan.obj `if test -f 'sf_nan.c'; then $(CYGPATH_W) 'sf_nan.c'; else $(CYGPATH_W) '$(srcdir)/sf_nan.c'; fi` uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) diff --git a/newlib/libm/machine/spu/sf_finite.c b/newlib/libm/machine/spu/sf_finite.c new file mode 100644 index 000000000..88d635fd4 --- /dev/null +++ b/newlib/libm/machine/spu/sf_finite.c @@ -0,0 +1,41 @@ +/* + (C) Copyright 2007 + International Business Machines Corporation, + Sony Computer Entertainment, Incorporated, + Toshiba Corporation, + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the names of the copyright holders nor the names of their + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * On the SPU always return 1. + */ +int +finitef(float x) +{ + return 1; +} diff --git a/newlib/libm/machine/spu/sf_fpclassify.c b/newlib/libm/machine/spu/sf_fpclassify.c new file mode 100644 index 000000000..36cf8ba90 --- /dev/null +++ b/newlib/libm/machine/spu/sf_fpclassify.c @@ -0,0 +1,24 @@ +/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved. + * + * Permission to use, copy, modify, and distribute this software + * is freely granted, provided that this notice is preserved. + */ + +#include "fdlibm.h" + +/* + * On the SPU, single precision floating point returns only FP_NORMAL and + * FP_ZERO, since FP_NAN, FP_INFINITE, and FP_SUBNORMAL are not + * supported, base on the common f_fpclassify.c. + */ +int +__fpclassifyf (float x) +{ + __uint32_t w; + + GET_FLOAT_WORD(w,x); + + if (w == 0x00000000 || w == 0x80000000) + return FP_ZERO; + return FP_NORMAL; +} diff --git a/newlib/libm/machine/spu/sf_isinf.c b/newlib/libm/machine/spu/sf_isinf.c new file mode 100644 index 000000000..7cba324f9 --- /dev/null +++ b/newlib/libm/machine/spu/sf_isinf.c @@ -0,0 +1,43 @@ +/* + (C) Copyright 2007 + International Business Machines Corporation, + Sony Computer Entertainment, Incorporated, + Toshiba Corporation, + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the names of the copyright holders nor the names of their + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * On the SPU isinff(x) always returns 0. + * + * isinff is an extension declared in and . + */ +int +isinff (float x) +{ + return 0; +} diff --git a/newlib/libm/machine/spu/sf_isinff.c b/newlib/libm/machine/spu/sf_isinff.c new file mode 100644 index 000000000..3ce424a74 --- /dev/null +++ b/newlib/libm/machine/spu/sf_isinff.c @@ -0,0 +1,41 @@ +/* + (C) Copyright 2007 + International Business Machines Corporation, + Sony Computer Entertainment, Incorporated, + Toshiba Corporation, + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the names of the copyright holders nor the names of their + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * On the SPU __isinff(x) always returns 0. + */ +int +__isinff (float x) +{ + return 0; +} diff --git a/newlib/libm/machine/spu/sf_isnan.c b/newlib/libm/machine/spu/sf_isnan.c new file mode 100644 index 000000000..448bfc47e --- /dev/null +++ b/newlib/libm/machine/spu/sf_isnan.c @@ -0,0 +1,41 @@ +/* + (C) Copyright 2007 + International Business Machines Corporation, + Sony Computer Entertainment, Incorporated, + Toshiba Corporation, + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the names of the copyright holders nor the names of their + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * On the SPU single precision floating does not support NAN's. + */ +int +isnanf(float x) +{ + return 0; +} diff --git a/newlib/libm/machine/spu/sf_isnanf.c b/newlib/libm/machine/spu/sf_isnanf.c new file mode 100644 index 000000000..1dab50c7e --- /dev/null +++ b/newlib/libm/machine/spu/sf_isnanf.c @@ -0,0 +1,41 @@ +/* + (C) Copyright 2007 + International Business Machines Corporation, + Sony Computer Entertainment, Incorporated, + Toshiba Corporation, + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the names of the copyright holders nor the names of their + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * On the SPU single precision floating does not support NAN's. + */ +int +__isnanf(float x) +{ + return 0; +} diff --git a/newlib/libm/machine/spu/sf_nan.c b/newlib/libm/machine/spu/sf_nan.c new file mode 100644 index 000000000..ef994c7ba --- /dev/null +++ b/newlib/libm/machine/spu/sf_nan.c @@ -0,0 +1,42 @@ +/* + (C) Copyright 2007 + International Business Machines Corporation, + Sony Computer Entertainment, Incorporated, + Toshiba Corporation, + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the names of the copyright holders nor the names of their + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * On the SPU single precision floating does not support NAN's, and nanf + * is documented as returning zero. + */ +float +nanf(const char *unused) +{ + return 0; +}