diff --git a/newlib/ChangeLog b/newlib/ChangeLog index e47e08ba3..f10d71579 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,117 @@ +2007-09-28 Patrick Mansfield + + * configure.host: Define _POSIX_MODE to match the existing vector + math code, as we don't support the matherr callout. + * libm/machine/spu/Makefile.am: New file. + * libm/machine/spu/Makefile.in: Auto-generated. + * libm/machine/spu/headers/atanf.h: New file. + * libm/machine/spu/headers/cbrt.h: Ditto. + * libm/machine/spu/headers/cbrtf.h: Ditto. + * libm/machine/spu/headers/ceil.h: Ditto. + * libm/machine/spu/headers/ceilf.h: Ditto. + * libm/machine/spu/headers/copysign.h: Ditto. + * libm/machine/spu/headers/copysignf.h: Ditto. + * libm/machine/spu/headers/exp2f.h: Ditto. + * libm/machine/spu/headers/expf.h: Ditto. + * libm/machine/spu/headers/fabs.h: Ditto. + * libm/machine/spu/headers/fabsf.h: Ditto. + * libm/machine/spu/headers/fdim.h: Ditto. + * libm/machine/spu/headers/fdimf.h: Ditto. + * libm/machine/spu/headers/floor.h: Ditto. + * libm/machine/spu/headers/floorf.h: Ditto. + * libm/machine/spu/headers/fma.h: Ditto. + * libm/machine/spu/headers/fmaf.h: Ditto. + * libm/machine/spu/headers/fmax.h: Ditto. + * libm/machine/spu/headers/fmaxf.h: Ditto. + * libm/machine/spu/headers/fmin.h: Ditto. + * libm/machine/spu/headers/fminf.h: Ditto. + * libm/machine/spu/headers/fmod.h: Ditto. + * libm/machine/spu/headers/fmodf.h: Ditto. + * libm/machine/spu/headers/frexp.h: Ditto. + * libm/machine/spu/headers/frexpf.h: Ditto. + * libm/machine/spu/headers/ilogb.h: Ditto. + * libm/machine/spu/headers/ilogbf.h: Ditto. + * libm/machine/spu/headers/ldexp.h: Ditto. + * libm/machine/spu/headers/ldexpf.h: Ditto. + * libm/machine/spu/headers/llrint.h: Ditto. + * libm/machine/spu/headers/llrintf.h: Ditto. + * libm/machine/spu/headers/llround.h: Ditto. + * libm/machine/spu/headers/llroundf.h: Ditto. + * libm/machine/spu/headers/log10f.h: Ditto. + * libm/machine/spu/headers/log2f.h: Ditto. + * libm/machine/spu/headers/logf.h: Ditto. + * libm/machine/spu/headers/lrint.h: Ditto. + * libm/machine/spu/headers/lrintf.h: Ditto. + * libm/machine/spu/headers/lround.h: Ditto. + * libm/machine/spu/headers/lroundf.h: Ditto. + * libm/machine/spu/headers/nearbyint.h: Ditto. + * libm/machine/spu/headers/remainder.h: Ditto. + * libm/machine/spu/headers/remainderf.h: Ditto. + * libm/machine/spu/headers/remquo.h: Ditto. + * libm/machine/spu/headers/remquof.h: Ditto. + * libm/machine/spu/headers/rint.h: Ditto. + * libm/machine/spu/headers/round.h: Ditto. + * libm/machine/spu/headers/roundf.h: Ditto. + * libm/machine/spu/headers/scalbn.h: Ditto. + * libm/machine/spu/headers/scalbnf.h: Ditto. + * libm/machine/spu/headers/sqrt.h: Ditto. + * libm/machine/spu/headers/trunc.h: Ditto. + * libm/machine/spu/headers/truncf.h: Ditto. + * libm/machine/spu/headers/vec_literal.h: Ditto. + * libm/machine/spu/llrint.c: Ditto. + * libm/machine/spu/llrintf.c: Ditto. + * libm/machine/spu/llround.c: Ditto. + * libm/machine/spu/llroundf.c: Ditto. + * libm/machine/spu/log2f.c: Ditto. + * libm/machine/spu/s_cbrt.c: Ditto. + * libm/machine/spu/s_ceil.c: Ditto. + * libm/machine/spu/s_copysign.c: Ditto. + * libm/machine/spu/s_fabs.c: Ditto. + * libm/machine/spu/s_fdim.c: Ditto. + * libm/machine/spu/s_floor.c: Ditto. + * libm/machine/spu/s_fma.c: Ditto. + * libm/machine/spu/s_fmax.c: Ditto. + * libm/machine/spu/s_fmin.c: Ditto. + * libm/machine/spu/s_frexp.c: Ditto. + * libm/machine/spu/s_ilogb.c: Ditto. + * libm/machine/spu/s_ldexp.c: Ditto. + * libm/machine/spu/s_lrint.c: Ditto. + * libm/machine/spu/s_lround.c: Ditto. + * libm/machine/spu/s_nearbyint.c: Ditto. + * libm/machine/spu/s_remquo.c: Ditto. + * libm/machine/spu/s_rint.c: Ditto. + * libm/machine/spu/s_round.c: Ditto. + * libm/machine/spu/s_scalbn.c: Ditto. + * libm/machine/spu/s_trunc.c: Ditto. + * libm/machine/spu/sf_atan.c: Ditto. + * libm/machine/spu/sf_cbrt.c: Ditto. + * libm/machine/spu/sf_ceil.c: Ditto. + * libm/machine/spu/sf_copysign.c: Ditto. + * libm/machine/spu/sf_fabs.c: Ditto. + * libm/machine/spu/sf_fdim.c: Ditto. + * libm/machine/spu/sf_floor.c: Ditto. + * libm/machine/spu/sf_fma.c: Ditto. + * libm/machine/spu/sf_fmax.c: Ditto. + * libm/machine/spu/sf_fmin.c: Ditto. + * libm/machine/spu/sf_frexp.c: Ditto. + * libm/machine/spu/sf_ilogb.c: Ditto. + * libm/machine/spu/sf_ldexp.c: Ditto. + * libm/machine/spu/sf_lrint.c: Ditto. + * libm/machine/spu/sf_lround.c: Ditto. + * libm/machine/spu/sf_remquo.c: Ditto. + * libm/machine/spu/sf_round.c: Ditto. + * libm/machine/spu/sf_scalbn.c: Ditto. + * libm/machine/spu/sf_trunc.c: Ditto. + * libm/machine/spu/w_fmod.c: Ditto. + * libm/machine/spu/w_remainder.c: Ditto. + * libm/machine/spu/w_sqrt.c: Ditto. + * libm/machine/spu/wf_exp.c: Ditto. + * libm/machine/spu/wf_exp2.c: Ditto. + * libm/machine/spu/wf_fmod.c: Ditto. + * libm/machine/spu/wf_log.c: Ditto. + * libm/machine/spu/wf_log10.c: Ditto. + * libm/machine/spu/wf_remainder.c: Ditto. + 2007-09-21 Patrick Mansfield * libc/machine/spu/sys/uio.h: New file for readv and writev use. diff --git a/newlib/configure.host b/newlib/configure.host index b0d7bbe00..856a4d8e7 100644 --- a/newlib/configure.host +++ b/newlib/configure.host @@ -265,7 +265,7 @@ case "${host_cpu}" in stdio_dir= libm_machine_dir=spu machine_dir=spu - newlib_cflags="${newlib_cflags} -ffunction-sections -fdata-sections " + newlib_cflags="${newlib_cflags} -D_POSIX_MODE -ffunction-sections -fdata-sections " ;; *) echo '***' "Newlib does not support CPU ${host_cpu}" 1>&2 diff --git a/newlib/libm/machine/spu/Makefile.am b/newlib/libm/machine/spu/Makefile.am index 7ca443729..107f340bf 100644 --- a/newlib/libm/machine/spu/Makefile.am +++ b/newlib/libm/machine/spu/Makefile.am @@ -9,8 +9,17 @@ 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 \ - sf_finite.c sf_fpclassify.c sf_isinf.c sf_isinff.c sf_isnanf.c \ - sf_isnan.c sf_nan.c + llrint.c llrintf.c llround.c llroundf.c log2f.c s_cbrt.c s_ceil.c \ + s_copysign.c s_fabs.c sf_atan.c sf_cbrt.c sf_ceil.c sf_copysign.c \ + s_fdim.c sf_fabs.c sf_fdim.c sf_finite.c sf_floor.c sf_fma.c \ + sf_fmax.c sf_fmin.c sf_fpclassify.c sf_frexp.c sf_ilogb.c \ + sf_isinf.c sf_isinff.c sf_isnan.c sf_isnanf.c sf_ldexp.c s_floor.c \ + sf_lrint.c sf_lround.c s_fma.c s_fmax.c s_fmin.c sf_nan.c \ + sf_remquo.c s_frexp.c sf_round.c sf_scalbn.c sf_trunc.c s_ilogb.c \ + s_ldexp.c s_lrint.c s_lround.c s_nearbyint.c s_remquo.c s_rint.c \ + s_round.c s_scalbn.c s_trunc.c wf_exp2.c wf_exp.c wf_fmod.c \ + wf_log10.c wf_log.c w_fmod.c wf_remainder.c w_remainder.c \ + w_sqrt.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 db0c8ffe5..dc7d02915 100644 --- a/newlib/libm/machine/spu/Makefile.in +++ b/newlib/libm/machine/spu/Makefile.in @@ -51,7 +51,33 @@ 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 \ + $(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 $(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 \ + $(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 \ @@ -72,10 +98,37 @@ 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-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) + lib_a-feupdateenv.$(OBJEXT) lib_a-llrint.$(OBJEXT) \ + lib_a-llrintf.$(OBJEXT) lib_a-llround.$(OBJEXT) \ + lib_a-llroundf.$(OBJEXT) lib_a-log2f.$(OBJEXT) \ + lib_a-s_cbrt.$(OBJEXT) lib_a-s_ceil.$(OBJEXT) \ + lib_a-s_copysign.$(OBJEXT) lib_a-s_fabs.$(OBJEXT) \ + lib_a-sf_atan.$(OBJEXT) lib_a-sf_cbrt.$(OBJEXT) \ + lib_a-sf_ceil.$(OBJEXT) lib_a-sf_copysign.$(OBJEXT) \ + lib_a-s_fdim.$(OBJEXT) lib_a-sf_fabs.$(OBJEXT) \ + lib_a-sf_fdim.$(OBJEXT) lib_a-sf_finite.$(OBJEXT) \ + lib_a-sf_floor.$(OBJEXT) lib_a-sf_fma.$(OBJEXT) \ + lib_a-sf_fmax.$(OBJEXT) lib_a-sf_fmin.$(OBJEXT) \ + lib_a-sf_fpclassify.$(OBJEXT) lib_a-sf_frexp.$(OBJEXT) \ + lib_a-sf_ilogb.$(OBJEXT) lib_a-sf_isinf.$(OBJEXT) \ + lib_a-sf_isinff.$(OBJEXT) lib_a-sf_isnan.$(OBJEXT) \ + lib_a-sf_isnanf.$(OBJEXT) lib_a-sf_ldexp.$(OBJEXT) \ + lib_a-s_floor.$(OBJEXT) lib_a-sf_lrint.$(OBJEXT) \ + lib_a-sf_lround.$(OBJEXT) lib_a-s_fma.$(OBJEXT) \ + lib_a-s_fmax.$(OBJEXT) lib_a-s_fmin.$(OBJEXT) \ + lib_a-sf_nan.$(OBJEXT) lib_a-sf_remquo.$(OBJEXT) \ + lib_a-s_frexp.$(OBJEXT) lib_a-sf_round.$(OBJEXT) \ + lib_a-sf_scalbn.$(OBJEXT) lib_a-sf_trunc.$(OBJEXT) \ + lib_a-s_ilogb.$(OBJEXT) lib_a-s_ldexp.$(OBJEXT) \ + lib_a-s_lrint.$(OBJEXT) lib_a-s_lround.$(OBJEXT) \ + lib_a-s_nearbyint.$(OBJEXT) lib_a-s_remquo.$(OBJEXT) \ + lib_a-s_rint.$(OBJEXT) lib_a-s_round.$(OBJEXT) \ + lib_a-s_scalbn.$(OBJEXT) lib_a-s_trunc.$(OBJEXT) \ + lib_a-wf_exp2.$(OBJEXT) lib_a-wf_exp.$(OBJEXT) \ + lib_a-wf_fmod.$(OBJEXT) lib_a-wf_log10.$(OBJEXT) \ + lib_a-wf_log.$(OBJEXT) lib_a-w_fmod.$(OBJEXT) \ + lib_a-wf_remainder.$(OBJEXT) lib_a-w_remainder.$(OBJEXT) \ + lib_a-w_sqrt.$(OBJEXT) am_lib_a_OBJECTS = $(am__objects_1) lib_a_OBJECTS = $(am_lib_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) @@ -150,11 +203,6 @@ STRIP = @STRIP@ USE_LIBTOOL_FALSE = @USE_LIBTOOL_FALSE@ USE_LIBTOOL_TRUE = @USE_LIBTOOL_TRUE@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_AS = @ac_ct_AS@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_READELF = @ac_ct_READELF@ -ac_ct_STRIP = @ac_ct_STRIP@ aext = @aext@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ @@ -170,18 +218,23 @@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ libm_machine_dir = @libm_machine_dir@ +localedir = @localedir@ localstatedir = @localstatedir@ lpfx = @lpfx@ machine_dir = @machine_dir@ @@ -190,8 +243,10 @@ mkdir_p = @mkdir_p@ newlib_basedir = @newlib_basedir@ oext = @oext@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sys_dir = @sys_dir@ @@ -205,8 +260,17 @@ 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 \ - sf_finite.c sf_fpclassify.c sf_isinf.c sf_isinff.c sf_isnanf.c \ - sf_isnan.c sf_nan.c + llrint.c llrintf.c llround.c llroundf.c log2f.c s_cbrt.c s_ceil.c \ + s_copysign.c s_fabs.c sf_atan.c sf_cbrt.c sf_ceil.c sf_copysign.c \ + s_fdim.c sf_fabs.c sf_fdim.c sf_finite.c sf_floor.c sf_fma.c \ + sf_fmax.c sf_fmin.c sf_fpclassify.c sf_frexp.c sf_ilogb.c \ + sf_isinf.c sf_isinff.c sf_isnan.c sf_isnanf.c sf_ldexp.c s_floor.c \ + sf_lrint.c sf_lround.c s_fma.c s_fmax.c s_fmin.c sf_nan.c \ + sf_remquo.c s_frexp.c sf_round.c sf_scalbn.c sf_trunc.c s_ilogb.c \ + s_ldexp.c s_lrint.c s_lround.c s_nearbyint.c s_remquo.c s_rint.c \ + s_round.c s_scalbn.c s_trunc.c wf_exp2.c wf_exp.c wf_fmod.c \ + wf_log10.c wf_log.c w_fmod.c wf_remainder.c w_remainder.c \ + w_sqrt.c noinst_LIBRARIES = lib.a lib_a_SOURCES = $(LIB_SOURCES) @@ -344,18 +408,150 @@ 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-llrint.o: llrint.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-llrint.o `test -f 'llrint.c' || echo '$(srcdir)/'`llrint.c + +lib_a-llrint.obj: llrint.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-llrint.obj `if test -f 'llrint.c'; then $(CYGPATH_W) 'llrint.c'; else $(CYGPATH_W) '$(srcdir)/llrint.c'; fi` + +lib_a-llrintf.o: llrintf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-llrintf.o `test -f 'llrintf.c' || echo '$(srcdir)/'`llrintf.c + +lib_a-llrintf.obj: llrintf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-llrintf.obj `if test -f 'llrintf.c'; then $(CYGPATH_W) 'llrintf.c'; else $(CYGPATH_W) '$(srcdir)/llrintf.c'; fi` + +lib_a-llround.o: llround.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-llround.o `test -f 'llround.c' || echo '$(srcdir)/'`llround.c + +lib_a-llround.obj: llround.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-llround.obj `if test -f 'llround.c'; then $(CYGPATH_W) 'llround.c'; else $(CYGPATH_W) '$(srcdir)/llround.c'; fi` + +lib_a-llroundf.o: llroundf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-llroundf.o `test -f 'llroundf.c' || echo '$(srcdir)/'`llroundf.c + +lib_a-llroundf.obj: llroundf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-llroundf.obj `if test -f 'llroundf.c'; then $(CYGPATH_W) 'llroundf.c'; else $(CYGPATH_W) '$(srcdir)/llroundf.c'; fi` + +lib_a-log2f.o: log2f.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-log2f.o `test -f 'log2f.c' || echo '$(srcdir)/'`log2f.c + +lib_a-log2f.obj: log2f.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-log2f.obj `if test -f 'log2f.c'; then $(CYGPATH_W) 'log2f.c'; else $(CYGPATH_W) '$(srcdir)/log2f.c'; fi` + +lib_a-s_cbrt.o: s_cbrt.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_cbrt.o `test -f 's_cbrt.c' || echo '$(srcdir)/'`s_cbrt.c + +lib_a-s_cbrt.obj: s_cbrt.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_cbrt.obj `if test -f 's_cbrt.c'; then $(CYGPATH_W) 's_cbrt.c'; else $(CYGPATH_W) '$(srcdir)/s_cbrt.c'; fi` + +lib_a-s_ceil.o: s_ceil.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_ceil.o `test -f 's_ceil.c' || echo '$(srcdir)/'`s_ceil.c + +lib_a-s_ceil.obj: s_ceil.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_ceil.obj `if test -f 's_ceil.c'; then $(CYGPATH_W) 's_ceil.c'; else $(CYGPATH_W) '$(srcdir)/s_ceil.c'; fi` + +lib_a-s_copysign.o: s_copysign.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_copysign.o `test -f 's_copysign.c' || echo '$(srcdir)/'`s_copysign.c + +lib_a-s_copysign.obj: s_copysign.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_copysign.obj `if test -f 's_copysign.c'; then $(CYGPATH_W) 's_copysign.c'; else $(CYGPATH_W) '$(srcdir)/s_copysign.c'; fi` + +lib_a-s_fabs.o: s_fabs.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_fabs.o `test -f 's_fabs.c' || echo '$(srcdir)/'`s_fabs.c + +lib_a-s_fabs.obj: s_fabs.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_fabs.obj `if test -f 's_fabs.c'; then $(CYGPATH_W) 's_fabs.c'; else $(CYGPATH_W) '$(srcdir)/s_fabs.c'; fi` + +lib_a-sf_atan.o: sf_atan.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_atan.o `test -f 'sf_atan.c' || echo '$(srcdir)/'`sf_atan.c + +lib_a-sf_atan.obj: sf_atan.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_atan.obj `if test -f 'sf_atan.c'; then $(CYGPATH_W) 'sf_atan.c'; else $(CYGPATH_W) '$(srcdir)/sf_atan.c'; fi` + +lib_a-sf_cbrt.o: sf_cbrt.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_cbrt.o `test -f 'sf_cbrt.c' || echo '$(srcdir)/'`sf_cbrt.c + +lib_a-sf_cbrt.obj: sf_cbrt.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_cbrt.obj `if test -f 'sf_cbrt.c'; then $(CYGPATH_W) 'sf_cbrt.c'; else $(CYGPATH_W) '$(srcdir)/sf_cbrt.c'; fi` + +lib_a-sf_ceil.o: sf_ceil.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_ceil.o `test -f 'sf_ceil.c' || echo '$(srcdir)/'`sf_ceil.c + +lib_a-sf_ceil.obj: sf_ceil.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_ceil.obj `if test -f 'sf_ceil.c'; then $(CYGPATH_W) 'sf_ceil.c'; else $(CYGPATH_W) '$(srcdir)/sf_ceil.c'; fi` + +lib_a-sf_copysign.o: sf_copysign.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_copysign.o `test -f 'sf_copysign.c' || echo '$(srcdir)/'`sf_copysign.c + +lib_a-sf_copysign.obj: sf_copysign.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_copysign.obj `if test -f 'sf_copysign.c'; then $(CYGPATH_W) 'sf_copysign.c'; else $(CYGPATH_W) '$(srcdir)/sf_copysign.c'; fi` + +lib_a-s_fdim.o: s_fdim.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_fdim.o `test -f 's_fdim.c' || echo '$(srcdir)/'`s_fdim.c + +lib_a-s_fdim.obj: s_fdim.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_fdim.obj `if test -f 's_fdim.c'; then $(CYGPATH_W) 's_fdim.c'; else $(CYGPATH_W) '$(srcdir)/s_fdim.c'; fi` + +lib_a-sf_fabs.o: sf_fabs.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_fabs.o `test -f 'sf_fabs.c' || echo '$(srcdir)/'`sf_fabs.c + +lib_a-sf_fabs.obj: sf_fabs.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_fabs.obj `if test -f 'sf_fabs.c'; then $(CYGPATH_W) 'sf_fabs.c'; else $(CYGPATH_W) '$(srcdir)/sf_fabs.c'; fi` + +lib_a-sf_fdim.o: sf_fdim.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_fdim.o `test -f 'sf_fdim.c' || echo '$(srcdir)/'`sf_fdim.c + +lib_a-sf_fdim.obj: sf_fdim.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_fdim.obj `if test -f 'sf_fdim.c'; then $(CYGPATH_W) 'sf_fdim.c'; else $(CYGPATH_W) '$(srcdir)/sf_fdim.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_floor.o: sf_floor.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_floor.o `test -f 'sf_floor.c' || echo '$(srcdir)/'`sf_floor.c + +lib_a-sf_floor.obj: sf_floor.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_floor.obj `if test -f 'sf_floor.c'; then $(CYGPATH_W) 'sf_floor.c'; else $(CYGPATH_W) '$(srcdir)/sf_floor.c'; fi` + +lib_a-sf_fma.o: sf_fma.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_fma.o `test -f 'sf_fma.c' || echo '$(srcdir)/'`sf_fma.c + +lib_a-sf_fma.obj: sf_fma.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_fma.obj `if test -f 'sf_fma.c'; then $(CYGPATH_W) 'sf_fma.c'; else $(CYGPATH_W) '$(srcdir)/sf_fma.c'; fi` + +lib_a-sf_fmax.o: sf_fmax.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_fmax.o `test -f 'sf_fmax.c' || echo '$(srcdir)/'`sf_fmax.c + +lib_a-sf_fmax.obj: sf_fmax.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_fmax.obj `if test -f 'sf_fmax.c'; then $(CYGPATH_W) 'sf_fmax.c'; else $(CYGPATH_W) '$(srcdir)/sf_fmax.c'; fi` + +lib_a-sf_fmin.o: sf_fmin.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_fmin.o `test -f 'sf_fmin.c' || echo '$(srcdir)/'`sf_fmin.c + +lib_a-sf_fmin.obj: sf_fmin.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_fmin.obj `if test -f 'sf_fmin.c'; then $(CYGPATH_W) 'sf_fmin.c'; else $(CYGPATH_W) '$(srcdir)/sf_fmin.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_frexp.o: sf_frexp.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_frexp.o `test -f 'sf_frexp.c' || echo '$(srcdir)/'`sf_frexp.c + +lib_a-sf_frexp.obj: sf_frexp.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_frexp.obj `if test -f 'sf_frexp.c'; then $(CYGPATH_W) 'sf_frexp.c'; else $(CYGPATH_W) '$(srcdir)/sf_frexp.c'; fi` + +lib_a-sf_ilogb.o: sf_ilogb.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_ilogb.o `test -f 'sf_ilogb.c' || echo '$(srcdir)/'`sf_ilogb.c + +lib_a-sf_ilogb.obj: sf_ilogb.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_ilogb.obj `if test -f 'sf_ilogb.c'; then $(CYGPATH_W) 'sf_ilogb.c'; else $(CYGPATH_W) '$(srcdir)/sf_ilogb.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 @@ -368,23 +564,209 @@ lib_a-sf_isinff.o: 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_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_ldexp.o: sf_ldexp.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_ldexp.o `test -f 'sf_ldexp.c' || echo '$(srcdir)/'`sf_ldexp.c + +lib_a-sf_ldexp.obj: sf_ldexp.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_ldexp.obj `if test -f 'sf_ldexp.c'; then $(CYGPATH_W) 'sf_ldexp.c'; else $(CYGPATH_W) '$(srcdir)/sf_ldexp.c'; fi` + +lib_a-s_floor.o: s_floor.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_floor.o `test -f 's_floor.c' || echo '$(srcdir)/'`s_floor.c + +lib_a-s_floor.obj: s_floor.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_floor.obj `if test -f 's_floor.c'; then $(CYGPATH_W) 's_floor.c'; else $(CYGPATH_W) '$(srcdir)/s_floor.c'; fi` + +lib_a-sf_lrint.o: sf_lrint.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_lrint.o `test -f 'sf_lrint.c' || echo '$(srcdir)/'`sf_lrint.c + +lib_a-sf_lrint.obj: sf_lrint.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_lrint.obj `if test -f 'sf_lrint.c'; then $(CYGPATH_W) 'sf_lrint.c'; else $(CYGPATH_W) '$(srcdir)/sf_lrint.c'; fi` + +lib_a-sf_lround.o: sf_lround.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_lround.o `test -f 'sf_lround.c' || echo '$(srcdir)/'`sf_lround.c + +lib_a-sf_lround.obj: sf_lround.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_lround.obj `if test -f 'sf_lround.c'; then $(CYGPATH_W) 'sf_lround.c'; else $(CYGPATH_W) '$(srcdir)/sf_lround.c'; fi` + +lib_a-s_fma.o: s_fma.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_fma.o `test -f 's_fma.c' || echo '$(srcdir)/'`s_fma.c + +lib_a-s_fma.obj: s_fma.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_fma.obj `if test -f 's_fma.c'; then $(CYGPATH_W) 's_fma.c'; else $(CYGPATH_W) '$(srcdir)/s_fma.c'; fi` + +lib_a-s_fmax.o: s_fmax.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_fmax.o `test -f 's_fmax.c' || echo '$(srcdir)/'`s_fmax.c + +lib_a-s_fmax.obj: s_fmax.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_fmax.obj `if test -f 's_fmax.c'; then $(CYGPATH_W) 's_fmax.c'; else $(CYGPATH_W) '$(srcdir)/s_fmax.c'; fi` + +lib_a-s_fmin.o: s_fmin.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_fmin.o `test -f 's_fmin.c' || echo '$(srcdir)/'`s_fmin.c + +lib_a-s_fmin.obj: s_fmin.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_fmin.obj `if test -f 's_fmin.c'; then $(CYGPATH_W) 's_fmin.c'; else $(CYGPATH_W) '$(srcdir)/s_fmin.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` + +lib_a-sf_remquo.o: sf_remquo.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_remquo.o `test -f 'sf_remquo.c' || echo '$(srcdir)/'`sf_remquo.c + +lib_a-sf_remquo.obj: sf_remquo.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_remquo.obj `if test -f 'sf_remquo.c'; then $(CYGPATH_W) 'sf_remquo.c'; else $(CYGPATH_W) '$(srcdir)/sf_remquo.c'; fi` + +lib_a-s_frexp.o: s_frexp.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_frexp.o `test -f 's_frexp.c' || echo '$(srcdir)/'`s_frexp.c + +lib_a-s_frexp.obj: s_frexp.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_frexp.obj `if test -f 's_frexp.c'; then $(CYGPATH_W) 's_frexp.c'; else $(CYGPATH_W) '$(srcdir)/s_frexp.c'; fi` + +lib_a-sf_round.o: sf_round.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_round.o `test -f 'sf_round.c' || echo '$(srcdir)/'`sf_round.c + +lib_a-sf_round.obj: sf_round.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_round.obj `if test -f 'sf_round.c'; then $(CYGPATH_W) 'sf_round.c'; else $(CYGPATH_W) '$(srcdir)/sf_round.c'; fi` + +lib_a-sf_scalbn.o: sf_scalbn.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_scalbn.o `test -f 'sf_scalbn.c' || echo '$(srcdir)/'`sf_scalbn.c + +lib_a-sf_scalbn.obj: sf_scalbn.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_scalbn.obj `if test -f 'sf_scalbn.c'; then $(CYGPATH_W) 'sf_scalbn.c'; else $(CYGPATH_W) '$(srcdir)/sf_scalbn.c'; fi` + +lib_a-sf_trunc.o: sf_trunc.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_trunc.o `test -f 'sf_trunc.c' || echo '$(srcdir)/'`sf_trunc.c + +lib_a-sf_trunc.obj: sf_trunc.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_trunc.obj `if test -f 'sf_trunc.c'; then $(CYGPATH_W) 'sf_trunc.c'; else $(CYGPATH_W) '$(srcdir)/sf_trunc.c'; fi` + +lib_a-s_ilogb.o: s_ilogb.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_ilogb.o `test -f 's_ilogb.c' || echo '$(srcdir)/'`s_ilogb.c + +lib_a-s_ilogb.obj: s_ilogb.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_ilogb.obj `if test -f 's_ilogb.c'; then $(CYGPATH_W) 's_ilogb.c'; else $(CYGPATH_W) '$(srcdir)/s_ilogb.c'; fi` + +lib_a-s_ldexp.o: s_ldexp.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_ldexp.o `test -f 's_ldexp.c' || echo '$(srcdir)/'`s_ldexp.c + +lib_a-s_ldexp.obj: s_ldexp.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_ldexp.obj `if test -f 's_ldexp.c'; then $(CYGPATH_W) 's_ldexp.c'; else $(CYGPATH_W) '$(srcdir)/s_ldexp.c'; fi` + +lib_a-s_lrint.o: s_lrint.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_lrint.o `test -f 's_lrint.c' || echo '$(srcdir)/'`s_lrint.c + +lib_a-s_lrint.obj: s_lrint.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_lrint.obj `if test -f 's_lrint.c'; then $(CYGPATH_W) 's_lrint.c'; else $(CYGPATH_W) '$(srcdir)/s_lrint.c'; fi` + +lib_a-s_lround.o: s_lround.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_lround.o `test -f 's_lround.c' || echo '$(srcdir)/'`s_lround.c + +lib_a-s_lround.obj: s_lround.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_lround.obj `if test -f 's_lround.c'; then $(CYGPATH_W) 's_lround.c'; else $(CYGPATH_W) '$(srcdir)/s_lround.c'; fi` + +lib_a-s_nearbyint.o: s_nearbyint.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_nearbyint.o `test -f 's_nearbyint.c' || echo '$(srcdir)/'`s_nearbyint.c + +lib_a-s_nearbyint.obj: s_nearbyint.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_nearbyint.obj `if test -f 's_nearbyint.c'; then $(CYGPATH_W) 's_nearbyint.c'; else $(CYGPATH_W) '$(srcdir)/s_nearbyint.c'; fi` + +lib_a-s_remquo.o: s_remquo.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_remquo.o `test -f 's_remquo.c' || echo '$(srcdir)/'`s_remquo.c + +lib_a-s_remquo.obj: s_remquo.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_remquo.obj `if test -f 's_remquo.c'; then $(CYGPATH_W) 's_remquo.c'; else $(CYGPATH_W) '$(srcdir)/s_remquo.c'; fi` + +lib_a-s_rint.o: s_rint.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_rint.o `test -f 's_rint.c' || echo '$(srcdir)/'`s_rint.c + +lib_a-s_rint.obj: s_rint.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_rint.obj `if test -f 's_rint.c'; then $(CYGPATH_W) 's_rint.c'; else $(CYGPATH_W) '$(srcdir)/s_rint.c'; fi` + +lib_a-s_round.o: s_round.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_round.o `test -f 's_round.c' || echo '$(srcdir)/'`s_round.c + +lib_a-s_round.obj: s_round.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_round.obj `if test -f 's_round.c'; then $(CYGPATH_W) 's_round.c'; else $(CYGPATH_W) '$(srcdir)/s_round.c'; fi` + +lib_a-s_scalbn.o: s_scalbn.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_scalbn.o `test -f 's_scalbn.c' || echo '$(srcdir)/'`s_scalbn.c + +lib_a-s_scalbn.obj: s_scalbn.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_scalbn.obj `if test -f 's_scalbn.c'; then $(CYGPATH_W) 's_scalbn.c'; else $(CYGPATH_W) '$(srcdir)/s_scalbn.c'; fi` + +lib_a-s_trunc.o: s_trunc.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_trunc.o `test -f 's_trunc.c' || echo '$(srcdir)/'`s_trunc.c + +lib_a-s_trunc.obj: s_trunc.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-s_trunc.obj `if test -f 's_trunc.c'; then $(CYGPATH_W) 's_trunc.c'; else $(CYGPATH_W) '$(srcdir)/s_trunc.c'; fi` + +lib_a-wf_exp2.o: wf_exp2.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wf_exp2.o `test -f 'wf_exp2.c' || echo '$(srcdir)/'`wf_exp2.c + +lib_a-wf_exp2.obj: wf_exp2.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wf_exp2.obj `if test -f 'wf_exp2.c'; then $(CYGPATH_W) 'wf_exp2.c'; else $(CYGPATH_W) '$(srcdir)/wf_exp2.c'; fi` + +lib_a-wf_exp.o: wf_exp.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wf_exp.o `test -f 'wf_exp.c' || echo '$(srcdir)/'`wf_exp.c + +lib_a-wf_exp.obj: wf_exp.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wf_exp.obj `if test -f 'wf_exp.c'; then $(CYGPATH_W) 'wf_exp.c'; else $(CYGPATH_W) '$(srcdir)/wf_exp.c'; fi` + +lib_a-wf_fmod.o: wf_fmod.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wf_fmod.o `test -f 'wf_fmod.c' || echo '$(srcdir)/'`wf_fmod.c + +lib_a-wf_fmod.obj: wf_fmod.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wf_fmod.obj `if test -f 'wf_fmod.c'; then $(CYGPATH_W) 'wf_fmod.c'; else $(CYGPATH_W) '$(srcdir)/wf_fmod.c'; fi` + +lib_a-wf_log10.o: wf_log10.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wf_log10.o `test -f 'wf_log10.c' || echo '$(srcdir)/'`wf_log10.c + +lib_a-wf_log10.obj: wf_log10.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wf_log10.obj `if test -f 'wf_log10.c'; then $(CYGPATH_W) 'wf_log10.c'; else $(CYGPATH_W) '$(srcdir)/wf_log10.c'; fi` + +lib_a-wf_log.o: wf_log.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wf_log.o `test -f 'wf_log.c' || echo '$(srcdir)/'`wf_log.c + +lib_a-wf_log.obj: wf_log.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wf_log.obj `if test -f 'wf_log.c'; then $(CYGPATH_W) 'wf_log.c'; else $(CYGPATH_W) '$(srcdir)/wf_log.c'; fi` + +lib_a-w_fmod.o: w_fmod.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-w_fmod.o `test -f 'w_fmod.c' || echo '$(srcdir)/'`w_fmod.c + +lib_a-w_fmod.obj: w_fmod.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-w_fmod.obj `if test -f 'w_fmod.c'; then $(CYGPATH_W) 'w_fmod.c'; else $(CYGPATH_W) '$(srcdir)/w_fmod.c'; fi` + +lib_a-wf_remainder.o: wf_remainder.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wf_remainder.o `test -f 'wf_remainder.c' || echo '$(srcdir)/'`wf_remainder.c + +lib_a-wf_remainder.obj: wf_remainder.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wf_remainder.obj `if test -f 'wf_remainder.c'; then $(CYGPATH_W) 'wf_remainder.c'; else $(CYGPATH_W) '$(srcdir)/wf_remainder.c'; fi` + +lib_a-w_remainder.o: w_remainder.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-w_remainder.o `test -f 'w_remainder.c' || echo '$(srcdir)/'`w_remainder.c + +lib_a-w_remainder.obj: w_remainder.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-w_remainder.obj `if test -f 'w_remainder.c'; then $(CYGPATH_W) 'w_remainder.c'; else $(CYGPATH_W) '$(srcdir)/w_remainder.c'; fi` + +lib_a-w_sqrt.o: w_sqrt.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-w_sqrt.o `test -f 'w_sqrt.c' || echo '$(srcdir)/'`w_sqrt.c + +lib_a-w_sqrt.obj: w_sqrt.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-w_sqrt.obj `if test -f 'w_sqrt.c'; then $(CYGPATH_W) 'w_sqrt.c'; else $(CYGPATH_W) '$(srcdir)/w_sqrt.c'; fi` uninstall-info-am: ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) diff --git a/newlib/libm/machine/spu/headers/atanf.h b/newlib/libm/machine/spu/headers/atanf.h new file mode 100644 index 000000000..ec01c1ec8 --- /dev/null +++ b/newlib/libm/machine/spu/headers/atanf.h @@ -0,0 +1,112 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _ATANF_H_ +#define _ATANF_H_ 1 + +#ifndef M_PI_2 +#define M_PI_2 1.5707963267949f +#endif /* M_PI_2 */ + +/* + * FUNCTION + * float _atanf(float x) + * + * DESCRIPTION + * _atanf computes the arc tangent of the value x; that is the value + * whose tangent is x. + * + * _atanf returns the arc tangent in radians and the value is + * mathematically defined to be in the range -PI/2 to PI/2. + * + * The arc tangent function is computed using a polynomial approximation + * (B. Carlson, M. Goldstein, Los Alamos Scientific Laboratiry, 1955). + * __8__ + * \ + * \ + * atanf(x) = / Ci*x^(2*i+1) + * /____ + * i=0 + * + * for x in the range -1 to 1. The remaining regions are defined to be: + * + * [1, infinity] : PI/2 + atanf(-1/x) + * [-infinity, -1] : -PI/2 + atanf(-1/x) + */ + +static __inline float _atanf(float x) +{ + float xabs; + float bias; + float x2, x3, x4, x8, x9; + float hi, lo; + float result; + + bias = 0.0f; + xabs = (x < 0.0f) ? -x : x; + + if (xabs >= 1.0f) { + bias = M_PI_2; + if (x < 0.0f) { + bias = -bias; + } + x = -1.0f / x; + } + /* Instruction counts can be reduced if the polynomial was + * computed entirely from nested (dependent) fma's. However, + * to reduce the number of pipeline stalls, the polygon is evaluated + * in two halves(hi and lo). + */ + bias += x; + + x2 = x * x; + x3 = x2 * x; + x4 = x2 * x2; + x8 = x4 * x4; + x9 = x8 * x; + hi = 0.0028662257f * x2 - 0.0161657367f; + hi = hi * x2 + 0.0429096138f; + hi = hi * x2 - 0.0752896400f; + hi = hi * x2 + 0.1065626393f; + lo = -0.1420889944f * x2 + 0.1999355085f; + lo = lo * x2 - 0.3333314528f; + lo = lo * x3 + bias; + + result = hi * x9 + lo; + + return (result); +} + +#endif /* _ATANF_H_ */ + + + diff --git a/newlib/libm/machine/spu/headers/cbrt.h b/newlib/libm/machine/spu/headers/cbrt.h new file mode 100644 index 000000000..de0977028 --- /dev/null +++ b/newlib/libm/machine/spu/headers/cbrt.h @@ -0,0 +1,128 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ + +#ifndef _CBRT_H_ +#define _CBRT_H_ 1 + +#include +#include "headers/vec_literal.h" + +extern double cbrt_factors[5]; + +/* Compute the cube root of x to double precision. + */ + +static __inline double _cbrt(double x) +{ + vec_int4 exp, bias; + vec_uint4 e_div_3, e_mod_3; + vec_float4 bf, inv_bf; + vec_float4 onef = VEC_SPLAT_F32(1.0f); + vec_ullong2 mask; + vec_ullong2 mant_mask = VEC_SPLAT_U64(0xFFFFFFFFFFFFFULL); + vec_double2 one = VEC_SPLAT_F64(1.0); + vec_double2 two = VEC_SPLAT_F64(2.0); + vec_double2 half = VEC_SPLAT_F64(0.5); + /* Polynomial coefficients */ + vec_double2 c0 = VEC_SPLAT_F64(0.354895765043919860); + vec_double2 c1 = VEC_SPLAT_F64(1.50819193781584896); + vec_double2 c2 = VEC_SPLAT_F64(-2.11499494167371287); + vec_double2 c3 = VEC_SPLAT_F64(2.44693122563534430); + vec_double2 c4 = VEC_SPLAT_F64(-1.83469277483613086); + vec_double2 c5 = VEC_SPLAT_F64(0.784932344976639262); + vec_double2 c6 = VEC_SPLAT_F64(0.145263899385486377); + vec_double2 in, out, mant, u, u3, ym, a, b, factor, inv_b; + + in = spu_promote(x, 0); + + /* Normalize the mantissa (fraction part) into the range [0.5, 1.0) and + * extract the exponent. + */ + mant = spu_sel(half, in, mant_mask); + exp = spu_and(spu_rlmask((vec_int4)in, -20), 0x7FF); + + /* Generate mask used to zero result if the exponent is zero (ie, is + * either zero or a denorm + */ + mask = (vec_ullong2)spu_cmpeq(exp, 0); + mask = spu_shuffle(mask, mask, VEC_LITERAL(vec_uchar16, 0,1,2,3,0,1,2,3,8,9,10,11,8,9,10,11)); + exp = spu_add(exp, -1022); + + u = spu_madd(mant, spu_madd(mant, spu_madd(mant, spu_madd(mant, spu_madd(mant, spu_nmsub(mant, c6, c5), c4), c3), c2), c1), c0); + u3 = spu_mul(spu_mul(u, u), u); + + /* Compute: e_div_3 = exp/3 + * + * Fetch: factor = factor[2+exp%3] + * + * The factors array contains 5 values: 2^(-2/3), 2^(-1/3), 2^0, 2^(1/3), + * 2^(2/3), 2^1. + * The fetch is done using shuffle bytes so that is can easily be extended + * to support SIMD compution. + */ + bias = spu_rlmask(spu_rlmaska(exp, -15), -16); + e_div_3 = (vec_uint4)spu_rlmaska(spu_madd((vec_short8)exp, VEC_SPLAT_S16(0x5556), bias), -16); + + e_mod_3 = (vec_uint4)spu_sub((vec_int4)(exp), spu_mulo((vec_short8)e_div_3, VEC_SPLAT_S16(3))); + + factor = spu_promote(cbrt_factors[2+spu_extract(e_mod_3, 0)], 0); + + /* Compute the estimated mantissa cube root (ym) equals: + * ym = (u * factor * (2.0 * mant + u3)) / (2.0 * u3 + mant); + */ + a = spu_mul(spu_mul(factor, u), spu_madd(two, mant, u3)); + b = spu_madd(two, u3, mant); + + bf = spu_roundtf(b); + inv_bf = spu_re(bf); + inv_bf = spu_madd(spu_nmsub(bf, inv_bf, onef), inv_bf, inv_bf); + + inv_b = spu_extend(inv_bf); + inv_b = spu_madd(spu_nmsub(b, inv_b, one), inv_b, inv_b); + + ym = spu_mul(a, inv_b); + ym = spu_madd(spu_nmsub(b, ym, a), inv_b, ym); + + /* Merge sign, computed exponent, and computed mantissa. + */ + exp = spu_rl(spu_add((vec_int4)e_div_3, 1023), 20); + exp = spu_andc(exp, (vec_int4)mant_mask); + out = spu_sel((vec_double2)exp, in, VEC_SPLAT_U64(0x8000000000000000ULL)); + out = spu_mul(out, ym); + + out = spu_andc(out, (vec_double2)mask); + + return (spu_extract(out, 0)); +} + +#endif /* _CBRT_H_ */ diff --git a/newlib/libm/machine/spu/headers/cbrtf.h b/newlib/libm/machine/spu/headers/cbrtf.h new file mode 100644 index 000000000..fb9553ad7 --- /dev/null +++ b/newlib/libm/machine/spu/headers/cbrtf.h @@ -0,0 +1,124 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _CBRTF_H_ +#define _CBRTF_H_ 1 + +#include +#include "headers/vec_literal.h" + +extern double cbrt_factors[5]; + +/* Compute the cube root of the floating point input x. + */ + +static __inline float _cbrtf(float x) +{ + vec_int4 exp, bias; + vec_uint4 mask, e_div_3, e_mod_3; + vec_uint4 mant_mask = VEC_SPLAT_U32(0x7FFFFF); + vec_float4 in; + vec_float4 half = VEC_SPLAT_F32(0.5f); + vec_float4 onef = VEC_SPLAT_F32(1.0f); + vec_float4 out, mant, ym, bf, inv_bf; + vec_double2 two = VEC_SPLAT_F64(2.0); + /* Polynomial coefficients */ + vec_double2 c2 = VEC_SPLAT_F64(0.191502161678719066); + vec_double2 c1 = VEC_SPLAT_F64(0.697570460207922770); + vec_double2 c0 = VEC_SPLAT_F64(0.492659620528969547); + vec_double2 a0, b0, inv_b0, ym0; + vec_double2 mant0, u0, u0_3, factor0; + + in = spu_promote(x, 0); + + /* Normalize the mantissa (fraction part) into the range [0.5, 1.0) and + * extract the exponent. + */ + mant = spu_sel(half, in, mant_mask); + exp = spu_and(spu_rlmask((vec_int4)in, -23), 0xFF); + + /* Generate mask used to zero result if the exponent is zero (ie, in is either + * zero or a denorm + */ + mask = spu_cmpeq(exp, 0); + exp = spu_add(exp, -126); + + mant0 = spu_extend(mant); + + u0 = spu_madd(mant0, spu_nmsub(mant0, c2, c1), c0); + u0_3 = spu_mul(spu_mul(u0, u0), u0); + + /* Compute: e_div_3 = exp/3 + * + * Fetch: factor = factor[2+exp%3] + * + * The factors array contains 5 values: 2^(-2/3), 2^(-1/3), 2^0, 2^(1/3), 2^(2/3), 2^1. + */ + bias = spu_rlmask(spu_rlmaska(exp, -15), -16); + e_div_3 = (vec_uint4)spu_rlmaska(spu_madd((vec_short8)exp, VEC_SPLAT_S16(0x5556), bias), -16); + + e_mod_3 = (vec_uint4)spu_sub((vec_int4)(exp), spu_mulo((vec_short8)e_div_3, VEC_SPLAT_S16(3))); + + e_mod_3 = spu_add(e_mod_3, 2); + + factor0 = spu_promote(cbrt_factors[spu_extract(e_mod_3, 0)], 0); + + /* Compute the estimated mantissa cube root (ym) equals: + * ym = (u * factor * (2.0 * mant + u3)) / (2.0 * u3 + mant); + */ + a0 = spu_mul(spu_mul(factor0, u0), spu_madd(two, mant0, u0_3)); + b0 = spu_madd(two, u0_3, mant0); + + bf = spu_roundtf(b0); + + inv_bf = spu_re(bf); + inv_bf = spu_madd(spu_nmsub(bf, inv_bf, onef), inv_bf, inv_bf); + + inv_b0 = spu_extend(inv_bf); + + ym0 = spu_mul(a0, inv_b0); + ym0 = spu_madd(spu_nmsub(b0, ym0, a0), inv_b0, ym0); + + ym = spu_roundtf(ym0); + + /* Merge sign, computed exponent, and computed mantissa. + */ + exp = spu_rl(spu_add((vec_int4)e_div_3, 127), 23); + out = spu_sel((vec_float4)exp, in, VEC_SPLAT_U32(0x80000000)); + out = spu_mul(out, ym); + + out = spu_andc(out, (vec_float4)mask); + + return (spu_extract(out, 0)); +} + +#endif /* _CBRTF_H_ */ diff --git a/newlib/libm/machine/spu/headers/ceil.h b/newlib/libm/machine/spu/headers/ceil.h new file mode 100644 index 000000000..b51f26bcd --- /dev/null +++ b/newlib/libm/machine/spu/headers/ceil.h @@ -0,0 +1,95 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _CEIL_H_ +#define _CEIL_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* Round the input upwards to the nearest integer. + */ + + +static __inline double _ceil(double x) +{ + vec_uchar16 swap_words = VEC_LITERAL(vec_uchar16, 4,5,6,7, 0,1,2,3, 12,13,14,15, 8,9,10,11); + vec_uchar16 splat_hi = VEC_LITERAL(vec_uchar16, 0,1,2,3,0,1,2,3, 8,9,10,11, 8,9,10,11); + vec_uint4 one = VEC_LITERAL(vec_uint4, 0, 1, 0, 1); + vec_int4 exp, shift; + vec_uint4 mask, mask_1, frac_mask, addend, insert, pos, equal0; + vec_ullong2 sign = VEC_SPLAT_U64(0x8000000000000000ULL); + vec_double2 in, in_hi, out; + vec_double2 one_d = VEC_SPLAT_F64(1.0); + + in = spu_promote(x, 0); + + /* This function generates the following component + * based upon the inputs. + * + * mask = bits of the input that need to be replaced. + * insert = value of the bits that need to be replaced + * addend = value to be added to perform function. + * + * These are applied as follows:. + * + * out = ((in & mask) | insert) + addend + */ + in_hi = spu_shuffle(in, in, splat_hi); + pos = spu_cmpgt((vec_int4)in_hi, -1); + exp = spu_and(spu_rlmask((vec_int4)in_hi, -20), 0x7FF); + shift = spu_sub(VEC_LITERAL(vec_int4, 1023, 1043, 1023, 1043), exp); + + /* clamp shift to the range 0 to -31. + */ + shift = spu_sel(VEC_SPLAT_S32(-32), spu_andc(shift, (vec_int4)spu_cmpgt(shift, 0)), spu_cmpgt(shift, -32)); + + frac_mask = spu_rlmask(VEC_LITERAL(vec_uint4, 0xFFFFF, -1, 0xFFFFF, -1), shift); + mask = spu_orc(frac_mask, spu_cmpgt(exp, 0x3FE)); + + /* addend = ((in & mask) && (in >= 0)) ? mask+1 : 0 + */ + mask_1 = spu_addx(mask, one, spu_rlqwbyte(spu_genc(mask, one), 4)); + + equal0 = spu_cmpeq(spu_and((vec_uint4)in, mask), 0); + addend = spu_andc(spu_and(mask_1, pos), spu_and(equal0, spu_shuffle(equal0, equal0, swap_words))); + + insert = spu_andc(spu_and(pos, (vec_uint4)one_d), + spu_cmpgt((vec_uint4)spu_add(exp, -1), 1022)); + + in = spu_sel(in, (vec_double2)insert, spu_andc((vec_ullong2)mask, sign)); + out = (vec_double2)spu_addx((vec_uint4)in, addend, spu_rlqwbyte(spu_genc((vec_uint4)in, addend), 4)); + + return (spu_extract(out, 0)); +} + +#endif /* _CEIL_H */ diff --git a/newlib/libm/machine/spu/headers/ceilf.h b/newlib/libm/machine/spu/headers/ceilf.h new file mode 100644 index 000000000..deb900f4e --- /dev/null +++ b/newlib/libm/machine/spu/headers/ceilf.h @@ -0,0 +1,123 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _CEILF_H_ +#define _CEILF_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* + * FUNCTION + * float _ceilf(float value) + * + * DESCRIPTION + * The _ceilf routine round the input value "value" upwards to the + * nearest integer returning the result as a float. Two forms of the + * ceiling function are provided - full range and limited (integer) + * range. + * + * The full range form (default) provides ceiling computation on + * all IEEE floating point values. The ceiling of NANs remain NANs. + * The ceiling of denorms results in zero. + * + * The limited range form (selected by defining CEIL_INTEGER_RANGE) + * compute ths ceiling of all floating-point values in the 32-bit + * signed integer range. Values outside this range get clamped. + */ + +static __inline float _ceilf(float value) +{ +#ifdef CEIL_INTEGER_RANGE + /* 32-BIT INTEGER DYNAMIC RANGE + */ + union { + float f; + signed int i; + unsigned int ui; + } bias; + + bias.f = value; + + /* If positive, bias the input value to truncate towards + * positive infinity, instead of zero. + */ + bias.ui = ~(unsigned int)(bias.i >> 31) & 0x3F7FFFFF; + value += bias.f; + + /* Remove fraction bits by casting to an integer and back + * to a floating-point value. + */ + return ((float)((int)value)); + +#else /* !CEIL_INTEGER_RANGE */ + /* FULL FLOATING-POINT RANGE + */ + vec_int4 exp, shift; + vec_uint4 mask, frac_mask, addend, insert, pos; + vec_float4 in, out; + vec_float4 one = VEC_SPLAT_F32(1.0f); + + in = spu_promote(value, 0); + + /* This function generates the following component + * based upon the inputs. + * + * mask = bits of the input that need to be replaced. + * insert = value of the bits that need to be replaced + * addend = value to be added to perform function. + * + * These are applied as follows:. + * + * out = ((in & mask) | insert) + addend + */ + pos = spu_cmpgt((vec_int4)in, -1); + exp = spu_and(spu_rlmask((vec_int4)in, -23), 0xFF); + + shift = spu_sub(127, exp); + + frac_mask = spu_and(spu_rlmask(VEC_SPLAT_U32(0x7FFFFF), shift), + spu_cmpgt((vec_int4)shift, -31)); + + mask = spu_orc(frac_mask, spu_cmpgt(exp, 126)); + + addend = spu_andc(spu_and(spu_add(mask, 1), pos), spu_cmpeq(spu_and((vec_uint4)in, mask), 0)); + + insert = spu_andc(spu_and(pos, (vec_uint4)one), + spu_cmpgt((vec_uint4)spu_add(exp, -1), 126)); + + out = (vec_float4)spu_add(spu_sel((vec_uint4)in, insert, mask), addend); + + return (spu_extract(out, 0)); +#endif /* CEIL_INTEGER_RANGE */ +} +#endif /* _CEILF_H_ */ diff --git a/newlib/libm/machine/spu/headers/copysign.h b/newlib/libm/machine/spu/headers/copysign.h new file mode 100644 index 000000000..ba1c64a5c --- /dev/null +++ b/newlib/libm/machine/spu/headers/copysign.h @@ -0,0 +1,48 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _COPYSIGN_H_ +#define _COPYSIGN_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* copysign - produces a value with the magnitude of x and the + * sign of y. + */ +static __inline double _copysign(double x, double y) +{ + return (spu_extract(spu_sel(spu_promote(x, 0), spu_promote(y, 0), + VEC_SPLAT_U64(0x8000000000000000ULL)), 0)); +} + +#endif /* _COPYSIGN_H_ */ diff --git a/newlib/libm/machine/spu/headers/copysignf.h b/newlib/libm/machine/spu/headers/copysignf.h new file mode 100644 index 000000000..490cf0f02 --- /dev/null +++ b/newlib/libm/machine/spu/headers/copysignf.h @@ -0,0 +1,48 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _COPYSIGNF_H_ +#define _COPYSIGNF_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* copysign - produces a value with the magnitude of x and the + * sign of y. + */ +static __inline float _copysignf(float x, float y) +{ + return (spu_extract(spu_sel(spu_promote(x, 0), spu_promote(y, 0), + VEC_SPLAT_U32(0x80000000)), 0)); +} + +#endif /* _COPYSIGNF_H_ */ diff --git a/newlib/libm/machine/spu/headers/exp2f.h b/newlib/libm/machine/spu/headers/exp2f.h new file mode 100644 index 000000000..84bccdc04 --- /dev/null +++ b/newlib/libm/machine/spu/headers/exp2f.h @@ -0,0 +1,124 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _EXP2F_H_ +#define _EXP2F_H_ 1 + +#ifndef M_LN2 +#define M_LN2 0.69314718055994530942 /* ln(2) */ +#endif /* M_LN2 */ + +/* + * FUNCTION + * float _exp2f(float x) + * + * DESCRIPTION + * _exp2f computes 2 raised to the input x. Computation is + * performed by observing the 2^(a+b) = 2^a * 2^b. + * We decompose x into a and b (above) by letting. + * a = ceil(x), b = x - a; + * + * 2^a is easilty computed by placing a into the exponent + * or a floating point number whose mantissa is all zeros. + * + * 2^b is computed using the following polynomial approximation. + * (C. Hastings, Jr, 1955). + * + * __7__ + * \ + * \ + * 2^x = / Ci*x^i + * /____ + * i=0 + * + * for x in the range 0.0 to 1.0 + * + * C0 = 1.0 + * C1 = -0.9999999995 + * C2 = 0.4999999206 + * C3 = -0.1666653019 + * C4 = 0.0416573475 + * C5 = -0.0083013598 + * C6 = 0.0013298820 + * C7 = -0.0001413161 + * + */ +static __inline float _exp2f(float x) +{ + union { + float f; + unsigned int ui; + } bias, exp_int, exp_frac; + unsigned int overflow, underflow; + int ix; + float frac, frac2, frac4; + float hi, lo; + + /* Break in the input x into two parts ceil(x), x - ceil(x). + */ + bias.f = x; + bias.ui = ~(unsigned int)((signed)(bias.ui) >> 31) & 0x3F7FFFFF; + ix = (int)(x + bias.f); + frac = (float)ix - x; + frac *= (float)(M_LN2); + + exp_int.ui = (ix + 127) << 23; + + overflow = (ix > 128) ? 0x7FFFFFFF : 0x0; + underflow = (ix < -127) ? 0xFFFFFFFF : 0x0; + + /* Instruction counts can be reduced if the polynomial was + * computed entirely from nested (dependent) fma's. However, + * to reduce the number of pipeline stalls, the polygon is evaluated + * in two halves (hi amd lo). + */ + frac2 = frac * frac; + frac4 = frac2 * frac2; + hi = -0.0001413161f * frac + 0.0013298820f; + hi = hi * frac - 0.0083013598f; + hi = hi * frac + 0.0416573475f; + lo = -0.1666653019f * frac + 0.4999999206f; + lo = lo * frac - 0.9999999995f; + lo = lo * frac + 1.0f; + exp_frac.f = hi * frac4 + lo; + + ix += exp_frac.ui >> 23; + exp_frac.f *= exp_int.f; + + exp_frac.ui = (exp_frac.ui | overflow) & ~underflow; + + return (exp_frac.f); +} + +#endif /* _EXP2F_H_ */ + + diff --git a/newlib/libm/machine/spu/headers/expf.h b/newlib/libm/machine/spu/headers/expf.h new file mode 100644 index 000000000..dd3c8c6c1 --- /dev/null +++ b/newlib/libm/machine/spu/headers/expf.h @@ -0,0 +1,58 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _EXPF_H_ +#define _EXPF_H_ 1 + +#include "exp2f.h" + +#ifndef M_LOG2E +#define M_LOG2E 1.4426950408889634074 +#endif /* M_LOG2E */ + +/* + * FUNCTION + * float _expf(float x) + * + * DESCRIPTION + * _expf computes e raised to the input x. expf is + * computed using exp2f as e^x = 2^(log2(e)*x) + */ + +static __inline float _expf(float x) +{ + return (_exp2f((float)(M_LOG2E) * x)); +} + +#endif /* _EXPF_H_ */ + + diff --git a/newlib/libm/machine/spu/headers/fabs.h b/newlib/libm/machine/spu/headers/fabs.h new file mode 100644 index 000000000..1b9cfddc2 --- /dev/null +++ b/newlib/libm/machine/spu/headers/fabs.h @@ -0,0 +1,58 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _FABS_H_ +#define _FABS_H_ 1 + +/* + * FUNCTION + * double _fabs(double value) + * + * DESCRIPTION + * The _fabsf routine returns the absolute value of the floating-point + * input value "value". This is accomplished by zeroing the most + * significant bit (ie, the sign bit) of the floating-point value. + */ + +#include +#include "headers/vec_literal.h" + +static __inline double _fabs(double x) +{ + vec_ullong2 vx; + + vx = (vec_ullong2)spu_promote(x, 0); + vx = spu_andc(vx, VEC_SPLAT_U64(0x8000000000000000ULL)); + + return (spu_extract((vec_double2)vx, 0)); +} +#endif /* _FABS_H_ */ diff --git a/newlib/libm/machine/spu/headers/fabsf.h b/newlib/libm/machine/spu/headers/fabsf.h new file mode 100644 index 000000000..f6d0a2e03 --- /dev/null +++ b/newlib/libm/machine/spu/headers/fabsf.h @@ -0,0 +1,60 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _FABSF_H_ +#define _FABSF_H_ 1 + +/* + * FUNCTION + * float _fabsf(float value) + * + * DESCRIPTION + * The _fabsf routine returns the absolute value of the floating-point + * input value "value". This is accomplished by zeroing the most + * significant bit (ie, the sign bit) of the floating-point value. + */ + +static __inline float _fabsf(float value) +{ + union { + unsigned int ui; + float f; + } in; + + in.f = value; + in.ui = (in.ui << 1) >> 1; + + return (in.f); +} +#endif /* _FABSF_H_ */ + + diff --git a/newlib/libm/machine/spu/headers/fdim.h b/newlib/libm/machine/spu/headers/fdim.h new file mode 100644 index 000000000..8359d880a --- /dev/null +++ b/newlib/libm/machine/spu/headers/fdim.h @@ -0,0 +1,52 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _FDIM_H_ +#define _FDIM_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* fdim - compute the positive difference of x and y. + */ +static __inline double _fdim(double x, double y) +{ + vec_double2 v; + vec_uint4 mask; + + v = spu_promote(x - y, 0); + mask = (vec_uint4)spu_shuffle(v, v, VEC_SPLAT_U8(0)); + v = spu_andc(v, (vec_double2)spu_rlmaska(mask, -31)); + + return (spu_extract(v, 0)); +} +#endif /* _FDIM_H_ */ diff --git a/newlib/libm/machine/spu/headers/fdimf.h b/newlib/libm/machine/spu/headers/fdimf.h new file mode 100644 index 000000000..89a98ef4b --- /dev/null +++ b/newlib/libm/machine/spu/headers/fdimf.h @@ -0,0 +1,49 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _FDIMF_H_ +#define _FDIMF_H_ 1 + +#include + +/* fdim - compute the positive difference of x and y. + */ +static __inline float _fdimf(float x, float y) +{ + vec_float4 vx, vy; + + vx = spu_promote(x, 0); + vy = spu_promote(y, 0); + return (spu_extract(spu_and(spu_sub(vx, vy), + (vec_float4)spu_cmpgt(vx, vy)), 0)); +} +#endif /* _FDIMF_H_ */ diff --git a/newlib/libm/machine/spu/headers/floor.h b/newlib/libm/machine/spu/headers/floor.h new file mode 100644 index 000000000..6675b948d --- /dev/null +++ b/newlib/libm/machine/spu/headers/floor.h @@ -0,0 +1,94 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _FLOOR_H_ +#define _FLOOR_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* Round the input downwards to the nearest integer. + */ +static __inline double _floor(double x) +{ + vec_uchar16 swap_words = VEC_LITERAL(vec_uchar16, 4,5,6,7, 0,1,2,3, 12,13,14,15, 8,9,10,11); + vec_uchar16 splat_hi = VEC_LITERAL(vec_uchar16, 0,1,2,3,0,1,2,3, 8,9,10,11, 8,9,10,11); + vec_uint4 one = VEC_LITERAL(vec_uint4, 0, 1, 0, 1); + vec_int4 exp, shift; + vec_uint4 mask, mask_1, frac_mask, addend, insert, pos, equal0; + vec_ullong2 sign = VEC_SPLAT_U64(0x8000000000000000ULL); + vec_double2 in, in_hi, out; + vec_double2 minus_one = VEC_SPLAT_F64(-1.0); + + in = spu_promote(x, 0); + + /* This function generates the following component + * based upon the inputs. + * + * mask = bits of the input that need to be replaced. + * insert = value of the bits that need to be replaced + * addend = value to be added to perform function. + * + * These are applied as follows:. + * + * out = ((in & mask) | insert) + addend + */ + in_hi = spu_shuffle(in, in, splat_hi); + pos = spu_cmpgt((vec_int4)in_hi, -1); + exp = spu_and(spu_rlmask((vec_int4)in_hi, -20), 0x7FF); + shift = spu_sub(VEC_LITERAL(vec_int4, 1023, 1043, 1023, 1043), exp); + + /* clamp shift to the range 0 to -31. + */ + shift = spu_sel(VEC_SPLAT_S32(-32), spu_andc(shift, (vec_int4)spu_cmpgt(shift, 0)), spu_cmpgt(shift, -32)); + + frac_mask = spu_rlmask(VEC_LITERAL(vec_uint4, 0xFFFFF, -1, 0xFFFFF, -1), shift); + mask = spu_orc(frac_mask, spu_cmpgt(exp, 0x3FE)); + + /* addend = ((in & mask) && (in >= 0)) ? mask+1 : 0 + */ + mask_1 = spu_addx(mask, one, spu_rlqwbyte(spu_genc(mask, one), 4)); + + equal0 = spu_cmpeq(spu_and((vec_uint4)in, mask), 0); + addend = spu_andc(spu_andc(mask_1, pos), + spu_and(equal0, spu_shuffle(equal0, equal0, swap_words))); + + insert = spu_andc(spu_andc((vec_uint4)minus_one, pos), + spu_cmpgt((vec_uint4)spu_add(exp, -1), 1022)); + + in = spu_sel(in, (vec_double2)insert, spu_andc((vec_ullong2)mask, sign)); + out = (vec_double2)spu_addx((vec_uint4)in, addend, + spu_rlqwbyte(spu_genc((vec_uint4)in, addend), 4)); + + return (spu_extract(out, 0)); +} +#endif /* _FLOOR_H_ */ diff --git a/newlib/libm/machine/spu/headers/floorf.h b/newlib/libm/machine/spu/headers/floorf.h new file mode 100644 index 000000000..e6cc0f89e --- /dev/null +++ b/newlib/libm/machine/spu/headers/floorf.h @@ -0,0 +1,123 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _FLOORF_H_ +#define _FLOORF_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* + * FUNCTION + * float _floorf(float value) + * + * DESCRIPTION + * The _floorf routine round the input value "value" downwards to the + * nearest integer returning the result as a float. Two forms of the + * floor function are provided - full range and limited (integer) + * range. + * + * The full range form (default) provides floor computation on + * all IEEE floating point values. The floor of NANs remain NANs. + * The floor of denorms results in zero. + * + * The limited range form (selected by defining FLOOR_INTEGER_RANGE) + * compute ths floor of all floating-point values in the 32-bit + * signed integer range. Values outside this range get clamped. + */ + +static __inline float _floorf(float value) +{ +#ifdef FLOOR_INTEGER_RANGE + /* 32-BIT INTEGER DYNAMIC RANGE + */ + union { + float f; + signed int i; + unsigned int ui; + } bias; + + bias.f = value; + + /* If positive, bias the input value to truncate towards + * positive infinity, instead of zero. + */ + bias.ui = (unsigned int)(bias.i >> 31) & 0x3F7FFFFF; + value -= bias.f; + + /* Remove fraction bits by casting to an integer and back + * to a floating-point value. + */ + return ((float)((int)value)); + +#else /* !FLOOR_INTEGER_RANGE */ + /* FULL FLOATING-POINT RANGE + */ + vec_int4 exp, shift; + vec_uint4 mask, frac_mask, addend, insert, pos; + vec_float4 in, out; + + in = spu_promote(value, 0); + + /* This function generates the following component + * based upon the inputs. + * + * mask = bits of the input that need to be replaced. + * insert = value of the bits that need to be replaced + * addend = value to be added to perform function. + * + * These are applied as follows:. + * + * out = ((in & mask) | insert) + addend + */ + pos = spu_cmpgt((vec_int4)in, -1); + exp = spu_and(spu_rlmask((vec_int4)in, -23), 0xFF); + + shift = spu_sub(127, exp); + + frac_mask = spu_and(spu_rlmask(VEC_SPLAT_U32(0x7FFFFF), shift), + spu_cmpgt((vec_int4)shift, -31)); + + mask = spu_orc(frac_mask, spu_cmpgt(exp, 126)); + + addend = spu_andc(spu_andc(spu_add(mask, 1), pos), + spu_cmpeq(spu_and((vec_uint4)in, mask), 0)); + + insert = spu_andc(spu_andc(VEC_SPLAT_U32(0xBF800000), pos), + spu_cmpgt((vec_uint4)spu_add(exp, -1), 126)); + + out = (vec_float4)spu_add(spu_sel((vec_uint4)in, insert, mask), addend); + + return (spu_extract(out, 0)); +#endif /* FLOOR_INTEGER_RANGE */ +} +#endif /* _FLOORF_H_ */ diff --git a/newlib/libm/machine/spu/headers/fma.h b/newlib/libm/machine/spu/headers/fma.h new file mode 100644 index 000000000..c3e910696 --- /dev/null +++ b/newlib/libm/machine/spu/headers/fma.h @@ -0,0 +1,49 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ + +#ifndef _FMA_H_ +#define _FMA_H_ 1 + +#include + +static __inline double _fma(double x, double y, double z) +{ + vec_double2 vx, vy, vz, vout;; + + vx = spu_promote(x, 0); + vy = spu_promote(y, 0); + vz = spu_promote(z, 0); + vout = spu_madd(vx, vy, vz); + return (spu_extract(vout, 0)); +} +#endif /* _FMA_H_ */ diff --git a/newlib/libm/machine/spu/headers/fmaf.h b/newlib/libm/machine/spu/headers/fmaf.h new file mode 100644 index 000000000..7ae09e337 --- /dev/null +++ b/newlib/libm/machine/spu/headers/fmaf.h @@ -0,0 +1,43 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _FMAF_H_ +#define _FMAF_H_ 1 + +#include + +static __inline float _fmaf(float x, float y, float z) +{ + return (spu_extract(spu_madd(spu_promote(x, 0), spu_promote(y, 0), + spu_promote(z, 0)), 0)); +} +#endif /* _FMAF_H_ */ diff --git a/newlib/libm/machine/spu/headers/fmax.h b/newlib/libm/machine/spu/headers/fmax.h new file mode 100644 index 000000000..f3e3358e6 --- /dev/null +++ b/newlib/libm/machine/spu/headers/fmax.h @@ -0,0 +1,75 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _FMAX_H_ +#define _FMAX_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* Return the maximum numeric value of their arguments. If one argument + * is a NaN, fmax returns the other value. If both are NaNs, then a NaN + * is returned. + * + * Notes: + * 1) Double precision denorms equate to zero so two denorms compare + * equal thereby making the following true for two denorm inputs + * fmax(a, b) != fmax(b, a); + */ +static __inline double _fmax(double x, double y) +{ + vec_uint4 nan_x, selector, abs_x, gt, eq; + vec_uint4 sign = VEC_LITERAL(vec_uint4, 0x80000000, 0, 0x80000000, 0); + vec_uint4 infinity = VEC_LITERAL(vec_uint4, 0x7FF00000, 0, 0x7FF00000, 0); + vec_double2 vx, vy, diff, max; + + vx = spu_promote(x, 0); + vy = spu_promote(y, 0); + + /* If x is a NaN, then select y as max + */ + abs_x = spu_andc((vec_uint4)vx, sign); + gt = spu_cmpgt(abs_x, infinity); + eq = spu_cmpeq(abs_x, infinity); + + nan_x = spu_or(gt, spu_and(eq, spu_rlqwbyte(gt, 4))); + + diff = spu_sub(vx, vy); + selector = spu_orc(nan_x, spu_cmpgt((vec_int4)diff, -1)); + selector = spu_maskw(spu_extract(selector, 0)); + + max = spu_sel(vx, vy, (vec_ullong2)selector); + + return (spu_extract(max, 0)); +} + +#endif /* _FMAX_H_ */ diff --git a/newlib/libm/machine/spu/headers/fmaxf.h b/newlib/libm/machine/spu/headers/fmaxf.h new file mode 100644 index 000000000..e1c2352f2 --- /dev/null +++ b/newlib/libm/machine/spu/headers/fmaxf.h @@ -0,0 +1,48 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _FMAXF_H_ +#define _FMAXF_H_ 1 + +#include + +/* Return the maximum numeric value of their arguments. + */ +static __inline float _fmaxf(float x, float y) +{ + vec_float4 vx, vy; + + vx = spu_promote(x, 0); + vy = spu_promote(y, 0); + return (spu_extract(spu_sel(vx, vy, spu_cmpgt(vy, vx)), 0)); +} +#endif /* _FMAXF_H_ */ diff --git a/newlib/libm/machine/spu/headers/fmin.h b/newlib/libm/machine/spu/headers/fmin.h new file mode 100644 index 000000000..45db5191e --- /dev/null +++ b/newlib/libm/machine/spu/headers/fmin.h @@ -0,0 +1,75 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _FMIN_H_ +#define _FMIN_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* Return the minimum numeric value of their arguments. If one argument + * is a NaN, fmin returns the other value. If both are NaNs, then a NaN + * is returned. + * + * Notes: + * 1) Double precision denorms equate to zero so two denorms compare + * equal thereby making the following true for two denorm inputs + * fmin(a, b) != fmin(b, a); + */ + +static __inline double _fmin(double x, double y) +{ + vec_uint4 nan_x, selector, abs_x, gt, eq; + vec_uint4 sign = VEC_LITERAL(vec_uint4, 0x80000000, 0, 0x80000000, 0); + vec_uint4 infinity = VEC_LITERAL(vec_uint4, 0x7FF00000, 0, 0x7FF00000, 0); + vec_double2 vx, vy, diff, min; + + vx = spu_promote(x, 0); + vy = spu_promote(y, 0); + + /* If x is a NaN, then select y as min + */ + abs_x = spu_andc((vec_uint4)vx, sign); + gt = spu_cmpgt(abs_x, infinity); + eq = spu_cmpeq(abs_x, infinity); + + nan_x = spu_or(gt, spu_and(eq, spu_rlqwbyte(gt, 4))); + + diff = spu_sub(vy, vx); + selector = spu_orc(nan_x, spu_cmpgt((vec_int4)diff, -1)); + selector = spu_maskw(spu_extract(selector, 0)); + + min = spu_sel(vx, vy, (vec_ullong2)selector); + + return (spu_extract(min, 0)); +} +#endif /* _FMIN_H_ */ diff --git a/newlib/libm/machine/spu/headers/fminf.h b/newlib/libm/machine/spu/headers/fminf.h new file mode 100644 index 000000000..56fa556af --- /dev/null +++ b/newlib/libm/machine/spu/headers/fminf.h @@ -0,0 +1,48 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _FMINF_H_ +#define _FMINF_H_ 1 + +#include + +/* Return the minimum numeric value of their arguments. + */ +static __inline float _fminf(float x, float y) +{ + vec_float4 vx, vy; + + vx = spu_promote(x, 0); + vy = spu_promote(y, 0); + return (spu_extract(spu_sel(vx, vy, spu_cmpgt(vx, vy)), 0)); +} +#endif /* _FMINF_H_ */ diff --git a/newlib/libm/machine/spu/headers/fmod.h b/newlib/libm/machine/spu/headers/fmod.h new file mode 100644 index 000000000..1506fb8dc --- /dev/null +++ b/newlib/libm/machine/spu/headers/fmod.h @@ -0,0 +1,152 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _FMOD_H_ +#define _FMOD_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* This implementation returns zero if y is a denorm or zero. + */ +static __inline double _fmod(double x, double y) +{ + int n, shift; + vec_uchar16 swap_words = VEC_LITERAL(vec_uchar16, 4,5,6,7, 0,1,2,3, 12,13,14,15, 8,9,10,11); + vec_uchar16 propagate = VEC_LITERAL(vec_uchar16, 4,5,6,7, 192,192,192,192, 12,13,14,15, 192,192,192,192); + vec_uchar16 splat_hi = VEC_LITERAL(vec_uchar16, 0,1,2,3,0,1,2,3, 8,9,10,11, 8,9,10,11); + vec_uint4 vx, vy, z; + vec_uint4 x_hi, y_hi; + vec_uint4 abs_x, abs_y; + vec_uint4 exp_x, exp_y; + vec_uint4 zero_x, zero_y; + vec_uint4 logb_x, logb_y; + vec_uint4 mant_x, mant_y; + vec_uint4 normal, norm, denorm; + vec_uint4 result, result0, resultx, cnt, sign, borrow; + vec_uint4 lsb = (vec_uint4)(VEC_SPLAT_U64(0x0000000000000001ULL)); + vec_uint4 sign_mask = (vec_uint4)(VEC_SPLAT_U64(0x8000000000000000ULL)); + vec_uint4 implied_1 = (vec_uint4)(VEC_SPLAT_U64(0x0010000000000000ULL)); + vec_uint4 mant_mask = (vec_uint4)(VEC_SPLAT_U64(0x000FFFFFFFFFFFFFULL)); + + vx = (vec_uint4)spu_promote(x, 0); + vy = (vec_uint4)spu_promote(y, 0); + + abs_x = spu_andc(vx, sign_mask); + abs_y = spu_andc(vy, sign_mask); + + sign = spu_and(vx, sign_mask); + + x_hi = spu_shuffle(abs_x, abs_x, splat_hi); + y_hi = spu_shuffle(abs_y, abs_y, splat_hi); + + /* Determine ilogb of abs_x and abs_y and + * extract the mantissas (mant_x, mant_y) + */ + exp_x = spu_rlmask(x_hi, -20); + exp_y = spu_rlmask(y_hi, -20); + + resultx = spu_cmpgt(y_hi, x_hi); + + zero_x = spu_cmpeq(exp_x, 0); + zero_y = spu_cmpeq(exp_y, 0); + + logb_x = spu_add(exp_x, -1023); + logb_y = spu_add(exp_y, -1023); + + mant_x = spu_andc(spu_sel(implied_1, abs_x, mant_mask), zero_x); + mant_y = spu_andc(spu_sel(implied_1, abs_y, mant_mask), zero_y); + + /* Compute fixed point fmod of mant_x and mant_y. Set the flag, + * result0, to all ones if we detect that the final result is + * ever 0. + */ + result0 = spu_or(zero_x, zero_y); + + n = spu_extract(spu_sub(logb_x, logb_y), 0); + + while (n-- > 0) { + borrow = spu_genb(mant_x, mant_y); + borrow = spu_shuffle(borrow, borrow, propagate); + z = spu_subx(mant_x, mant_y, borrow); + + result0 = spu_or(spu_cmpeq(spu_or(z, spu_shuffle(z, z, swap_words)), 0), result0); + + mant_x = spu_sel(spu_slqw(mant_x, 1), spu_andc(spu_slqw(z, 1), lsb), + spu_cmpgt((vec_int4)spu_shuffle(z, z, splat_hi), -1)); + } + + borrow = spu_genb(mant_x, mant_y); + borrow = spu_shuffle(borrow, borrow, propagate); + z = spu_subx(mant_x, mant_y, borrow); + + mant_x = spu_sel(mant_x, z, + spu_cmpgt((vec_int4)spu_shuffle(z, z, splat_hi), -1)); + mant_x = spu_andc(mant_x, VEC_LITERAL(vec_uint4, 0,0,-1,-1)); + + result0 = spu_or(spu_cmpeq(spu_or(mant_x, spu_shuffle(mant_x, mant_x, swap_words)), 0), result0); + + /* Convert the result back to floating point and restore + * the sign. If we flagged the result to be zero (result0), + * zero it. If we flagged the result to equal its input x, + * (resultx) then return x. + * + * Double precision generates a denorm for an output. + */ + cnt = spu_cntlz(mant_x); + cnt = spu_add(cnt, spu_and(spu_rlqwbyte(cnt, 4), spu_cmpeq(cnt, 32))); + cnt = spu_add(spu_shuffle(cnt, cnt, splat_hi), -11); + + shift = spu_extract(exp_y, 0) - 1; + denorm = spu_slqwbytebc(spu_slqw(mant_x, shift), shift); + + exp_y = spu_sub(exp_y, cnt); + + normal = spu_cmpgt((vec_int4)exp_y, 0); + + /* Normalize normal results, denormalize denorm results. + */ + shift = spu_extract(cnt, 0); + norm = spu_slqwbytebc(spu_slqw(spu_andc(mant_x, VEC_LITERAL(vec_uint4, 0x00100000, 0, -1, -1)), shift), shift); + + mant_x = spu_sel(denorm, norm, normal); + + exp_y = spu_and(spu_rl(exp_y, 20), normal); + + result = spu_sel(exp_y, spu_or(sign, mant_x), VEC_LITERAL(vec_uint4, 0x800FFFFF, -1, 0x800FFFFF, -1)); + + result = spu_sel(spu_andc(result, spu_rlmask(result0, -1)), vx, + resultx); + + return (spu_extract((vec_double2)result, 0)); +} +#endif /* _FMOD_H_ */ diff --git a/newlib/libm/machine/spu/headers/fmodf.h b/newlib/libm/machine/spu/headers/fmodf.h new file mode 100644 index 000000000..496ada490 --- /dev/null +++ b/newlib/libm/machine/spu/headers/fmodf.h @@ -0,0 +1,156 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _FMODF_H_ +#define _FMODF_H_ 1 + +#include +#include "headers/vec_literal.h" + +#include "fabsf.h" + +/* + * FUNCTION + * float _fmodf(float x, float y) + * + * DESCRIPTION + * The _fmodf subroutine computes the remainder of + * dividing x by y. The return value is x - n*y, where n is + * the quotient of x/y, rounded towards zero. + * + * The full range form (default) provides fmod computation on + * all IEEE floating point values (excluding floating overflow + * or underflow). + * + * The limited range form (selected by defining FMODF_INTEGER_RANGE) + * compute fmod of all floating-point x/y values in the 32-bit + * signed integer range. Values outside this range get clamped. + */ + +static __inline float _fmodf(float x, float y) +{ +#ifdef FMODF_INTEGER_RANGE + /* 32-BIT INTEGER DYNAMIC RANGE + */ + float abs_y; + float quotient; + + abs_y = _fabsf(y); + quotient = x/abs_y; + + return (abs_y*(quotient - ((float)((int)quotient)))); + +#else /* !FMODF_INTEGER_RANGE */ + /* FULL FLOATING-POINT RANGE + */ + int n; + vec_uint4 vx, vy, z; + vec_uint4 abs_x, abs_y; + vec_uint4 exp_x, exp_y; + vec_uint4 zero_x, zero_y; + vec_uint4 logb_x, logb_y; + vec_uint4 mant_x, mant_y; + vec_uint4 result, result0, resultx, cnt, sign; + vec_uint4 sign_mask = VEC_SPLAT_U32(0x80000000); + vec_uint4 implied_1 = VEC_SPLAT_U32(0x00800000); + vec_uint4 mant_mask = VEC_SPLAT_U32(0x007FFFFF); + + vx = (vec_uint4)spu_promote(x, 0); + vy = (vec_uint4)spu_promote(y, 0); + + abs_x = spu_andc(vx, sign_mask); + abs_y = spu_andc(vy, sign_mask); + + sign = spu_and(vx, sign_mask); + + /* Determine ilogb of abs_x and abs_y and + * extract the mantissas (mant_x, mant_y) + */ + exp_x = spu_rlmask(abs_x, -23); + exp_y = spu_rlmask(abs_y, -23); + + resultx = spu_cmpgt(abs_y, abs_x); + + zero_x = spu_cmpeq(exp_x, 0); + zero_y = spu_cmpeq(exp_y, 0); + + logb_x = spu_add(exp_x, -127); + logb_y = spu_add(exp_y, -127); + + mant_x = spu_andc(spu_sel(implied_1, abs_x, mant_mask), zero_x); + mant_y = spu_andc(spu_sel(implied_1, abs_y, mant_mask), zero_y); + + /* Compute fixed point fmod of mant_x and mant_y. Set the flag, + * result0, to all ones if we detect that the final result is + * ever 0. + */ + result0 = spu_or(zero_x, zero_y); + + n = spu_extract(spu_sub(logb_x, logb_y), 0); + + while (n-- > 0) { + z = spu_sub(mant_x, mant_y); + + result0 = spu_or(spu_cmpeq(z, 0), result0); + + mant_x = spu_sel(spu_add(mant_x, mant_x), spu_add(z, z), + spu_cmpgt((vec_int4)z, -1)); + } + + z = spu_sub(mant_x, mant_y); + mant_x = spu_sel(mant_x, z, spu_cmpgt((vec_int4)z, -1)); + + result0 = spu_or(spu_cmpeq(mant_x, 0), result0); + + /* Convert the result back to floating point and restore + * the sign. If we flagged the result to be zero (result0), + * zero it. If we flagged the result to equal its input x, + * (resultx) then return x. + */ + cnt = spu_add(spu_cntlz(mant_x), -8); + + mant_x = spu_rl(spu_andc(mant_x, implied_1), (vec_int4)cnt); + + exp_y = spu_sub(exp_y, cnt); + result0 = spu_orc(result0, spu_cmpgt((vec_int4)exp_y, 0)); /* zero denorm results */ + exp_y = spu_rl(exp_y, 23); + + + result = spu_sel(exp_y, spu_or(sign, mant_x), VEC_SPLAT_U32(0x807FFFFF)); + + result = spu_sel(spu_andc(result, spu_rlmask(result0, -1)), vx, + resultx); + + return (spu_extract((vec_float4)result, 0)); +#endif /* FMODF_INTEGER_RANGE */ +} +#endif /* _FMODF_H_ */ diff --git a/newlib/libm/machine/spu/headers/frexp.h b/newlib/libm/machine/spu/headers/frexp.h new file mode 100644 index 000000000..8b525c76e --- /dev/null +++ b/newlib/libm/machine/spu/headers/frexp.h @@ -0,0 +1,74 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _FREXP_H_ +#define _FREXP_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* Return the normalized fraction and exponent to the number x. + * Double precision denorms treated as zero and return a 0 + * fraction and 0 exponent. The results are undefined for infinities + * and NaNs (double precision only). + */ +static __inline double _frexp(double x, int *pexp) +{ + vec_int4 exp; + vec_uint4 denorm, mask; + vec_double2 in, mant; + vec_double2 half = VEC_SPLAT_F64(0.5); + vec_ullong2 exp_mask = VEC_SPLAT_U64(0x7FF0000000000000ULL); + + in = spu_promote(x, 0); + + /* Normalize the mantissa (fraction part). + */ + mant = spu_sel(in, half, exp_mask); + + /* Zero the mantissa if the input is a denorm or zero + */ + exp = spu_and(spu_rlmask((vec_int4)in, -20), 0x7FF); + denorm = spu_cmpeq(exp, 0); + mask = spu_shuffle(denorm, denorm, VEC_SPLAT_U8(0)); + mant = spu_andc(mant, (vec_double2)mask); + + /* Zero exponent if zero or denorm input. Otherwise, compute + * exponent by removing the bias. + */ + exp = spu_andc(spu_add(exp, -1022), (vec_int4)mask); + + *pexp = spu_extract(exp, 0); + + return (spu_extract(mant, 0)); +} +#endif /* _FREXPF_H_ */ diff --git a/newlib/libm/machine/spu/headers/frexpf.h b/newlib/libm/machine/spu/headers/frexpf.h new file mode 100644 index 000000000..5de31da98 --- /dev/null +++ b/newlib/libm/machine/spu/headers/frexpf.h @@ -0,0 +1,69 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _FREXPF_H_ +#define _FREXPF_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* Return the normalized fraction and exponent to the number x. + */ +static __inline float _frexpf(float x, int *pexp) +{ + vec_int4 exp; + vec_uint4 mask; + vec_uint4 exp_mask = VEC_SPLAT_U32(0x7F800000); + vec_float4 half = VEC_SPLAT_F32(0.5f); + vec_float4 in, mant; + + in = spu_promote(x, 0); + + /* Normalize the mantissa (fraction part). + */ + mant = spu_sel(in, half, exp_mask); + + /* Zero the mantissa if the input is a denorm or zero + */ + exp = spu_and(spu_rlmask((vec_int4)in, -23), 0xFF); + mask = spu_cmpeq(exp, 0); + mant = spu_andc(mant, (vec_float4)mask); + + /* Zero exponent if zero or denorm input. Otherwise, compute + * exponent by removing the bias. + */ + exp = spu_andc(spu_add(exp, -126), (vec_int4)mask); + *pexp = spu_extract(exp, 0); + + return (spu_extract(mant, 0)); +} +#endif /* _FREXPF_H_ */ diff --git a/newlib/libm/machine/spu/headers/ilogb.h b/newlib/libm/machine/spu/headers/ilogb.h new file mode 100644 index 000000000..c0699a19a --- /dev/null +++ b/newlib/libm/machine/spu/headers/ilogb.h @@ -0,0 +1,86 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _ILOGB_H_ +#define _ILOGB_H_ 1 + +#include +#include "headers/vec_literal.h" +#include +#include + +/* ilogb returns the signed exponent in the floating-point + * input. Special numbers include: + * Input Output + * ===== ===================== + * INF FP_ILOGBNAN (INT_MAX) + * NAN FP_ILOGBNAN (INT_MAX) + * denorm exponent - leading zeros + * 0 FP_ILOGB0 (INT_MIN) + * else signed exponent + */ + +static __inline int _ilogb(double x) +{ + vec_uint4 v, exp, exp_0, mant, mask, count; + vec_uint4 flg_exp_0, flg_exp_max; + + mask = VEC_SPLAT_U32(0x7FF); + + /* Extract the exponent and mantissa. + */ + v = (vec_uint4)spu_promote(x, 0); + + exp = spu_and(spu_rlmask(v, -20), mask); + + mant = spu_and(v, VEC_LITERAL(vec_uint4, 0x000FFFFF, 0xFFFFFFFF, 0, 0)); + + /* Count the leading zeros in the mantissa for denorm handling + * and zero identification. + */ + count = spu_cntlz(mant); + count = spu_add(count, spu_and(spu_rlqwbyte(count, 4), spu_cmpeq(count, 32))); + + flg_exp_0 = spu_cmpeq(exp, 0); + flg_exp_max = spu_cmpeq(exp, mask); + + exp = spu_add(exp, -1023); + + /* Determine the exponent if the input is a denorm or zero. + */ + exp_0 = spu_sel(spu_sub(spu_add(exp, 12), count), VEC_SPLAT_U32(FP_ILOGB0), spu_cmpeq(count, 64)); + + exp = spu_sel(spu_sel(exp, VEC_SPLAT_U32(FP_ILOGBNAN), flg_exp_max), exp_0, flg_exp_0); + + return (spu_extract((vec_int4)(exp), 0)); +} +#endif /* _ILOGB_H_ */ diff --git a/newlib/libm/machine/spu/headers/ilogbf.h b/newlib/libm/machine/spu/headers/ilogbf.h new file mode 100644 index 000000000..5c591f04f --- /dev/null +++ b/newlib/libm/machine/spu/headers/ilogbf.h @@ -0,0 +1,53 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _ILOGBF_H_ +#define _ILOGBF_H_ 1 + +#include +#include +#include +#include "headers/vec_literal.h" + +/* Single precision floats do not support infinities and NANs, and + * denorms are treated as zero. + */ +static __inline int _ilogbf(float x) +{ + vec_uint4 v, exp; + + v = (vec_uint4)spu_promote(x, 0); + exp = spu_and(spu_rlmask(v, -23), 0xFF); + exp = spu_sel(spu_add(exp, -127), VEC_SPLAT_U32(FP_ILOGB0), spu_cmpeq(exp, 0)); + return (spu_extract((vec_int4)(exp), 0)); +} +#endif /* _ILOGBF_H_ */ diff --git a/newlib/libm/machine/spu/headers/ldexp.h b/newlib/libm/machine/spu/headers/ldexp.h new file mode 100644 index 000000000..811059c1d --- /dev/null +++ b/newlib/libm/machine/spu/headers/ldexp.h @@ -0,0 +1,83 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _LDEXP_H_ +#define _LDEXP_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* ldexp computes x * 2^exp. This function variant computes the result + * and handles overflow, underflow, and denorms by breaking the problem + * into: + * exp = MAX(exp, -2044) + * exp = MIN(exp, 2046) + * e1 = exp / 2 + * e2 = exp - e1; + * x * 2^e1 * 2^e2 + */ +static __inline double _ldexp(double x, int exp) +{ + vec_int4 e, e1, e2; + vec_int4 min = VEC_SPLAT_S32(-2044); + vec_int4 max = VEC_SPLAT_S32(2046); + vec_uint4 cmp_min, cmp_max; + vec_uint4 shift = VEC_LITERAL(vec_uint4, 20, 32, 20, 32); + vec_double2 f1, f2; + vec_double2 in, out; + + in = spu_promote(x, 0); + e = spu_promote(exp, 0); + + /* Clamp the specified exponent to the range -2044 to 2046. + */ + cmp_min = spu_cmpgt(e, min); + cmp_max = spu_cmpgt(e, max); + e = spu_sel(min, e, cmp_min); + e = spu_sel(e, max, cmp_max); + + /* Generate the factors f1 = 2^e1 and f2 = 2^e2 + */ + e1 = spu_rlmaska(e, -1); + e2 = spu_sub(e, e1); + + f1 = (vec_double2)spu_sl(spu_add(e1, 1023), shift); + f2 = (vec_double2)spu_sl(spu_add(e2, 1023), shift); + + /* Compute the product x * 2^e1 * 2^e2 + */ + out = spu_mul(spu_mul(in, f1), f2); + + return (spu_extract(out, 0)); +} + +#endif /* _LDEXP_H_ */ diff --git a/newlib/libm/machine/spu/headers/ldexpf.h b/newlib/libm/machine/spu/headers/ldexpf.h new file mode 100644 index 000000000..f04f85345 --- /dev/null +++ b/newlib/libm/machine/spu/headers/ldexpf.h @@ -0,0 +1,77 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _LDEXPF_H_ +#define _LDEXPF_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* ldexpf computes x * 2^exp. This function is computed without + * the assistence of any floating point operations and as such does + * not set any floating point exceptions. + */ +static __inline float _ldexpf(float x, int exp) +{ + vec_int4 x_exp; + vec_uint4 zero, overflow; + vec_uint4 exp_mask = VEC_SPLAT_U32(0x7F800000); + vec_float4 in, out; + + in = spu_promote(x, 0); + + /* Extract exponent from x. If the exponent is 0, then + * x is either 0 or a denorm and x*2^exp is a zero. + */ + x_exp = spu_and(spu_rlmask((vec_int4)in, -23), 0xFF); + + zero = spu_cmpeq(x_exp, 0); + + /* Compute the expected exponent and determine if the + * result is within range. + */ + x_exp = spu_add(spu_promote(exp, 0), x_exp); + + zero = spu_orc(zero, spu_cmpgt(x_exp, 0)); + + overflow = spu_rlmask(spu_cmpgt(x_exp, 255), -1); + + /* Merge the expect exponent with x's mantissa. Zero the + * result if underflow and force to max if overflow. + */ + out = spu_sel(in, (vec_float4)spu_rl(x_exp, 23), exp_mask); + out = spu_andc(out, (vec_float4)zero); + out = spu_or(out, (vec_float4)overflow); + + return (spu_extract(out, 0)); +} +#endif /* _LDEXPF_H_ */ diff --git a/newlib/libm/machine/spu/headers/llrint.h b/newlib/libm/machine/spu/headers/llrint.h new file mode 100644 index 000000000..656322255 --- /dev/null +++ b/newlib/libm/machine/spu/headers/llrint.h @@ -0,0 +1,85 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _LLRINT_H_ +#define _LLRINT_H_ 1 + +#include +#include "headers/vec_literal.h" + +static __inline long long int _llrint(double x) +{ + int shift; + vec_int4 exp; + vec_uint4 mant, sign, mask, borrow; + vec_double2 in, bias; + + in = spu_promote(x, 0); + + /* Round the input according to the current rounding mode. + */ + bias = spu_sel((vec_double2)(VEC_SPLAT_U64(0x4330000000000000ULL)), in, + VEC_SPLAT_U64(0x8000000000000000ULL)); + mant = (vec_uint4)(spu_sub(spu_add(in, bias), bias)); + + /* Determine how many bits to shift the mantissa to correctly + * align it into long long element 0. + */ + exp = spu_and(spu_rlmask((vec_int4)mant, -20), 0x7FF); + exp = spu_add(exp, -1011); + shift = spu_extract(exp, 0); + + mask = spu_cmpgt(exp, 0); + mask = (vec_uint4)spu_maskw(spu_extract(mask, 0)); + + /* Algn mantissa bits + */ + mant = spu_sel(spu_rlmaskqwbyte(mant, -8), VEC_SPLAT_U32(0x00100000), + VEC_LITERAL(vec_uint4, 0,0,0xFFF00000,0)); + + mant = spu_and(spu_slqwbytebc(spu_slqw(mant, shift), shift), mask); + + /* Compute the two's complement of the mantissa if the + * input is negative. + */ + sign = spu_maskw(spu_extract(spu_rlmaska((vec_int4)in, -31), 0)); + + mant = spu_xor(mant, sign); + borrow = spu_genb(mant, sign); + borrow = spu_shuffle(borrow, borrow, + VEC_LITERAL(vec_uchar16, 4,5,6,7, 192,192,192,192, + 4,5,6,7, 192,192,192,192)); + mant = spu_subx(mant, sign, borrow); + + return (spu_extract((vec_llong2)(mant), 0)); +} +#endif /* _LLRINT_H_ */ diff --git a/newlib/libm/machine/spu/headers/llrintf.h b/newlib/libm/machine/spu/headers/llrintf.h new file mode 100644 index 000000000..76b6d70ef --- /dev/null +++ b/newlib/libm/machine/spu/headers/llrintf.h @@ -0,0 +1,80 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _LLRINTF_H_ +#define _LLRINTF_H_ 1 + +#include +#include "headers/vec_literal.h" + +static __inline long long int _llrintf(float x) +{ + int shift; + vec_int4 exp; + vec_uint4 mant, sign, borrow; + vec_float4 in; + + in = spu_promote(x, 0); + + /* Place mantissa bits (including implied most signficant + * bit) into the most significant bits of element 3. Elements + * 0, 1, and 2 are zeroed. + */ + mant = spu_sel(spu_rlmaskqwbyte((vec_uint4)in, -11), + VEC_SPLAT_U32(0x80000000), + VEC_LITERAL(vec_uint4, 0,0,0xFF,0x800000FF)); + + /* Determine how many bits to shift the mantissa to correctly + * align it into long long element 0. + */ + exp = spu_and(spu_rlmask((vec_int4)in, -23), 0xFF); + shift = spu_extract(spu_add(exp, -94), 0); + + /* Algn mantissa bits + */ + mant = spu_slqwbytebc(spu_slqw(mant, shift), shift); + + /* Compute the two's complement of the mantissa if the + * input is negative. + */ + sign = spu_maskw(spu_extract(spu_rlmaska((vec_int4)in, -31), 0)); + + mant = spu_xor(mant, sign); + borrow = spu_genb(mant, sign); + borrow = spu_shuffle(borrow, borrow, + VEC_LITERAL(vec_uchar16, 4,5,6,7, 192,192,192,192, + 4,5,6,7, 192,192,192,192)); + mant = spu_subx(mant, sign, borrow); + + return (spu_extract((vec_llong2)(mant), 0)); +} +#endif /* _LLRINTF_H_ */ diff --git a/newlib/libm/machine/spu/headers/llround.h b/newlib/libm/machine/spu/headers/llround.h new file mode 100644 index 000000000..04969503b --- /dev/null +++ b/newlib/libm/machine/spu/headers/llround.h @@ -0,0 +1,85 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _LLROUND_H_ +#define _LLROUND_H_ 1 + +#include +#include "headers/vec_literal.h" + +static __inline long long int _llround(double x) +{ + int shift; + vec_int4 exp; + vec_uint4 mant, sign, mask, borrow, addend; + vec_double2 in; + + in = spu_promote(x, 0); + + /* Determine how many bits to shift the mantissa to correctly + * align it into long long element 0. + */ + exp = spu_and(spu_rlmask((vec_int4)in, -20), 0x7FF); + exp = spu_add(exp, -1011); + shift = spu_extract(exp, 0); + + mask = spu_cmpgt(exp, 0); + mask = (vec_uint4)spu_maskw(spu_extract(mask, 0)); + + /* Algn mantissa bits + */ + mant = spu_sel(spu_rlmaskqwbyte((vec_uint4)in, -8), VEC_SPLAT_U32(0x00100000), + VEC_LITERAL(vec_uint4, 0,0,0xFFF00000,0)); + + mant = spu_and(spu_slqwbytebc(spu_slqw(mant, shift), shift), mask); + + /* Perform round by adding 1 if the fraction bits are + * greater than or equal to .5 + */ + addend = spu_and(spu_rlqw(mant, 1), VEC_LITERAL(vec_uint4, 0,1,0,0)); + mant = spu_addx(mant, addend, spu_rlqwbyte(spu_genc(mant, addend), 4)); + + /* Compute the two's complement of the mantissa if the + * input is negative. + */ + sign = spu_maskw(spu_extract(spu_rlmaska((vec_int4)in, -31), 0)); + + mant = spu_xor(mant, sign); + borrow = spu_genb(mant, sign); + borrow = spu_shuffle(borrow, borrow, + VEC_LITERAL(vec_uchar16, 4,5,6,7, 192,192,192,192, + 4,5,6,7, 192,192,192,192)); + mant = spu_subx(mant, sign, borrow); + + return (spu_extract((vec_llong2)(mant), 0)); +} +#endif /* _LLROUND_H_ */ diff --git a/newlib/libm/machine/spu/headers/llroundf.h b/newlib/libm/machine/spu/headers/llroundf.h new file mode 100644 index 000000000..cfdebba2a --- /dev/null +++ b/newlib/libm/machine/spu/headers/llroundf.h @@ -0,0 +1,87 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _LLROUNDF_H_ +#define _LLROUNDF_H_ 1 + +#include +#include "headers/vec_literal.h" + +static __inline long long int _llroundf(float x) +{ + int shift; + vec_int4 exp; + vec_uint4 mant, sign, borrow; + vec_float4 in; + + in = spu_promote(x, 0); + + /* Place mantissa bits (including implied most signficant + * bit) into the most significant bits of element 3. Elements + * 0, 1, and 2 are zeroed. + */ + mant = spu_sel(spu_rlmaskqwbyte((vec_uint4)in, -11), + VEC_SPLAT_U32(0x80000000), + VEC_LITERAL(vec_uint4, 0,0,0xFF,0x800000FF)); + + /* Determine how many bits to shift the mantissa to correctly + * align it into long long element 0. + */ + exp = spu_and(spu_rlmask((vec_int4)in, -23), 0xFF); + shift = spu_extract(spu_add(exp, -94), 0); + + /* Algn mantissa bits + */ + mant = spu_slqwbytebc(spu_slqw(mant, shift), shift); + + /* Perform round by adding 1 if the fraction bits are + * greater than or equal to .5 + */ + mant = spu_add(mant, spu_and(spu_rlqw(mant, 1), VEC_LITERAL(vec_uint4, 0,1,0,0))); + + /* Compute the two's complement of the mantissa if the + * input is negative. + */ + sign = spu_maskw(spu_extract(spu_rlmaska((vec_int4)in, -31), 0)); + + mant = spu_xor(mant, sign); + borrow = spu_genb(mant, sign); + + borrow = spu_shuffle(borrow, borrow, + VEC_LITERAL(vec_uchar16, 4,5,6,7, 192,192,192,192, + 4,5,6,7, 192,192,192,192)); + mant = spu_subx(mant, sign, borrow); + + return (spu_extract((vec_llong2)(mant), 0)); +} + +#endif /* _LLROUNDF_H_ */ diff --git a/newlib/libm/machine/spu/headers/log10f.h b/newlib/libm/machine/spu/headers/log10f.h new file mode 100644 index 000000000..202cb7c0d --- /dev/null +++ b/newlib/libm/machine/spu/headers/log10f.h @@ -0,0 +1,54 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _LOG10F_H_ +#define _LOG10F_H_ 1 + +#include "log2f.h" + +/* + * FUNCTION + * float _log10f(float x) + * + * DESCRIPTION + * _log10f computes log (base 10) of the input value x. log10 + * is computed using log2 as follows: + * + * log10f(x) = log2(x) / log2(10); + */ + +static __inline float _log10f(float x) +{ + return (_log2f(x) * 0.30102999566398f); +} + +#endif /* _LOG10F_H_ */ diff --git a/newlib/libm/machine/spu/headers/log2f.h b/newlib/libm/machine/spu/headers/log2f.h new file mode 100644 index 000000000..b72665fd4 --- /dev/null +++ b/newlib/libm/machine/spu/headers/log2f.h @@ -0,0 +1,115 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _LOG2F_H_ +#define _LOG2F_H_ 1 + +/* + * FUNCTION + * float _log2f(float x) + * + * DESCRIPTION + * _log2f computes log (base 2) of the input value x. The log2f + * function is approximated as a polynomial of order 8 + * (C. Hastings, Jr, 1955). + * + * __8__ + * \ + * \ + * log2f(1+x) = / Ci*x^i + * /____ + * i=1 + * + * for x in the range 0.0 to 1.0 + * + * C1 = 1.4426898816672 + * C2 = -0.72116591947498 + * C3 = 0.47868480909345 + * C4 = -0.34730547155299 + * C5 = 0.24187369696082 + * C6 = -0.13753123777116 + * C7 = 0.052064690894143 + * C8 = -0.0093104962134977 + * + * This function assumes that x is a non-zero positive value. + */ + +static __inline float _log2f(float x) +{ + union { + unsigned int ui; + float f; + } in; + int exponent; + float result; + float x2, x4; + float hi, lo; + + in.f = x; + + /* Extract the exponent from the input X. + */ + exponent = (signed)((in.ui >> 23) & 0xFF) - 127; + + /* Compute the remainder after removing the exponent. + */ + in.ui -= exponent << 23; + + /* Calculate the log2 of the remainder using the polynomial + * approximation. + */ + x = in.f - 1.0f; + + /* Instruction counts can be reduced if the polynomial was + * computed entirely from nested (dependent) fma's. However, + * to reduce the number of pipeline stalls, the polygon is evaluated + * in two halves (hi amd lo). + */ + x2 = x * x; + x4 = x2 * x2; + hi = -0.0093104962134977f*x + 0.052064690894143f; + hi = hi*x - 0.13753123777116f; + hi = hi*x + 0.24187369696082f; + hi = hi*x - 0.34730547155299f; + lo = 0.47868480909345f *x - 0.72116591947498f; + lo = lo*x + 1.4426898816672f; + lo = lo*x; + result = hi*x4 + lo; + + /* Add the exponent back into the result. + */ + result += (float)(exponent); + + return (result); +} + +#endif /* _LOG2F_H_ */ diff --git a/newlib/libm/machine/spu/headers/logf.h b/newlib/libm/machine/spu/headers/logf.h new file mode 100644 index 000000000..e841d2135 --- /dev/null +++ b/newlib/libm/machine/spu/headers/logf.h @@ -0,0 +1,54 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _LOGF_H_ +#define _LOGF_H_ 1 + +#include "log2f.h" + +/* + * FUNCTION + * float _logf(float x) + * + * DESCRIPTION + * _logf computes the natural log (base e) of the input value x. log + * is computed using log2 as follows: + * + * logf(x) = log2f(x) / log2f(e); + */ + +static __inline float _logf(float x) +{ + return (_log2f(x) * 0.69314718055995f); +} + +#endif /* _LOGF_H_ */ diff --git a/newlib/libm/machine/spu/headers/lrint.h b/newlib/libm/machine/spu/headers/lrint.h new file mode 100644 index 000000000..818720a12 --- /dev/null +++ b/newlib/libm/machine/spu/headers/lrint.h @@ -0,0 +1,63 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _LRINT_H_ +#define _LRINT_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* Round the input to the nearest integer according to the current + * rounding mode. + */ +static __inline long int _lrint(double x) +{ + vec_int4 out, sign; + vec_double2 in, addend; + + in = spu_promote(x, 0); + + /* Add 2^53 affect a round to be performed by the hardware. + */ + addend = spu_sel((vec_double2)(VEC_SPLAT_U64(0x4330000000000000ULL)), + in, VEC_SPLAT_U64(0x8000000000000000ULL)); + out = (vec_int4)spu_rlqwbyte(spu_add(in, addend), 4); + + /* Correct the output sign. + */ + sign = spu_rlmaska((vec_int4)in, -31); + + out = spu_sub(spu_xor(out, sign), sign); + + return ((long int)spu_extract(out, 0)); +} +#endif /* _LRINT_H_ */ diff --git a/newlib/libm/machine/spu/headers/lrintf.h b/newlib/libm/machine/spu/headers/lrintf.h new file mode 100644 index 000000000..dc04227bb --- /dev/null +++ b/newlib/libm/machine/spu/headers/lrintf.h @@ -0,0 +1,46 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _LRINTF_H_ +#define _LRINTF_H_ 1 + +#include + +/* Round the input to the nearest integer according to the current + * rounding mode. No special handling is performed when values are + * outside the 32-bit range. + */ +static __inline long int _lrintf(float x) +{ + return ((long int)spu_extract(spu_convts(spu_promote(x, 0), 0), 0)); +} +#endif /* _LRINTF_H_ */ diff --git a/newlib/libm/machine/spu/headers/lround.h b/newlib/libm/machine/spu/headers/lround.h new file mode 100644 index 000000000..2a1e3269a --- /dev/null +++ b/newlib/libm/machine/spu/headers/lround.h @@ -0,0 +1,84 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _LROUND_H_ +#define _LROUND_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* Round the input to the nearest integer value, rounding halfway cases + * away from zero. No special handling is performed when values are + * outside the 32-bit range. + */ + +static __inline long int _lround(double x) +{ + int shift; + vec_int4 exp; + vec_uint4 mant, sign, mask, addend; + vec_double2 in; + + in = spu_promote(x, 0); + + /* Determine how many bits to shift the mantissa to correctly + * align it into long long element 0. + */ + exp = spu_and(spu_rlmask((vec_int4)in, -20), 0x7FF); + exp = spu_add(exp, -979); + shift = spu_extract(exp, 0); + + mask = spu_cmpgt(exp, 0); + + /* Algn mantissa bits + */ + mant = spu_sel(spu_rlmaskqwbyte((vec_uint4)in, -8), VEC_SPLAT_U32(0x00100000), + VEC_LITERAL(vec_uint4, 0,0,0xFFF00000,0)); + + mant = spu_slqwbytebc(spu_slqw(mant, shift), shift); + + /* Perform round by adding 1 if the fraction bits are + * greater than or equal to .5 + */ + addend = spu_and(spu_rlqw(mant, 1), 1); + mant = spu_and(spu_add(mant, addend), mask); + + /* Compute the two's complement of the mantissa if the + * input is negative. + */ + sign = (vec_uint4)spu_rlmaska((vec_int4)in, -31); + + mant = spu_sub(spu_xor(mant, sign), sign); + + return ((long int)spu_extract(mant, 0)); +} +#endif /* _LROUND_H_ */ diff --git a/newlib/libm/machine/spu/headers/lroundf.h b/newlib/libm/machine/spu/headers/lroundf.h new file mode 100644 index 000000000..b9651a56a --- /dev/null +++ b/newlib/libm/machine/spu/headers/lroundf.h @@ -0,0 +1,56 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _LROUNDF_H_ +#define _LROUNDF_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* Round the input to the nearest integer value, rounding halfway cases + * away from zero. No special handling is performed when values are + * outside the 32-bit range. + */ +static __inline long int _lroundf(float x) +{ + vec_int4 out; + vec_float4 in, addend; + + in = spu_promote(x, 0); + + /* Add signed 0.5 */ + addend = spu_sel(VEC_SPLAT_F32(0.5f), in, VEC_SPLAT_U32(0x80000000)); + out = spu_convts(spu_add(in, addend), 0); + + return ((long int)spu_extract(out, 0)); +} +#endif /* _LROUNDF_H_ */ diff --git a/newlib/libm/machine/spu/headers/nearbyint.h b/newlib/libm/machine/spu/headers/nearbyint.h new file mode 100644 index 000000000..beef45932 --- /dev/null +++ b/newlib/libm/machine/spu/headers/nearbyint.h @@ -0,0 +1,64 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _NEARBYINT_H_ +#define _NEARBYINT_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* Round the input to the nearest integer according to the current + * rounding mode without raising an inexact exception. + */ +static __inline double _nearbyint(double x) +{ + vec_uint4 fpscr; + vec_ullong2 sign = VEC_SPLAT_U64(0x8000000000000000ULL); + vec_double2 in, out, addend; + + fpscr = spu_mffpscr(); + + in = spu_promote(x, 0); + + /* Add 2^53 and then subtract 2^53 to affect a round to be performed by the + * hardware. Also preserve the input sign so that negative inputs that + * round to zero generate a -0.0. + */ + addend = spu_sel((vec_double2)(VEC_SPLAT_U64(0x4330000000000000ULL)), + in, sign); + out = spu_sel(spu_sub(spu_add(in, addend), addend), in, sign); + + spu_mtfpscr(fpscr); + + return (spu_extract(out, 0)); +} +#endif /* _NEARBYINT_H_ */ diff --git a/newlib/libm/machine/spu/headers/remainder.h b/newlib/libm/machine/spu/headers/remainder.h new file mode 100644 index 000000000..bdcffa0d3 --- /dev/null +++ b/newlib/libm/machine/spu/headers/remainder.h @@ -0,0 +1,192 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _REMAINDER_H_ +#define _REMAINDER_H_ 1 + +#include +#include "headers/vec_literal.h" + +static __inline double _remainder(double x, double y) +{ + int n, shift; + vec_uchar16 swap_words = VEC_LITERAL(vec_uchar16, 4,5,6,7, 0,1,2,3, 12,13,14,15, 8,9,10,11); + vec_uchar16 propagate = VEC_LITERAL(vec_uchar16, 4,5,6,7, 192,192,192,192, 12,13,14,15, 192,192,192,192); + vec_uchar16 splat_hi = VEC_LITERAL(vec_uchar16, 0,1,2,3,0,1,2,3, 8,9,10,11, 8,9,10,11); + vec_uchar16 splat_lo = VEC_LITERAL(vec_uchar16, 4,5,6,7,4,5,6,7, 12,13,14,15, 12,13,14,15); + vec_uint4 vx, vy, z; + vec_uint4 x_hi, y_hi, y_lo; + vec_uint4 abs_x, abs_y, abs_2x, abs_2y; + vec_uint4 exp_x, exp_y; + vec_uint4 zero_x, zero_y; + vec_uint4 logb_x, logb_y; + vec_uint4 mant_x, mant_y; + vec_uint4 normal, norm, denorm; + vec_uint4 gt, eq, bias, y2_hi; + vec_uint4 nan_out; + vec_uint4 result, result0, resultx, cnt, sign, borrow; + vec_uint4 exp_special = VEC_SPLAT_U32(0x7FF00000); + vec_uint4 half_smax = VEC_SPLAT_U32(0x7FEFFFFF); + vec_uint4 lsb = (vec_uint4)(VEC_SPLAT_U64(0x0000000000000001ULL)); + vec_uint4 sign_mask = (vec_uint4)(VEC_SPLAT_U64(0x8000000000000000ULL)); + vec_uint4 implied_1 = (vec_uint4)(VEC_SPLAT_U64(0x0010000000000000ULL)); + vec_uint4 mant_mask = (vec_uint4)(VEC_SPLAT_U64(0x000FFFFFFFFFFFFFULL)); + + vx = (vec_uint4)spu_promote(x, 0); + vy = (vec_uint4)spu_promote(y, 0); + + abs_x = spu_andc(vx, sign_mask); + abs_y = spu_andc(vy, sign_mask); + + abs_2y = spu_add(abs_y, implied_1); + + sign = spu_and(vx, sign_mask); + + + /* Compute abs_x = fmodf(abs_x, 2*abs_y). If y is greater than 0.5*SMAX (SMAX is the maximum + * representable float), then return abs_x. + */ + { + x_hi = spu_shuffle(abs_x, abs_x, splat_hi); + y_lo = spu_shuffle(abs_y, abs_y, splat_lo); + y_hi = spu_shuffle(abs_y, abs_y, splat_hi); + y2_hi = spu_shuffle(abs_2y, abs_2y, splat_hi); + + /* Force a NaN output if (1) abs_x is infinity or NaN or (2) + * abs_y is a NaN. + */ + nan_out = spu_or(spu_cmpgt(x_hi, half_smax), + spu_or(spu_cmpgt(y_hi, exp_special), + spu_and(spu_cmpeq(y_hi, exp_special), + spu_cmpgt(y_lo, 0)))); + + /* Determine ilogb of abs_x and abs_y and + * extract the mantissas (mant_x, mant_y) + */ + exp_x = spu_rlmask(x_hi, -20); + exp_y = spu_rlmask(y2_hi, -20); + + resultx = spu_or(spu_cmpgt(y2_hi, x_hi), spu_cmpgt(y_hi, half_smax)); + + zero_x = spu_cmpeq(exp_x, 0); + zero_y = spu_cmpeq(exp_y, 0); + + logb_x = spu_add(exp_x, -1023); + logb_y = spu_add(exp_y, -1023); + + mant_x = spu_andc(spu_sel(implied_1, abs_x, mant_mask), zero_x); + mant_y = spu_andc(spu_sel(implied_1, abs_2y, mant_mask), zero_y); + + /* Compute fixed point fmod of mant_x and mant_y. Set the flag, + * result0, to all ones if we detect that the final result is + * ever 0. + */ + result0 = spu_or(zero_x, zero_y); + + n = spu_extract(spu_sub(logb_x, logb_y), 0); + + while (n-- > 0) { + borrow = spu_genb(mant_x, mant_y); + borrow = spu_shuffle(borrow, borrow, propagate); + z = spu_subx(mant_x, mant_y, borrow); + + result0 = spu_or(spu_cmpeq(spu_or(z, spu_shuffle(z, z, swap_words)), 0), result0); + + mant_x = spu_sel(spu_slqw(mant_x, 1), spu_andc(spu_slqw(z, 1), lsb), spu_cmpgt((vec_int4)spu_shuffle(z, z, splat_hi), -1)); + } + + + borrow = spu_genb(mant_x, mant_y); + borrow = spu_shuffle(borrow, borrow, propagate); + z = spu_subx(mant_x, mant_y, borrow); + + mant_x = spu_sel(mant_x, z, spu_cmpgt((vec_int4)spu_shuffle(z, z, splat_hi), -1)); + mant_x = spu_andc(mant_x, VEC_LITERAL(vec_uint4, 0,0,-1,-1)); + + result0 = spu_or(spu_cmpeq(spu_or(mant_x, spu_shuffle(mant_x, mant_x, swap_words)), 0), result0); + + /* Convert the result back to floating point and restore + * the sign. If we flagged the result to be zero (result0), + * zero it. If we flagged the result to equal its input x, + * (resultx) then return x. + * + * Double precision generates a denorm for an output. + */ + cnt = spu_cntlz(mant_x); + cnt = spu_add(cnt, spu_and(spu_rlqwbyte(cnt, 4), spu_cmpeq(cnt, 32))); + cnt = spu_add(spu_shuffle(cnt, cnt, splat_hi), -11); + + shift = spu_extract(exp_y, 0) - 1; + denorm = spu_slqwbytebc(spu_slqw(mant_x, shift), shift); + + exp_y = spu_sub(exp_y, cnt); + + normal = spu_cmpgt((vec_int4)exp_y, 0); + + /* Normalize normal results, denormalize denorm results. + */ + shift = spu_extract(cnt, 0); + norm = spu_slqwbytebc(spu_slqw(spu_andc(mant_x, VEC_LITERAL(vec_uint4, 0x00100000, 0, -1, -1)), shift), shift); + + mant_x = spu_sel(denorm, norm, normal); + + exp_y = spu_and(spu_rl(exp_y, 20), normal); + + result = spu_sel(exp_y, mant_x, mant_mask); + + abs_x = spu_sel(spu_andc(result, spu_rlmask(result0, -1)), abs_x, resultx); + + } + + /* if (2*x > y) + * x -= y + * if (2*x >= y) x -= y + */ + abs_2x = spu_and(spu_add(abs_x, implied_1), normal); + + gt = spu_cmpgt(abs_2x, abs_y); + eq = spu_cmpeq(abs_2x, abs_y); + bias = spu_or(gt, spu_and(eq, spu_rlqwbyte(gt, 4))); + bias = spu_shuffle(bias, bias, splat_hi); + abs_x = spu_sel(abs_x, (vec_uint4)spu_sub((vec_double2)abs_x, (vec_double2)abs_y), bias); + + bias = spu_andc(bias, spu_rlmaska((vec_uint4)spu_msub((vec_double2)abs_x, VEC_SPLAT_F64(2.0), (vec_double2)abs_y), -31)); + bias = spu_shuffle(bias, bias, splat_hi); + abs_x = spu_sel(abs_x, (vec_uint4)spu_sub((vec_double2)abs_x, (vec_double2)abs_y), bias); + + /* Generate a correct final sign + */ + result = spu_sel(spu_xor(abs_x, sign), exp_special, nan_out); + + return (spu_extract((vec_double2)result, 0)); +} +#endif /* _REMAINDER_H_ */ diff --git a/newlib/libm/machine/spu/headers/remainderf.h b/newlib/libm/machine/spu/headers/remainderf.h new file mode 100644 index 000000000..b610b673e --- /dev/null +++ b/newlib/libm/machine/spu/headers/remainderf.h @@ -0,0 +1,141 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _REMAINDERF_H_ +#define _REMAINDERF_H_ 1 + +#include +#include "headers/vec_literal.h" + +static __inline float _remainderf(float x, float y) +{ + int n; + vec_uint4 vx, vy, z; + vec_uint4 abs_x, abs_y, abs_2x, abs_2y; + vec_uint4 exp_x, exp_y; + vec_uint4 zero_x, zero_y; + vec_uint4 logb_x, logb_y; + vec_uint4 mant_x, mant_y; + vec_uint4 result, result0, resultx, cnt, sign, bias; + vec_uint4 sign_mask = VEC_SPLAT_U32(0x80000000); + vec_uint4 implied_1 = VEC_SPLAT_U32(0x00800000); + vec_uint4 mant_mask = VEC_SPLAT_U32(0x007FFFFF); + vec_float4 two = { 2.0f, 2.0f, 2.0f, 2.0f }; + + vx = (vec_uint4)spu_promote(x, 0); + vy = (vec_uint4)spu_promote(y, 0); + + abs_x = spu_andc(vx, sign_mask); + abs_y = spu_andc(vy, sign_mask); + + abs_2y = spu_add(abs_y, implied_1); /* abs_2y = 2 * abs_y */ + + sign = spu_and(vx, sign_mask); + + /* Compute abs_x = fmodf(abs_x, 2*abs_y). If y is greater than 0.5*SMAX + * (SMAX is the maximum representable float), then return abs_x. + */ + { + /* Determine ilogb of abs_x and abs_2y and + * extract the mantissas (mant_x, mant_y) + */ + exp_x = spu_rlmask(abs_x, -23); + exp_y = spu_rlmask(abs_2y, -23); + + resultx = spu_or(spu_cmpgt(abs_2y, abs_x), spu_cmpgt(abs_y, VEC_SPLAT_U32(0x7F7FFFFF))); + + zero_x = spu_cmpeq(exp_x, 0); + zero_y = spu_cmpeq(exp_y, 0); + + logb_x = spu_add(exp_x, -127); + logb_y = spu_add(exp_y, -127); + + mant_x = spu_andc(spu_sel(implied_1, abs_x, mant_mask), zero_x); + mant_y = spu_andc(spu_sel(implied_1, abs_2y, mant_mask), zero_y); + + /* Compute fixed point fmod of mant_x and mant_y. Set the flag, + * result0, to all ones if we detect that the final result is + * ever 0. + */ + result0 = spu_or(zero_x, zero_y); + + n = spu_extract(spu_sub(logb_x, logb_y), 0); + + + while (n-- > 0) { + z = spu_sub(mant_x, mant_y); + + result0 = spu_or(spu_cmpeq(z, 0), result0); + + mant_x = spu_sel(spu_add(mant_x, mant_x), spu_add(z, z), + spu_cmpgt((vec_int4)z, -1)); + } + + z = spu_sub(mant_x, mant_y); + mant_x = spu_sel(mant_x, z, spu_cmpgt((vec_int4)z, -1)); + + result0 = spu_or(spu_cmpeq(mant_x, 0), result0); + + /* Convert the result back to floating point and restore + * the sign. If we flagged the result to be zero (result0), + * zero it. If we flagged the result to equal its input x, + * (resultx) then return x. + */ + cnt = spu_add(spu_cntlz(mant_x), -8); + + mant_x = spu_rl(spu_andc(mant_x, implied_1), (vec_int4)cnt); + + exp_y = spu_sub(exp_y, cnt); + result0 = spu_orc(result0, spu_cmpgt((vec_int4)exp_y, 0)); /* zero denorm results */ + exp_y = spu_rl(exp_y, 23); + + result = spu_sel(exp_y, mant_x, mant_mask); + abs_x = spu_sel(spu_andc(result, spu_rlmask(result0, -1)), abs_x, resultx); + } + + /* if (2*x > y) + * x -= y + * if (2*x >= y) x -= y + */ + abs_2x = spu_add(abs_x, implied_1); + bias = spu_cmpgt(abs_2x, abs_y); + abs_x = spu_sel(abs_x, (vec_uint4)spu_sub((vec_float4)abs_x, (vec_float4)abs_y), bias); + bias = spu_andc(bias, spu_rlmaska((vec_uint4)spu_msub((vec_float4)abs_x, two, (vec_float4)abs_y), -31)); + abs_x = spu_sel(abs_x, (vec_uint4)spu_sub((vec_float4)abs_x, (vec_float4)abs_y), bias); + + /* Generate a correct final sign + */ + result = spu_xor(abs_x, sign); + + return (spu_extract((vec_float4)result, 0)); +} +#endif /* _REMAINDERF_H_ */ diff --git a/newlib/libm/machine/spu/headers/remquo.h b/newlib/libm/machine/spu/headers/remquo.h new file mode 100644 index 000000000..fd6a5aae6 --- /dev/null +++ b/newlib/libm/machine/spu/headers/remquo.h @@ -0,0 +1,239 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _REMQUO_H_ +#define _REMQUO_H_ 1 + +#include +#include "headers/vec_literal.h" + +static __inline double _remquo(double x, double y, int *quo) +{ + int n, shift; + vec_uchar16 swap_words = VEC_LITERAL(vec_uchar16, 4,5,6,7, 0,1,2,3, 12,13,14,15, 8,9,10,11); + vec_uchar16 propagate = VEC_LITERAL(vec_uchar16, 4,5,6,7, 192,192,192,192, 12,13,14,15, 192,192,192,192); + vec_uchar16 splat_hi = VEC_LITERAL(vec_uchar16, 0,1,2,3,0,1,2,3, 8,9,10,11, 8,9,10,11); + vec_uchar16 splat_lo = VEC_LITERAL(vec_uchar16, 4,5,6,7,4,5,6,7, 12,13,14,15, 12,13,14,15); + vec_int4 quotient; + vec_int4 four = { 4, 4, 4, 4 }; + vec_uint4 vx, vy, z; + vec_uint4 x_hi, y_hi, y8_hi, y_lo, y2, y4; + vec_uint4 abs_x, abs_y, abs_2x, abs_2y, abs_8y; + vec_uint4 exp_x, exp_y; + vec_uint4 zero_x, zero_y; + vec_uint4 logb_x, logb_y; + vec_uint4 mant_x, mant_y; + vec_uint4 normal, norm, denorm; + vec_uint4 gt, eq, bias; + vec_uint4 nan_out, not_ge, quo_pos, overflow; + vec_uint4 result, result0, resultx, cnt, sign, borrow; + vec_uint4 exp_special = VEC_SPLAT_U32(0x7FF00000); + vec_uint4 half_smax = VEC_SPLAT_U32(0x7FEFFFFF); + vec_uint4 lsb = (vec_uint4)(VEC_SPLAT_U64(0x0000000000000001ULL)); + vec_uint4 sign_mask = (vec_uint4)(VEC_SPLAT_U64(0x8000000000000000ULL)); + vec_uint4 implied_1 = (vec_uint4)(VEC_SPLAT_U64(0x0010000000000000ULL)); + vec_uint4 mant_mask = (vec_uint4)(VEC_SPLAT_U64(0x000FFFFFFFFFFFFFULL)); + + vx = (vec_uint4)spu_promote(x, 0); + vy = (vec_uint4)spu_promote(y, 0); + + abs_x = spu_andc(vx, sign_mask); + abs_y = spu_andc(vy, sign_mask); + + abs_2y = spu_add(abs_y, implied_1); + abs_8y = spu_add(abs_y, VEC_LITERAL(vec_uint4, 0x00300000, 0, 0x00300000, 0)); + + sign = spu_and(vx, sign_mask); + + quo_pos = spu_cmpgt((vec_int4)spu_and(spu_xor(vx, vy), sign_mask), -1); + quo_pos = spu_shuffle(quo_pos, quo_pos, splat_hi); + + /* Compute abs_x = fmodf(abs_x, 8*abs_y). If y is greater than 0.125*SMAX + * (SMAX is the maximum representable float), then return abs_x. + */ + { + x_hi = spu_shuffle(abs_x, abs_x, splat_hi); + y_lo = spu_shuffle(abs_y, abs_y, splat_lo); + y_hi = spu_shuffle(abs_y, abs_y, splat_hi); + y8_hi = spu_shuffle(abs_8y, abs_8y, splat_hi); + + /* Force a NaN output if (1) abs_x is infinity or NaN or (2) + * abs_y is a NaN. + */ + nan_out = spu_or(spu_cmpgt(x_hi, half_smax), + spu_or(spu_cmpgt(y_hi, exp_special), + spu_and(spu_cmpeq(y_hi, exp_special), + spu_cmpgt(y_lo, 0)))); + + /* Determine ilogb of abs_x and abs_8y and + * extract the mantissas (mant_x, mant_y) + */ + exp_x = spu_rlmask(x_hi, -20); + exp_y = spu_rlmask(y8_hi, -20); + + resultx = spu_or(spu_cmpgt(y8_hi, x_hi), spu_cmpgt(y_hi, half_smax)); + + zero_x = spu_cmpeq(exp_x, 0); + zero_y = spu_cmpeq(exp_y, 0); + + logb_x = spu_add(exp_x, -1023); + logb_y = spu_add(exp_y, -1023); + + mant_x = spu_andc(spu_sel(implied_1, abs_x, mant_mask), zero_x); + mant_y = spu_andc(spu_sel(implied_1, abs_8y, mant_mask), zero_y); + + /* Compute fixed point fmod of mant_x and mant_y. Set the flag, + * result0, to all ones if we detect that the final result is + * ever 0. + */ + result0 = spu_or(zero_x, zero_y); + + n = spu_extract(spu_sub(logb_x, logb_y), 0); + + while (n-- > 0) { + borrow = spu_genb(mant_x, mant_y); + borrow = spu_shuffle(borrow, borrow, propagate); + z = spu_subx(mant_x, mant_y, borrow); + + result0 = spu_or(spu_cmpeq(spu_or(z, spu_shuffle(z, z, swap_words)), 0), result0); + + mant_x = spu_sel(spu_slqw(mant_x, 1), spu_andc(spu_slqw(z, 1), lsb), spu_cmpgt((vec_int4)spu_shuffle(z, z, splat_hi), -1)); + } + + + borrow = spu_genb(mant_x, mant_y); + borrow = spu_shuffle(borrow, borrow, propagate); + z = spu_subx(mant_x, mant_y, borrow); + + mant_x = spu_sel(mant_x, z, spu_cmpgt((vec_int4)spu_shuffle(z, z, splat_hi), -1)); + mant_x = spu_andc(mant_x, VEC_LITERAL(vec_uint4, 0,0,-1,-1)); + + result0 = spu_or(spu_cmpeq(spu_or(mant_x, spu_shuffle(mant_x, mant_x, swap_words)), 0), result0); + + /* Convert the result back to floating point and restore + * the sign. If we flagged the result to be zero (result0), + * zero it. If we flagged the result to equal its input x, + * (resultx) then return x. + * + * Double precision generates a denorm for an output. + */ + cnt = spu_cntlz(mant_x); + cnt = spu_add(cnt, spu_and(spu_rlqwbyte(cnt, 4), spu_cmpeq(cnt, 32))); + cnt = spu_add(spu_shuffle(cnt, cnt, splat_hi), -11); + + shift = spu_extract(exp_y, 0) - 1; + denorm = spu_slqwbytebc(spu_slqw(mant_x, shift), shift); + + exp_y = spu_sub(exp_y, cnt); + + normal = spu_cmpgt((vec_int4)exp_y, 0); + + /* Normalize normal results, denormalize denorm results. + */ + shift = spu_extract(cnt, 0); + norm = spu_slqwbytebc(spu_slqw(spu_andc(mant_x, VEC_LITERAL(vec_uint4, 0x00100000, 0, -1, -1)), shift), shift); + + mant_x = spu_sel(denorm, norm, normal); + + exp_y = spu_and(spu_rl(exp_y, 20), normal); + + result = spu_sel(exp_y, mant_x, mant_mask); + + abs_x = spu_sel(spu_andc(result, spu_rlmask(result0, -1)), abs_x, resultx); + + } + + /* if (x >= 4*y) + * x -= 4*y + * quotient = 4 + * else + * quotient = 0 + */ + y4 = spu_andc(spu_add(abs_y, spu_rl(implied_1, 1)), zero_y); + + overflow = spu_cmpgt(y_hi, VEC_SPLAT_U32(0x7FCFFFFF)); + gt = spu_cmpgt(y4, abs_x); + eq = spu_cmpeq(y4, abs_x); + not_ge = spu_or(gt, spu_and(eq, spu_rlqwbyte(gt, 4))); + not_ge = spu_shuffle(not_ge, not_ge, splat_hi); + not_ge = spu_or(not_ge, overflow); + + abs_x = spu_sel((vec_uint4)spu_sub((vec_double2)abs_x, (vec_double2)y4), abs_x, not_ge); + quotient = spu_andc(four, (vec_int4)not_ge); + + /* if (x >= 2*y + * x -= 2*y + * quotient += 2 + */ + y2 = spu_andc(spu_add(abs_y, implied_1), zero_y); + + overflow = spu_cmpgt(y_hi, VEC_SPLAT_U32(0x7FDFFFFF)); + gt = spu_cmpgt(y2, abs_x); + eq = spu_cmpeq(y2, abs_x); + not_ge = spu_or(gt, spu_and(eq, spu_rlqwbyte(gt, 4))); + not_ge = spu_shuffle(not_ge, not_ge, splat_hi); + not_ge = spu_or(not_ge, overflow); + + + abs_x = spu_sel((vec_uint4)spu_sub((vec_double2)abs_x, (vec_double2)y2), abs_x, not_ge); + quotient = spu_sel(spu_add(quotient, 2), quotient, not_ge); + + /* if (2*x > y) + * x -= y + * if (2*x >= y) x -= y + */ + abs_2x = spu_and(spu_add(abs_x, implied_1), normal); + + gt = spu_cmpgt(abs_2x, abs_y); + eq = spu_cmpeq(abs_2x, abs_y); + bias = spu_or(gt, spu_and(eq, spu_rlqwbyte(gt, 4))); + bias = spu_shuffle(bias, bias, splat_hi); + abs_x = spu_sel(abs_x, (vec_uint4)spu_sub((vec_double2)abs_x, (vec_double2)abs_y), bias); + quotient = spu_sub(quotient, (vec_int4)bias); + + bias = spu_andc(bias, spu_rlmaska((vec_uint4)spu_msub((vec_double2)abs_x, VEC_SPLAT_F64(2.0), (vec_double2)abs_y), -31)); + bias = spu_shuffle(bias, bias, splat_hi); + abs_x = spu_sel(abs_x, (vec_uint4)spu_sub((vec_double2)abs_x, (vec_double2)abs_y), bias); + quotient = spu_sub(quotient, (vec_int4)bias); + + /* Generate a correct final sign + */ + result = spu_sel(spu_xor(abs_x, sign), exp_special, nan_out); + + quotient = spu_and(quotient, 7); + quotient = spu_sel(spu_sub(0, quotient), quotient, quo_pos); + + *quo = spu_extract(quotient, 0); + + return (spu_extract((vec_double2)result, 0)); +} +#endif /* _REMQUO_H_ */ diff --git a/newlib/libm/machine/spu/headers/remquof.h b/newlib/libm/machine/spu/headers/remquof.h new file mode 100644 index 000000000..c48172856 --- /dev/null +++ b/newlib/libm/machine/spu/headers/remquof.h @@ -0,0 +1,178 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _REMQUOF_H_ +#define _REMQUOF_H_ 1 + +#include +#include "headers/vec_literal.h" + + +static __inline float _remquof(float x, float y, int *quo) +{ + int n; + vec_int4 quotient; + vec_int4 four = { 4, 4, 4, 4 }; + vec_uint4 vx, vy, z, y2, y4; + vec_uint4 abs_x, abs_y, abs_2x, abs_8y; + vec_uint4 exp_x, exp_y; + vec_uint4 zero_x, zero_y; + vec_uint4 logb_x, logb_y; + vec_uint4 mant_x, mant_y; + vec_uint4 not_ge, overflow, quo_pos; + vec_uint4 result, result0, resultx, cnt, sign, bias; + vec_uint4 sign_mask = VEC_SPLAT_U32(0x80000000); + vec_uint4 implied_1 = VEC_SPLAT_U32(0x00800000); + vec_uint4 mant_mask = VEC_SPLAT_U32(0x007FFFFF); + + vx = (vec_uint4)spu_promote(x, 0); + vy = (vec_uint4)spu_promote(y, 0); + + abs_x = spu_andc(vx, sign_mask); + abs_y = spu_andc(vy, sign_mask); + + abs_8y = spu_add(abs_y, VEC_SPLAT_U32(0x01800000)); /* abs_2y = 8 * abs_y */ + + sign = spu_and(vx, sign_mask); + + quo_pos = spu_cmpgt((vec_int4)spu_and(spu_xor(vx, vy), sign_mask), -1); + + /* Compute abs_x = fmodf(abs_x, 8*abs_y). If y is greater than 0.125*SMAX + * (SMAX is the maximum representable float), then return abs_x. + */ + { + /* Determine ilogb of abs_x and abs_8y and + * extract the mantissas (mant_x, mant_y) + */ + exp_x = spu_rlmask(abs_x, -23); + exp_y = spu_rlmask(abs_8y, -23); + + resultx = spu_or(spu_cmpgt(abs_8y, abs_x), spu_cmpgt(abs_y, VEC_SPLAT_U32(0x7E7FFFFF))); + + zero_x = spu_cmpeq(exp_x, 0); + zero_y = spu_cmpeq(exp_y, 0); + + logb_x = spu_add(exp_x, -127); + logb_y = spu_add(exp_y, -127); + + mant_x = spu_andc(spu_sel(implied_1, abs_x, mant_mask), zero_x); + mant_y = spu_andc(spu_sel(implied_1, abs_8y, mant_mask), zero_y); + + /* Compute fixed point fmod of mant_x and mant_y. Set the flag, + * result0, to all ones if we detect that the final result is + * ever 0. + */ + result0 = spu_or(zero_x, zero_y); + + n = spu_extract(spu_sub(logb_x, logb_y), 0); + + + while (n-- > 0) { + z = spu_sub(mant_x, mant_y); + + result0 = spu_or(spu_cmpeq(z, 0), result0); + + mant_x = spu_sel(spu_add(mant_x, mant_x), spu_add(z, z), + spu_cmpgt((vec_int4)z, -1)); + } + + z = spu_sub(mant_x, mant_y); + mant_x = spu_sel(mant_x, z, spu_cmpgt((vec_int4)z, -1)); + + result0 = spu_or(spu_cmpeq(mant_x, 0), result0); + + /* Convert the result back to floating point and restore + * the sign. If we flagged the result to be zero (result0), + * zero it. If we flagged the result to equal its input x, + * (resultx) then return x. + */ + cnt = spu_add(spu_cntlz(mant_x), -8); + + mant_x = spu_rl(spu_andc(mant_x, implied_1), (vec_int4)cnt); + + exp_y = spu_sub(exp_y, cnt); + result0 = spu_orc(result0, spu_cmpgt((vec_int4)exp_y, 0)); /* zero denorm results */ + exp_y = spu_rl(exp_y, 23); + + result = spu_sel(exp_y, mant_x, mant_mask); + abs_x = spu_sel(spu_andc(result, spu_rlmask(result0, -1)), abs_x, resultx); + } + + /* if (x >= 4*y) + * x -= 4*y + * quotient = 4 + * else + * quotient = 0 + */ + y4 = spu_andc(spu_add(abs_y, VEC_SPLAT_U32(0x01000000)), zero_y); + + overflow = spu_cmpgt(abs_y, VEC_SPLAT_U32(0x7EFFFFFF)); + not_ge = spu_or(spu_cmpgt(y4, abs_x), overflow); + + abs_x = spu_sel((vec_uint4)spu_sub((vec_float4)abs_x, (vec_float4)y4), abs_x, not_ge); + quotient = spu_andc (four, (vec_int4)not_ge); + + /* if (x >= 2*y + * x -= 2*y + * quotient += 2 + */ + y2 = spu_andc(spu_add(abs_y, implied_1), zero_y); + not_ge = spu_cmpgt(y2, abs_x); + + abs_x = spu_sel((vec_uint4)spu_sub((vec_float4)abs_x, (vec_float4)y2), abs_x, not_ge); + quotient = spu_sel(spu_add(quotient, 2), quotient, not_ge); + + /* if (2*x > y) + * x -= y + * if (2*x >= y) x -= y + */ + abs_2x = spu_add(abs_x, implied_1); + bias = spu_cmpgt(abs_2x, abs_y); + abs_x = spu_sel(abs_x, (vec_uint4)spu_sub((vec_float4)abs_x, (vec_float4)abs_y), bias); + quotient = spu_sub(quotient, (vec_int4)bias); + + bias = spu_andc(bias, spu_rlmaska((vec_uint4)spu_msub((vec_float4)abs_x, VEC_SPLAT_F32(2.0f), (vec_float4)abs_y), -31)); + abs_x = spu_sel(abs_x, (vec_uint4)spu_sub((vec_float4)abs_x, (vec_float4)abs_y), bias); + quotient = spu_sub(quotient, (vec_int4)bias); + + /* Generate a correct final sign + */ + result = spu_xor(abs_x, sign); + + quotient = spu_and(quotient, 7); + quotient = spu_sel(spu_sub(0, quotient), quotient, quo_pos); + + *quo = spu_extract(quotient, 0); + + return (spu_extract((vec_float4)result, 0)); +} +#endif /* _REMQUOF_H_ */ diff --git a/newlib/libm/machine/spu/headers/rint.h b/newlib/libm/machine/spu/headers/rint.h new file mode 100644 index 000000000..7cf7adcfa --- /dev/null +++ b/newlib/libm/machine/spu/headers/rint.h @@ -0,0 +1,59 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _RINT_H_ +#define _RINT_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* Round the input to the nearest integer according to the current + * rounding mode. + */ +static __inline double _rint(double x) +{ + vec_ullong2 sign = VEC_SPLAT_U64(0x8000000000000000ULL); + vec_double2 in, out, addend; + + in = spu_promote(x, 0); + + /* Add 2^53 and then subtract 2^53 to affect a round to be performed by the + * hardware. Also preserve the input sign so that negative inputs that + * round to zero generate a -0.0. + */ + addend = spu_sel((vec_double2)(VEC_SPLAT_U64(0x4330000000000000ULL)), + in, sign); + out = spu_sel(spu_sub(spu_add(in, addend), addend), in, sign); + + return (spu_extract(out, 0)); +} +#endif /* _RINT_H_ */ diff --git a/newlib/libm/machine/spu/headers/round.h b/newlib/libm/machine/spu/headers/round.h new file mode 100644 index 000000000..0943218b6 --- /dev/null +++ b/newlib/libm/machine/spu/headers/round.h @@ -0,0 +1,85 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _ROUND_H_ +#define _ROUND_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* Round the input to the nearest integer, rounding halfway + * cases away from zero. + */ +static __inline double _round(double x) +{ + vec_uchar16 splat_hi = VEC_LITERAL(vec_uchar16, 0,1,2,3,0,1,2,3, 8,9,10,11, 8,9,10,11); + vec_int4 exp, shift; + vec_uint4 sign = VEC_LITERAL(vec_uint4, 0x80000000, 0, 0x80000000, 0); + vec_uint4 or_mask, and_mask, mask, addend; + vec_double2 in, in_hi, out; + + in = spu_promote(x, 0); + + /* Add 0.5 (fixed precision to eliminate rounding issues) + */ + in_hi = spu_shuffle(in, in, splat_hi); + exp = spu_and(spu_rlmask((vec_int4)in_hi, -20), 0x7FF); + + shift = spu_sub(VEC_LITERAL(vec_int4, 1022, 1043, 1022, 1043), exp); + + addend = spu_and(spu_rlmask(VEC_LITERAL(vec_uint4, 0x100000, 0x80000000, + 0x100000, 0x80000000), shift), + spu_cmpgt((vec_uint4)spu_add(shift, -1), -33)); + + in = (vec_double2)spu_addx((vec_uint4)in, addend, + spu_rlqwbyte(spu_genc((vec_uint4)in, addend), 4)); + + /* Truncate the result. + */ + in_hi = spu_shuffle(in, in, splat_hi); + exp = spu_and(spu_rlmask((vec_int4)in_hi, -20), 0x7FF); + + shift = spu_sub(VEC_LITERAL(vec_int4, 1023, 1043, 1023, 1043), exp); + or_mask = spu_andc(spu_cmpgt(shift, 0), sign); + + + and_mask = spu_rlmask(VEC_LITERAL(vec_uint4, 0xFFFFF, -1, 0xFFFFF, -1), + shift); + mask = spu_or(spu_and(and_mask, spu_cmpgt(shift, -31)), or_mask); + + /* Apply the mask and return the result. + */ + out = spu_andc(in, (vec_double2)(mask)); + + return (spu_extract(out, 0)); +} +#endif /* _ROUND_H_ */ diff --git a/newlib/libm/machine/spu/headers/roundf.h b/newlib/libm/machine/spu/headers/roundf.h new file mode 100644 index 000000000..16914d6f9 --- /dev/null +++ b/newlib/libm/machine/spu/headers/roundf.h @@ -0,0 +1,72 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _ROUNDF_H_ +#define _ROUNDF_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* Round the input to the nearest integer, rounding halfway + * cases away from zero. + */ +static __inline float _roundf(float x) +{ + vec_int4 exp; + vec_uint4 or_mask, and_mask, mask, addend; + vec_float4 in, out; + + in = spu_promote(x, 0); + + /* Add 0.5 (fixed precision to eliminate rounding issues) + */ + exp = spu_sub(125, spu_and(spu_rlmask((vec_int4)in, -23), 0xFF)); + + addend = spu_and(spu_rlmask(VEC_SPLAT_U32(0x1000000), exp), + spu_cmpgt((vec_uint4)exp, -31)); + + in = (vec_float4)spu_add((vec_uint4)in, addend); + + /* Truncate the result. + */ + exp = spu_sub(127, spu_and(spu_rlmask((vec_int4)in, -23), 0xFF)); + + or_mask = spu_cmpgt(exp, 0); + and_mask = spu_rlmask(VEC_SPLAT_U32(0x7FFFFF), exp); + + mask = spu_or(spu_and(and_mask, spu_cmpgt(exp, -31)), or_mask); + + out = spu_andc(in, (vec_float4)(mask)); + + return (spu_extract(out, 0)); +} +#endif /* _ROUNDF_H_ */ diff --git a/newlib/libm/machine/spu/headers/scalbn.h b/newlib/libm/machine/spu/headers/scalbn.h new file mode 100644 index 000000000..65802b635 --- /dev/null +++ b/newlib/libm/machine/spu/headers/scalbn.h @@ -0,0 +1,82 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _SCALBN_H_ +#define _SCALBN_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* scalbn computes x * 2^exp. This function variant computes the result + * and handles overflow, underflow, and denorms by breaking the problem + * into: + * exp = MAX(exp, -2044) + * exp = MIN(exp, 2046) + * e1 = exp / 2 + * e2 = exp - e1; + * x * 2^e1 * 2^e2 + */ +static __inline double _scalbn(double x, int exp) +{ + vec_int4 e, e1, e2; + vec_int4 min = VEC_SPLAT_S32(-2044); + vec_int4 max = VEC_SPLAT_S32(2046); + vec_uint4 cmp_min, cmp_max; + vec_uint4 shift = VEC_LITERAL(vec_uint4, 20, 32, 20, 32); + vec_double2 f1, f2; + vec_double2 in, out; + + in = spu_promote(x, 0); + e = spu_promote(exp, 0); + + /* Clamp the specified exponent to the range -2044 to 2046. + */ + cmp_min = spu_cmpgt(e, min); + cmp_max = spu_cmpgt(e, max); + e = spu_sel(min, e, cmp_min); + e = spu_sel(e, max, cmp_max); + + /* Generate the factors f1 = 2^e1 and f2 = 2^e2 + */ + e1 = spu_rlmaska(e, -1); + e2 = spu_sub(e, e1); + + f1 = (vec_double2)spu_sl(spu_add(e1, 1023), shift); + f2 = (vec_double2)spu_sl(spu_add(e2, 1023), shift); + + /* Compute the product x * 2^e1 * 2^e2 + */ + out = spu_mul(spu_mul(in, f1), f2); + + return (spu_extract(out, 0)); +} +#endif /* _SCALBN_H_ */ diff --git a/newlib/libm/machine/spu/headers/scalbnf.h b/newlib/libm/machine/spu/headers/scalbnf.h new file mode 100644 index 000000000..56ed1ef87 --- /dev/null +++ b/newlib/libm/machine/spu/headers/scalbnf.h @@ -0,0 +1,77 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _SCALBNF_H_ +#define _SCALBNF_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* scalbnf computes x * 2^exp. This function is computed without + * the assistence of any floating point operations and as such does + * not set any floating point exceptions. + */ +static __inline float _scalbnf(float x, int exp) +{ + vec_int4 x_exp; + vec_uint4 zero, overflow; + vec_uint4 exp_mask = VEC_SPLAT_U32(0x7F800000); + vec_float4 in, out; + + in = spu_promote(x, 0); + + /* Extract exponent from x. If the exponent is 0, then + * x is either 0 or a denorm and x*2^exp is a zero. + */ + x_exp = spu_and(spu_rlmask((vec_int4)in, -23), 0xFF); + + zero = spu_cmpeq(x_exp, 0); + + /* Compute the expected exponent and determine if the + * result is within range. + */ + x_exp = spu_add(spu_promote(exp, 0), x_exp); + + zero = spu_orc(zero, spu_cmpgt(x_exp, 0)); + + overflow = spu_rlmask(spu_cmpgt(x_exp, 255), -1); + + /* Merge the expect exponent with x's mantissa. Zero the + * result if underflow and force to max if overflow. + */ + out = spu_sel(in, (vec_float4)spu_rl(x_exp, 23), exp_mask); + out = spu_andc(out, (vec_float4)zero); + out = spu_or(out, (vec_float4)overflow); + + return (spu_extract(out, 0)); +} +#endif /* _SCALBNF_H_ */ diff --git a/newlib/libm/machine/spu/headers/sqrt.h b/newlib/libm/machine/spu/headers/sqrt.h new file mode 100644 index 000000000..064c47def --- /dev/null +++ b/newlib/libm/machine/spu/headers/sqrt.h @@ -0,0 +1,129 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _SQRT_H_ +#define _SQRT_H_ 1 + +/* + * FUNCTION + * double _sqrt(double in) + * + * DESCRIPTION + * _sqrt computes the square root of the input "in" and returns the + * result. + */ +#include +#include "headers/vec_literal.h" + +static __inline double _sqrt(double in) +{ + vec_int4 bias_exp; + vec_uint4 exp; + vec_float4 fx, fg, fy, fd, fe, fy2, fhalf; + vec_ullong2 nochange; + vec_ullong2 mask = VEC_SPLAT_U64(0x7FE0000000000000ULL); + vec_double2 x, dx, de, dd, dy, dg, dy2, dhalf; + vec_double2 denorm, neg; + + fhalf = VEC_SPLAT_F32(0.5f); + dhalf = VEC_SPLAT_F64(0.5); + + /* Coerce the input, in, into the argument reduced space [0.5, 2.0). + */ + x = spu_promote(in, 0); + dx = spu_sel(x, dhalf, mask); + + /* Compute an initial single precision guess for the square root (fg) + * and half reciprocal (fy2). + */ + fx = spu_roundtf(dx); + + fy2 = spu_rsqrte(fx); + fy = spu_mul(fy2, fhalf); + fg = spu_mul(fy2, fx); /* 12-bit approximation to sqrt(cx) */ + + /* Perform one single precision Newton-Raphson iteration to improve + * accuracy to about 22 bits. + */ + fe = spu_nmsub(fy, fg, fhalf); + fd = spu_nmsub(fg, fg, fx); + + fy = spu_madd(fy2, fe, fy); + fg = spu_madd(fy, fd, fg); /* 22-bit approximation */ + + dy = spu_extend(fy); + dg = spu_extend(fg); + + /* Perform two double precision Newton-Raphson iteration to improve + * accuracy to about 44 and 88 bits repectively. + */ + dy2 = spu_add(dy, dy); + de = spu_nmsub(dy, dg, dhalf); + dd = spu_nmsub(dg, dg, dx); + dy = spu_madd(dy2, de, dy); + dg = spu_madd(dy, dd, dg); /* 44 bit approximation */ + + dd = spu_nmsub(dg, dg, dx); + dg = spu_madd(dy, dd, dg); /* full double precision approximation */ + + + /* Compute the expected exponent assuming that it is not a special value. + * See special value handling below. + */ + bias_exp = spu_rlmaska(spu_sub((vec_int4)spu_and((vec_ullong2)x, mask), + (vec_int4)VEC_SPLAT_U64(0x3FE0000000000000ULL)), -1); + dg = (vec_double2)spu_add((vec_int4)dg, bias_exp); + + + /* Handle special inputs. These include: + * + * input output + * ========= ========= + * -0 -0 + * +infinity +infinity + * NaN NaN + * <0 NaN + * denorm zero + */ + exp = (vec_uint4)spu_and((vec_ullong2)x, VEC_SPLAT_U64(0xFFF0000000000000ULL)); + exp = spu_shuffle(exp, exp, VEC_LITERAL(vec_uchar16, 0,1,2,3,0,1,2,3, 8,9,10,11,8,9,10,11)); + + neg = (vec_double2)spu_rlmaska((vec_int4)exp, -31); + denorm = (vec_double2)spu_rlmask(spu_cmpeq(spu_sl(exp, 1), 0), VEC_LITERAL(vec_int4, -1,0,-1,0)); + + nochange = (vec_ullong2)spu_cmpeq(exp, 0x7FF00000); + + dg = spu_sel(spu_andc(spu_or(dg, neg), denorm), x, nochange); + + return (spu_extract(dg, 0)); +} +#endif /* _SQRT_H_ */ diff --git a/newlib/libm/machine/spu/headers/trunc.h b/newlib/libm/machine/spu/headers/trunc.h new file mode 100644 index 000000000..1c503c515 --- /dev/null +++ b/newlib/libm/machine/spu/headers/trunc.h @@ -0,0 +1,70 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _TRUNC_H_ +#define _TRUNC_H_ 1 + +#include +#include "headers/vec_literal.h" + +/* Truncate the input downwards to the nearest integer. + */ +static __inline double _trunc(double x) +{ + vec_uchar16 splat_hi = VEC_LITERAL(vec_uchar16, 0,1,2,3,0,1,2,3, 8,9,10,11, 8,9,10,11); + vec_int4 exp, shift; + vec_uint4 sign = VEC_LITERAL(vec_uint4, 0x80000000, 0, 0x80000000, 0); + vec_uint4 or_mask, and_mask, mask; + vec_double2 in, in_hi, out; + + in = spu_promote(x, 0); + + /* Construct a mask to remove the fraction bits. The mask + * depends on the exponent of the floating point + * input value. + */ + in_hi = spu_shuffle(in, in, splat_hi); + exp = spu_and(spu_rlmask((vec_int4)in_hi, -20), 0x7FF); + + shift = spu_sub(VEC_LITERAL(vec_int4, 1023, 1043, 1023, 1043), exp); + or_mask = spu_andc(spu_cmpgt(shift, 0), sign); + + and_mask = spu_rlmask(VEC_LITERAL(vec_uint4, 0xFFFFF, -1, 0xFFFFF, -1), shift); + mask = spu_or(spu_and(and_mask, spu_cmpgt(shift, -31)), or_mask); + + /* Apply the mask and return the result. + */ + out = spu_andc(in, (vec_double2)(mask)); + + return (spu_extract(out, 0)); +} +#endif /* _TRUNC_H_ */ diff --git a/newlib/libm/machine/spu/headers/truncf.h b/newlib/libm/machine/spu/headers/truncf.h new file mode 100644 index 000000000..2b360452a --- /dev/null +++ b/newlib/libm/machine/spu/headers/truncf.h @@ -0,0 +1,64 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _TRUNCF_H_ +#define _TRUNCF_H_ 1 + +#include +#include "headers/vec_literal.h" + +static __inline float _truncf(float x) +{ + vec_int4 exp; + vec_uint4 or_mask, and_mask, mask; + vec_float4 in, out; + + in = spu_promote(x, 0); + + /* Construct a mask to remove the fraction bits. The mask + * depends on the exponent of the floating point + * input value. + */ + exp = spu_sub(127, spu_and(spu_rlmask((vec_int4)in, -23), 0xFF)); + + or_mask = spu_cmpgt(exp, 0); + and_mask = spu_rlmask(VEC_SPLAT_U32(0x7FFFFF), exp); + + mask = spu_or(spu_and(and_mask, spu_cmpgt(exp, -31)), or_mask); + + /* Apply the mask and return the result. + */ + out = spu_andc(in, (vec_float4)(mask)); + + return (spu_extract(out, 0)); +} +#endif /* _TRUNCF_H_ */ diff --git a/newlib/libm/machine/spu/headers/vec_literal.h b/newlib/libm/machine/spu/headers/vec_literal.h new file mode 100644 index 000000000..0098fee54 --- /dev/null +++ b/newlib/libm/machine/spu/headers/vec_literal.h @@ -0,0 +1,93 @@ +/* + (C) Copyright 2001,2006, + 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. +*/ +#ifndef _VEC_LITERAL_H_ +#define _VEC_LITERAL_H_ + +/* This header files provides an abstraction for the various implementations + * of vector literal construction. The two formats are: + * + * 1) Altivec styled using parenthesis + * 2) C grammer friendly styled using curly braces + * + * The macro, VEC_LITERAL has been developed to provide some portability + * in these two styles. To achieve true portability, user must specify all + * elements of the vector being initialized. A single element can be provided + * but only the first element guarenteed across both construction styles. + * + * The VEC_SPLAT_* macros have been provided for portability of vector literal + * construction when all the elements of the vector contain the same value. + */ + +#include + +#ifdef __ALTIVEC_LITERAL_STYLE__ +/* Use altivec style. + */ +#define VEC_LITERAL(_type, ...) ((_type)(__VA_ARGS__)) + +#define VEC_SPLAT_U8(_val) ((vector unsigned char)(_val)) +#define VEC_SPLAT_S8(_val) ((vector signed char)(_val)) + +#define VEC_SPLAT_U16(_val) ((vector unsigned short)(_val)) +#define VEC_SPLAT_S16(_val) ((vector signed short)(_val)) + +#define VEC_SPLAT_U32(_val) ((vector unsigned int)(_val)) +#define VEC_SPLAT_S32(_val) ((vector signed int)(_val)) +#define VEC_SPLAT_F32(_val) ((vector float)(_val)) + +#define VEC_SPLAT_U64(_val) ((vector unsigned long long)(_val)) +#define VEC_SPLAT_S64(_val) ((vector signed long long)(_val)) +#define VEC_SPLAT_F64(_val) ((vector double)(_val)) + +#else +/* Use curly brace style. + */ +#define VEC_LITERAL(_type, ...) ((_type){__VA_ARGS__}) + +#define VEC_SPLAT_U8(_val) ((vector unsigned char){_val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val}) +#define VEC_SPLAT_S8(_val) ((vector signed char){_val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val, _val}) + +#define VEC_SPLAT_U16(_val) ((vector unsigned short){_val, _val, _val, _val, _val, _val, _val, _val}) +#define VEC_SPLAT_S16(_val) ((vector signed short){_val, _val, _val, _val, _val, _val, _val, _val}) + +#define VEC_SPLAT_U32(_val) ((vector unsigned int){_val, _val, _val, _val}) +#define VEC_SPLAT_S32(_val) ((vector signed int){_val, _val, _val, _val}) +#define VEC_SPLAT_F32(_val) ((vector float){_val, _val, _val, _val}) + +#define VEC_SPLAT_U64(_val) ((vector unsigned long long){_val, _val}) +#define VEC_SPLAT_S64(_val) ((vector signed long long){_val, _val}) +#define VEC_SPLAT_F64(_val) ((vector double){_val, _val}) + +#endif + +#endif /* _VEC_LITERAL_H_ */ diff --git a/newlib/libm/machine/spu/llrint.c b/newlib/libm/machine/spu/llrint.c new file mode 100644 index 000000000..e0aa0e8f4 --- /dev/null +++ b/newlib/libm/machine/spu/llrint.c @@ -0,0 +1,7 @@ +#include +#include "headers/llrint.h" + +long long int llrint(double x) +{ + return _llrint(x); +} diff --git a/newlib/libm/machine/spu/llrintf.c b/newlib/libm/machine/spu/llrintf.c new file mode 100644 index 000000000..a27c773f8 --- /dev/null +++ b/newlib/libm/machine/spu/llrintf.c @@ -0,0 +1,7 @@ +#include +#include "headers/llrintf.h" + +long long int llrintf(float x) +{ + return _llrintf(x); +} diff --git a/newlib/libm/machine/spu/llround.c b/newlib/libm/machine/spu/llround.c new file mode 100644 index 000000000..a24450e32 --- /dev/null +++ b/newlib/libm/machine/spu/llround.c @@ -0,0 +1,7 @@ +#include +#include "headers/llround.h" + +long long int llround(double x) +{ + return _llround(x); +} diff --git a/newlib/libm/machine/spu/llroundf.c b/newlib/libm/machine/spu/llroundf.c new file mode 100644 index 000000000..8adfd43c3 --- /dev/null +++ b/newlib/libm/machine/spu/llroundf.c @@ -0,0 +1,7 @@ +#include +#include "headers/llroundf.h" + +long long int llroundf(float x) +{ + return _llroundf(x); +} diff --git a/newlib/libm/machine/spu/log2f.c b/newlib/libm/machine/spu/log2f.c new file mode 100644 index 000000000..42b2c02bb --- /dev/null +++ b/newlib/libm/machine/spu/log2f.c @@ -0,0 +1,8 @@ +#include +#include "headers/log2f.h" + +#undef log2f +float log2f(float x) +{ + return _log2f(x); +} diff --git a/newlib/libm/machine/spu/s_cbrt.c b/newlib/libm/machine/spu/s_cbrt.c new file mode 100644 index 000000000..56be72f64 --- /dev/null +++ b/newlib/libm/machine/spu/s_cbrt.c @@ -0,0 +1,7 @@ +#include +#include "headers/cbrt.h" + +double cbrt(double x) +{ + return _cbrt(x); +} diff --git a/newlib/libm/machine/spu/s_ceil.c b/newlib/libm/machine/spu/s_ceil.c new file mode 100644 index 000000000..c96d976fb --- /dev/null +++ b/newlib/libm/machine/spu/s_ceil.c @@ -0,0 +1,7 @@ +#include +#include "headers/ceil.h" + +double ceil(double x) +{ + return _ceil(x); +} diff --git a/newlib/libm/machine/spu/s_copysign.c b/newlib/libm/machine/spu/s_copysign.c new file mode 100644 index 000000000..b4b2390e8 --- /dev/null +++ b/newlib/libm/machine/spu/s_copysign.c @@ -0,0 +1,7 @@ +#include +#include "headers/copysign.h" + +double copysign(double x, double y) +{ + return _copysign(x, y); +} diff --git a/newlib/libm/machine/spu/s_fabs.c b/newlib/libm/machine/spu/s_fabs.c new file mode 100644 index 000000000..810f320a6 --- /dev/null +++ b/newlib/libm/machine/spu/s_fabs.c @@ -0,0 +1,7 @@ +#include +#include "headers/fabs.h" + +double fabs(double x) +{ + return _fabs(x); +} diff --git a/newlib/libm/machine/spu/s_fdim.c b/newlib/libm/machine/spu/s_fdim.c new file mode 100644 index 000000000..fd2b5ac80 --- /dev/null +++ b/newlib/libm/machine/spu/s_fdim.c @@ -0,0 +1,7 @@ +#include +#include "headers/fdim.h" + +double fdim(double x, double y) +{ + return _fdim(x, y); +} diff --git a/newlib/libm/machine/spu/s_floor.c b/newlib/libm/machine/spu/s_floor.c new file mode 100644 index 000000000..5f0d23893 --- /dev/null +++ b/newlib/libm/machine/spu/s_floor.c @@ -0,0 +1,7 @@ +#include +#include "headers/floor.h" + +double floor(double x) +{ + return _floor(x); +} diff --git a/newlib/libm/machine/spu/s_fma.c b/newlib/libm/machine/spu/s_fma.c new file mode 100644 index 000000000..0dad63eee --- /dev/null +++ b/newlib/libm/machine/spu/s_fma.c @@ -0,0 +1,7 @@ +#include +#include "headers/fma.h" + +double fma(double x, double y, double z) +{ + return _fma(x, y, z); +} diff --git a/newlib/libm/machine/spu/s_fmax.c b/newlib/libm/machine/spu/s_fmax.c new file mode 100644 index 000000000..b17c32764 --- /dev/null +++ b/newlib/libm/machine/spu/s_fmax.c @@ -0,0 +1,7 @@ +#include +#include "headers/fmax.h" + +double fmax(double x, double y) +{ + return _fmax(x, y); +} diff --git a/newlib/libm/machine/spu/s_fmin.c b/newlib/libm/machine/spu/s_fmin.c new file mode 100644 index 000000000..3daa05ba1 --- /dev/null +++ b/newlib/libm/machine/spu/s_fmin.c @@ -0,0 +1,7 @@ +#include +#include "headers/fmin.h" + +double fmin(double x, double y) +{ + return _fmin(x, y); +} diff --git a/newlib/libm/machine/spu/s_frexp.c b/newlib/libm/machine/spu/s_frexp.c new file mode 100644 index 000000000..3f1e096da --- /dev/null +++ b/newlib/libm/machine/spu/s_frexp.c @@ -0,0 +1,7 @@ +#include +#include "headers/frexp.h" + +double frexp(double x, int *pexp) +{ + return _frexp(x, pexp); +} diff --git a/newlib/libm/machine/spu/s_ilogb.c b/newlib/libm/machine/spu/s_ilogb.c new file mode 100644 index 000000000..9a3730f5a --- /dev/null +++ b/newlib/libm/machine/spu/s_ilogb.c @@ -0,0 +1,7 @@ +#include +#include "headers/ilogb.h" + +int ilogb(double x) +{ + return _ilogb(x); +} diff --git a/newlib/libm/machine/spu/s_ldexp.c b/newlib/libm/machine/spu/s_ldexp.c new file mode 100644 index 000000000..268eb67a4 --- /dev/null +++ b/newlib/libm/machine/spu/s_ldexp.c @@ -0,0 +1,7 @@ +#include +#include "headers/ldexp.h" + +double ldexp(double x, int exp) +{ + return _ldexp(x, exp); +} diff --git a/newlib/libm/machine/spu/s_lrint.c b/newlib/libm/machine/spu/s_lrint.c new file mode 100644 index 000000000..e9a3f74b3 --- /dev/null +++ b/newlib/libm/machine/spu/s_lrint.c @@ -0,0 +1,7 @@ +#include +#include "headers/lrint.h" + +long int lrint(double x) +{ + return _lrint(x); +} diff --git a/newlib/libm/machine/spu/s_lround.c b/newlib/libm/machine/spu/s_lround.c new file mode 100644 index 000000000..cc012d7ce --- /dev/null +++ b/newlib/libm/machine/spu/s_lround.c @@ -0,0 +1,7 @@ +#include +#include "headers/lround.h" + +long int lround(double x) +{ + return _lround(x); +} diff --git a/newlib/libm/machine/spu/s_nearbyint.c b/newlib/libm/machine/spu/s_nearbyint.c new file mode 100644 index 000000000..5887f27f1 --- /dev/null +++ b/newlib/libm/machine/spu/s_nearbyint.c @@ -0,0 +1,7 @@ +#include +#include "headers/nearbyint.h" + +double nearbyint(double x) +{ + return _nearbyint(x); +} diff --git a/newlib/libm/machine/spu/s_remquo.c b/newlib/libm/machine/spu/s_remquo.c new file mode 100644 index 000000000..9ba6a1213 --- /dev/null +++ b/newlib/libm/machine/spu/s_remquo.c @@ -0,0 +1,7 @@ +#include +#include "headers/remquo.h" + +double remquo(double x, double y, int *quo) +{ + return _remquo(x, y, quo); +} diff --git a/newlib/libm/machine/spu/s_rint.c b/newlib/libm/machine/spu/s_rint.c new file mode 100644 index 000000000..482c6264c --- /dev/null +++ b/newlib/libm/machine/spu/s_rint.c @@ -0,0 +1,7 @@ +#include +#include "headers/rint.h" + +double rint(double x) +{ + return _rint(x); +} diff --git a/newlib/libm/machine/spu/s_round.c b/newlib/libm/machine/spu/s_round.c new file mode 100644 index 000000000..7138c8447 --- /dev/null +++ b/newlib/libm/machine/spu/s_round.c @@ -0,0 +1,7 @@ +#include +#include "headers/round.h" + +double round(double x) +{ + return _round(x); +} diff --git a/newlib/libm/machine/spu/s_scalbn.c b/newlib/libm/machine/spu/s_scalbn.c new file mode 100644 index 000000000..58e161dfc --- /dev/null +++ b/newlib/libm/machine/spu/s_scalbn.c @@ -0,0 +1,7 @@ +#include +#include "headers/scalbn.h" + +double scalbn(double x, int exp) +{ + return _scalbn(x, exp); +} diff --git a/newlib/libm/machine/spu/s_trunc.c b/newlib/libm/machine/spu/s_trunc.c new file mode 100644 index 000000000..043df4461 --- /dev/null +++ b/newlib/libm/machine/spu/s_trunc.c @@ -0,0 +1,7 @@ +#include +#include "headers/trunc.h" + +double trunc(double x) +{ + return _trunc(x); +} diff --git a/newlib/libm/machine/spu/sf_atan.c b/newlib/libm/machine/spu/sf_atan.c new file mode 100644 index 000000000..90ef5145c --- /dev/null +++ b/newlib/libm/machine/spu/sf_atan.c @@ -0,0 +1,7 @@ +#include +#include "headers/atanf.h" + +float atanf(float x) +{ + return _atanf(x); +} diff --git a/newlib/libm/machine/spu/sf_cbrt.c b/newlib/libm/machine/spu/sf_cbrt.c new file mode 100644 index 000000000..86a08650e --- /dev/null +++ b/newlib/libm/machine/spu/sf_cbrt.c @@ -0,0 +1,7 @@ +#include +#include "headers/cbrtf.h" + +float cbrtf(float x) +{ + return _cbrtf(x); +} diff --git a/newlib/libm/machine/spu/sf_ceil.c b/newlib/libm/machine/spu/sf_ceil.c new file mode 100644 index 000000000..cfd611ca0 --- /dev/null +++ b/newlib/libm/machine/spu/sf_ceil.c @@ -0,0 +1,7 @@ +#include +#include "headers/ceilf.h" + +float ceilf(float value) +{ + return _ceilf(value); +} diff --git a/newlib/libm/machine/spu/sf_copysign.c b/newlib/libm/machine/spu/sf_copysign.c new file mode 100644 index 000000000..4647c4572 --- /dev/null +++ b/newlib/libm/machine/spu/sf_copysign.c @@ -0,0 +1,7 @@ +#include +#include "headers/copysignf.h" + +float copysignf(float x, float y) +{ + return _copysignf(x, y); +} diff --git a/newlib/libm/machine/spu/sf_fabs.c b/newlib/libm/machine/spu/sf_fabs.c new file mode 100644 index 000000000..bffc44b03 --- /dev/null +++ b/newlib/libm/machine/spu/sf_fabs.c @@ -0,0 +1,7 @@ +#include +#include "headers/fabsf.h" + +float fabsf(float value) +{ + return _fabsf(value); +} diff --git a/newlib/libm/machine/spu/sf_fdim.c b/newlib/libm/machine/spu/sf_fdim.c new file mode 100644 index 000000000..b489c2726 --- /dev/null +++ b/newlib/libm/machine/spu/sf_fdim.c @@ -0,0 +1,7 @@ +#include +#include "headers/fdimf.h" + +float fdimf(float x, float y) +{ + return _fdimf(x, y); +} diff --git a/newlib/libm/machine/spu/sf_floor.c b/newlib/libm/machine/spu/sf_floor.c new file mode 100644 index 000000000..c5de7ca6a --- /dev/null +++ b/newlib/libm/machine/spu/sf_floor.c @@ -0,0 +1,7 @@ +#include +#include "headers/floorf.h" + +float floorf(float value) +{ + return _floorf(value); +} diff --git a/newlib/libm/machine/spu/sf_fma.c b/newlib/libm/machine/spu/sf_fma.c new file mode 100644 index 000000000..45dbcba4a --- /dev/null +++ b/newlib/libm/machine/spu/sf_fma.c @@ -0,0 +1,7 @@ +#include +#include "headers/fmaf.h" + +float fmaf(float x, float y, float z) +{ + return _fmaf(x, y, z); +} diff --git a/newlib/libm/machine/spu/sf_fmax.c b/newlib/libm/machine/spu/sf_fmax.c new file mode 100644 index 000000000..5d5ca536b --- /dev/null +++ b/newlib/libm/machine/spu/sf_fmax.c @@ -0,0 +1,7 @@ +#include +#include "headers/fmaxf.h" + +float fmaxf(float x, float y) +{ + return _fmaxf(x, y); +} diff --git a/newlib/libm/machine/spu/sf_fmin.c b/newlib/libm/machine/spu/sf_fmin.c new file mode 100644 index 000000000..a08dca8d0 --- /dev/null +++ b/newlib/libm/machine/spu/sf_fmin.c @@ -0,0 +1,7 @@ +#include +#include "headers/fminf.h" + +float fminf(float x, float y) +{ + return _fminf(x, y); +} diff --git a/newlib/libm/machine/spu/sf_frexp.c b/newlib/libm/machine/spu/sf_frexp.c new file mode 100644 index 000000000..8ea04d56f --- /dev/null +++ b/newlib/libm/machine/spu/sf_frexp.c @@ -0,0 +1,7 @@ +#include +#include "headers/frexpf.h" + +float frexpf(float x, int *pexp) +{ + return _frexpf(x, pexp); +} diff --git a/newlib/libm/machine/spu/sf_ilogb.c b/newlib/libm/machine/spu/sf_ilogb.c new file mode 100644 index 000000000..ea2146c5c --- /dev/null +++ b/newlib/libm/machine/spu/sf_ilogb.c @@ -0,0 +1,7 @@ +#include +#include "headers/ilogbf.h" + +int ilogbf(float x) +{ + return _ilogbf(x); +} diff --git a/newlib/libm/machine/spu/sf_ldexp.c b/newlib/libm/machine/spu/sf_ldexp.c new file mode 100644 index 000000000..7d19a5d5c --- /dev/null +++ b/newlib/libm/machine/spu/sf_ldexp.c @@ -0,0 +1,7 @@ +#include +#include "headers/ldexpf.h" + +float ldexpf(float x, int exp) +{ + return _ldexpf(x, exp); +} diff --git a/newlib/libm/machine/spu/sf_lrint.c b/newlib/libm/machine/spu/sf_lrint.c new file mode 100644 index 000000000..dd96610a6 --- /dev/null +++ b/newlib/libm/machine/spu/sf_lrint.c @@ -0,0 +1,7 @@ +#include +#include "headers/lrintf.h" + +long int lrintf(float x) +{ + return _lrintf(x); +} diff --git a/newlib/libm/machine/spu/sf_lround.c b/newlib/libm/machine/spu/sf_lround.c new file mode 100644 index 000000000..250467b7e --- /dev/null +++ b/newlib/libm/machine/spu/sf_lround.c @@ -0,0 +1,7 @@ +#include +#include "headers/lroundf.h" + +long int lroundf(float x) +{ + return _lroundf(x); +} diff --git a/newlib/libm/machine/spu/sf_remquo.c b/newlib/libm/machine/spu/sf_remquo.c new file mode 100644 index 000000000..3494398b2 --- /dev/null +++ b/newlib/libm/machine/spu/sf_remquo.c @@ -0,0 +1,7 @@ +#include +#include "headers/remquof.h" + +float remquof(float x, float y, int *quo) +{ + return _remquof(x, y, quo); +} diff --git a/newlib/libm/machine/spu/sf_round.c b/newlib/libm/machine/spu/sf_round.c new file mode 100644 index 000000000..62a68f602 --- /dev/null +++ b/newlib/libm/machine/spu/sf_round.c @@ -0,0 +1,7 @@ +#include +#include "headers/roundf.h" + +float roundf(float x) +{ + return _roundf(x); +} diff --git a/newlib/libm/machine/spu/sf_scalbn.c b/newlib/libm/machine/spu/sf_scalbn.c new file mode 100644 index 000000000..67824dfac --- /dev/null +++ b/newlib/libm/machine/spu/sf_scalbn.c @@ -0,0 +1,7 @@ +#include +#include "headers/scalbnf.h" + +float scalbnf(float x, int exp) +{ + return _scalbnf(x, exp); +} diff --git a/newlib/libm/machine/spu/sf_trunc.c b/newlib/libm/machine/spu/sf_trunc.c new file mode 100644 index 000000000..4a7ab8841 --- /dev/null +++ b/newlib/libm/machine/spu/sf_trunc.c @@ -0,0 +1,7 @@ +#include +#include "headers/truncf.h" + +float truncf(float x) +{ + return _truncf(x); +} diff --git a/newlib/libm/machine/spu/w_fmod.c b/newlib/libm/machine/spu/w_fmod.c new file mode 100644 index 000000000..29704bceb --- /dev/null +++ b/newlib/libm/machine/spu/w_fmod.c @@ -0,0 +1,7 @@ +#include +#include "headers/fmod.h" + +double fmod(double x, double y) +{ + return _fmod(x, y); +} diff --git a/newlib/libm/machine/spu/w_remainder.c b/newlib/libm/machine/spu/w_remainder.c new file mode 100644 index 000000000..c87627b49 --- /dev/null +++ b/newlib/libm/machine/spu/w_remainder.c @@ -0,0 +1,7 @@ +#include +#include "headers/remainder.h" + +double remainder(double x, double y) +{ + return _remainder(x, y); +} diff --git a/newlib/libm/machine/spu/w_sqrt.c b/newlib/libm/machine/spu/w_sqrt.c new file mode 100644 index 000000000..359ffcc32 --- /dev/null +++ b/newlib/libm/machine/spu/w_sqrt.c @@ -0,0 +1,7 @@ +#include +#include "headers/sqrt.h" + +double sqrt(double in) +{ + return _sqrt(in); +} diff --git a/newlib/libm/machine/spu/wf_exp.c b/newlib/libm/machine/spu/wf_exp.c new file mode 100644 index 000000000..9a0f905d0 --- /dev/null +++ b/newlib/libm/machine/spu/wf_exp.c @@ -0,0 +1,7 @@ +#include +#include "headers/expf.h" + +float expf(float x) +{ + return _expf(x); +} diff --git a/newlib/libm/machine/spu/wf_exp2.c b/newlib/libm/machine/spu/wf_exp2.c new file mode 100644 index 000000000..c815cee55 --- /dev/null +++ b/newlib/libm/machine/spu/wf_exp2.c @@ -0,0 +1,7 @@ +#include +#include "headers/exp2f.h" + +float exp2f(float x) +{ + return _exp2f(x); +} diff --git a/newlib/libm/machine/spu/wf_fmod.c b/newlib/libm/machine/spu/wf_fmod.c new file mode 100644 index 000000000..b7b8c27df --- /dev/null +++ b/newlib/libm/machine/spu/wf_fmod.c @@ -0,0 +1,7 @@ +#include +#include "headers/fmodf.h" + +float fmodf(float x, float y) +{ + return _fmodf(x, y); +} diff --git a/newlib/libm/machine/spu/wf_log.c b/newlib/libm/machine/spu/wf_log.c new file mode 100644 index 000000000..e788dea4d --- /dev/null +++ b/newlib/libm/machine/spu/wf_log.c @@ -0,0 +1,7 @@ +#include +#include "headers/logf.h" + +float logf(float x) +{ + return _logf(x); +} diff --git a/newlib/libm/machine/spu/wf_log10.c b/newlib/libm/machine/spu/wf_log10.c new file mode 100644 index 000000000..f3d2c9f90 --- /dev/null +++ b/newlib/libm/machine/spu/wf_log10.c @@ -0,0 +1,7 @@ +#include +#include "headers/log10f.h" + +float log10f(float x) +{ + return _log10f(x); +} diff --git a/newlib/libm/machine/spu/wf_remainder.c b/newlib/libm/machine/spu/wf_remainder.c new file mode 100644 index 000000000..84508ce2a --- /dev/null +++ b/newlib/libm/machine/spu/wf_remainder.c @@ -0,0 +1,7 @@ +#include +#include "headers/remainderf.h" + +float remainderf(float x, float y) +{ + return _remainderf(x, y); +}