2007-12-19 Dave Korn <dave.korn@artimi.com>

Jeff Johnston  <jjohnstn@redhhat.com>

        * libc/include/_ansi.h: Add _LONG_LONG definition.
        * libc/include/math.h (llrint, llrintf, rintl, lrintl, llrintl): Add
        prototypes.
        * libc/machine/i386/machine/fastmath.h: Add support for new i386
        fast math versions of rint, lrint, and llrint family functions.
        * libm/machine/i386/Makefile.am: Add new files.
        * libm/machine/i386/Makefile.in: Regenerated.
        * libm/machine/i386/f_llrint.c, libm/machine/i386/f_lrint.c,
        libm/machine/i386/f_rint.c, libm/machine/i386/f_llrintf.c,
        libm/machine/i386/f_lrintf.c, libm/machine/i386/f_rintf.c,
        libm/machine/i386/f_llrintl.c, libm/machine/i386/f_lrintl.c,
        libm/machine/i386/f_rintl.c:  New files with fast math implementations.
This commit is contained in:
Jeff Johnston 2007-12-19 22:20:25 +00:00
parent 73063e9364
commit 3cc8a378d1
15 changed files with 591 additions and 26 deletions

View File

@ -1,3 +1,19 @@
2007-12-19 Dave Korn <dave.korn@artimi.com>
Jeff Johnston <jjohnstn@redhhat.com>
* libc/include/_ansi.h: Add _LONG_LONG definition.
* libc/include/math.h (llrint, llrintf, rintl, lrintl, llrintl): Add
prototypes.
* libc/machine/i386/machine/fastmath.h: Add support for new i386
fast math versions of rint, lrint, and llrint family functions.
* libm/machine/i386/Makefile.am: Add new files.
* libm/machine/i386/Makefile.in: Regenerated.
* libm/machine/i386/f_llrint.c, libm/machine/i386/f_lrint.c,
libm/machine/i386/f_rint.c, libm/machine/i386/f_llrintf.c,
libm/machine/i386/f_lrintf.c, libm/machine/i386/f_rintf.c,
libm/machine/i386/f_llrintl.c, libm/machine/i386/f_lrintl.c,
libm/machine/i386/f_rintl.c: New files with fast math implementations.
2007-12-19 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/sys/features.h: Add checks for C90 compilers using

View File

@ -45,6 +45,9 @@
#ifndef _LONG_DOUBLE
#define _LONG_DOUBLE long double
#endif
#ifndef _LONG_LONG
#define _LONG_LONG long long
#endif
#ifndef _PARAMS
#define _PARAMS(paramlist) paramlist
#endif
@ -62,6 +65,7 @@
#define _DEFUN_VOID(name) name()
#define _CAST_VOID
#define _LONG_DOUBLE double
#define _LONG_LONG long
#ifndef _PARAMS
#define _PARAMS(paramlist) ()
#endif

View File

@ -226,6 +226,7 @@ extern double scalbln _PARAMS((double, long int));
extern double tgamma _PARAMS((double));
extern double nearbyint _PARAMS((double));
extern long int lrint _PARAMS((double));
extern _LONG_LONG int llrint _PARAMS((double));
extern double round _PARAMS((double));
extern long int lround _PARAMS((double));
extern double trunc _PARAMS((double));
@ -292,6 +293,7 @@ extern float scalblnf _PARAMS((float, long int));
extern float tgammaf _PARAMS((float));
extern float nearbyintf _PARAMS((float));
extern long int lrintf _PARAMS((float));
extern _LONG_LONG llrintf _PARAMS((float));
extern float roundf _PARAMS((float));
extern long int lroundf _PARAMS((float));
extern float truncf _PARAMS((float));
@ -330,6 +332,11 @@ extern float erfcf _PARAMS((float));
extern float hypotf _PARAMS((float, float));
#endif /* ! defined (_REENT_ONLY) */
/* Other long double precision functions. */
extern _LONG_DOUBLE rintl _PARAMS((_LONG_DOUBLE));
extern long int lrintl _PARAMS((_LONG_DOUBLE));
extern _LONG_LONG llrintl _PARAMS((_LONG_DOUBLE));
#endif /* !defined (__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L */
#if !defined (__STRICT_ANSI__) || defined(__cplusplus)

View File

@ -26,6 +26,7 @@ __extension__ double tan(double)
#if !defined(__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L
__extension__ float atan2f(float, float)
__asm__(__U_L_PREFIX__ "_f_atan2f");
__extension__ float expf(float)
@ -34,12 +35,30 @@ __extension__ float frexpf(float, int*)
__asm__(__U_L_PREFIX__ "_f_frexpf");
__extension__ float ldexpf(float, int)
__asm__(__U_L_PREFIX__ "_f_ldexpf");
__extension__ long long llrint(double)
__asm__(__U_L_PREFIX__ "_f_llrint");
__extension__ long long llrintf(float)
__asm__(__U_L_PREFIX__ "_f_llrintf");
__extension__ long long llrintl(long double)
__asm__(__U_L_PREFIX__ "_f_llrintl");
__extension__ float logf(float)
__asm__(__U_L_PREFIX__ "_f_logf");
__extension__ float log10f(float)
__asm__(__U_L_PREFIX__ "_f_log10f");
__extension__ long lrint(double)
__asm__(__U_L_PREFIX__ "_f_lrint");
__extension__ long lrintf(float)
__asm__(__U_L_PREFIX__ "_f_lrintf");
__extension__ long lrintl(long double)
__asm__(__U_L_PREFIX__ "_f_lrintl");
__extension__ float powf(float, float)
__asm__(__U_L_PREFIX__ "_f_powf");
__extension__ double rint(double)
__asm__(__U_L_PREFIX__ "_f_rint");
__extension__ float rintf(float)
__asm__(__U_L_PREFIX__ "_f_rintf");
__extension__ long double rintl(long double)
__asm__(__U_L_PREFIX__ "_f_rintl");
__extension__ float tanf(float)
__asm__(__U_L_PREFIX__ "_f_tanf");
#endif
@ -54,14 +73,6 @@ double EXFUN(_f_log,(double));
double EXFUN(_f_log10,(double));
double EXFUN(_f_pow,(double, double));
float EXFUN(_f_atan2f,(float, float));
float EXFUN(_f_expf,(float));
float EXFUN(_f_frexpf,(float, int*));
float EXFUN(_f_ldexpf,(float, int));
float EXFUN(_f_logf,(float));
float EXFUN(_f_log10f,(float));
float EXFUN(_f_powf,(float, float));
#define atan2(__y,__x) _f_atan2((__y),(__x))
#define exp(__x) _f_exp(__x)
#define frexp(__x,__p) _f_frexp((__x),(__p))
@ -71,13 +82,40 @@ float EXFUN(_f_powf,(float, float));
#define pow(__x,__y) _f_pow((__x),(__y))
#ifndef __STRICT_ANSI__
float EXFUN(_f_atan2f,(float, float));
float EXFUN(_f_expf,(float));
float EXFUN(_f_frexpf,(float, int*));
float EXFUN(_f_ldexpf,(float, int));
long long EXFUN(_f_llrint,(double));
long long EXFUN(_f_llrintf,(float));
long long EXFUN(_f_llrintl,(long double));
float EXFUN(_f_logf,(float));
float EXFUN(_f_log10f,(float));
long EXFUN(_f_lrint,(double));
long EXFUN(_f_lrintf,(float));
long EXFUN(_f_lrintl,(long double));
float EXFUN(_f_powf,(float, float));
float EXFUN(_f_rint,(double));
double EXFUN(_f_rintf,(float));
long double EXFUN(_f_rintl,(long double));
#define atan2f(__y,__x) _f_atan2f((__y),(__x))
#define expf(__x) _f_expf(__x)
#define frexpf(__x,__p) _f_frexpf((__x),(__p))
#define ldexpf(__x,__e) _f_ldexpf((__x),(__e))
#define llrint(__x) _f_llrint((__x))
#define llrintf(__x) _f_llrintf((__x))
#define llrintl(__x) _f_llrintl((__x))
#define logf(__x) _f_logf(__x)
#define log10f(__x) _f_log10f(__x)
#define lrint(__x) _f_lrint((__x))
#define lrintf(__x) _f_lrintf((__x))
#define lrintl(__x) _f_lrintl((__x))
#define powf(__x,y) _f_powf((__x),(__y))
#define rint(__x) _f_rint((__x))
#define rintf(__x) _f_rintf((__x))
#define rintl(__x) _f_rintl((__x))
#endif
#endif /* GCC */

View File

@ -8,8 +8,12 @@ AM_CCASFLAGS = $(INCLUDES)
LIB_SOURCES = \
f_atan2.S f_atan2f.S f_exp.c f_expf.c \
f_frexp.S f_frexpf.S f_log.S f_logf.S f_log10.S f_log10f.S \
f_ldexp.S f_ldexpf.S f_pow.c f_powf.c f_tan.S f_tanf.S f_math.h i386mach.h
f_frexp.S f_frexpf.S f_llrint.c f_llrintf.c f_llrintl.c \
f_log.S f_logf.S f_log10.S f_log10f.S \
f_ldexp.S f_ldexpf.S f_lrint.c f_lrintf.c f_lrintl.c \
f_pow.c f_powf.c f_rint.c f_rintf.c f_rintl.c \
f_tan.S f_tanf.S f_math.h \
i386mach.h
libi386_la_LDFLAGS = -Xcompiler -nostdlib
@ -29,3 +33,4 @@ include $(srcdir)/../../../Makefile.shared
ACLOCAL_AMFLAGS = -I ../../.. -I ../../../..
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host

View File

@ -45,7 +45,11 @@ DIST_COMMON = $(srcdir)/../../../Makefile.shared \
$(am__configure_deps) $(srcdir)/../../../../mkinstalldirs \
$(srcdir)/../../../../compile $(srcdir)/../../../../compile \
$(srcdir)/../../../../compile $(srcdir)/../../../../compile \
$(srcdir)/../../../../ltmain.sh \
$(srcdir)/../../../../compile $(srcdir)/../../../../compile \
$(srcdir)/../../../../compile $(srcdir)/../../../../compile \
$(srcdir)/../../../../compile $(srcdir)/../../../../compile \
$(srcdir)/../../../../compile $(srcdir)/../../../../compile \
$(srcdir)/../../../../compile $(srcdir)/../../../../ltmain.sh \
$(srcdir)/../../../../config.guess \
$(srcdir)/../../../../config.sub
subdir = .
@ -68,18 +72,25 @@ lib_a_LIBADD =
am__objects_1 = lib_a-f_atan2.$(OBJEXT) lib_a-f_atan2f.$(OBJEXT) \
lib_a-f_exp.$(OBJEXT) lib_a-f_expf.$(OBJEXT) \
lib_a-f_frexp.$(OBJEXT) lib_a-f_frexpf.$(OBJEXT) \
lib_a-f_log.$(OBJEXT) lib_a-f_logf.$(OBJEXT) \
lib_a-f_log10.$(OBJEXT) lib_a-f_log10f.$(OBJEXT) \
lib_a-f_ldexp.$(OBJEXT) lib_a-f_ldexpf.$(OBJEXT) \
lib_a-f_llrint.$(OBJEXT) lib_a-f_llrintf.$(OBJEXT) \
lib_a-f_llrintl.$(OBJEXT) lib_a-f_log.$(OBJEXT) \
lib_a-f_logf.$(OBJEXT) lib_a-f_log10.$(OBJEXT) \
lib_a-f_log10f.$(OBJEXT) lib_a-f_ldexp.$(OBJEXT) \
lib_a-f_ldexpf.$(OBJEXT) lib_a-f_lrint.$(OBJEXT) \
lib_a-f_lrintf.$(OBJEXT) lib_a-f_lrintl.$(OBJEXT) \
lib_a-f_pow.$(OBJEXT) lib_a-f_powf.$(OBJEXT) \
lib_a-f_tan.$(OBJEXT) lib_a-f_tanf.$(OBJEXT)
lib_a-f_rint.$(OBJEXT) lib_a-f_rintf.$(OBJEXT) \
lib_a-f_rintl.$(OBJEXT) lib_a-f_tan.$(OBJEXT) \
lib_a-f_tanf.$(OBJEXT)
@USE_LIBTOOL_FALSE@am_lib_a_OBJECTS = $(am__objects_1)
lib_a_OBJECTS = $(am_lib_a_OBJECTS)
LTLIBRARIES = $(noinst_LTLIBRARIES)
libi386_la_LIBADD =
am__objects_2 = f_atan2.lo f_atan2f.lo f_exp.lo f_expf.lo f_frexp.lo \
f_frexpf.lo f_log.lo f_logf.lo f_log10.lo f_log10f.lo \
f_ldexp.lo f_ldexpf.lo f_pow.lo f_powf.lo f_tan.lo f_tanf.lo
f_frexpf.lo f_llrint.lo f_llrintf.lo f_llrintl.lo f_log.lo \
f_logf.lo f_log10.lo f_log10f.lo f_ldexp.lo f_ldexpf.lo \
f_lrint.lo f_lrintf.lo f_lrintl.lo f_pow.lo f_powf.lo \
f_rint.lo f_rintf.lo f_rintl.lo f_tan.lo f_tanf.lo
@USE_LIBTOOL_TRUE@am_libi386_la_OBJECTS = $(am__objects_2)
libi386_la_OBJECTS = $(am_libi386_la_OBJECTS)
@USE_LIBTOOL_TRUE@am_libi386_la_rpath =
@ -177,15 +188,8 @@ 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_CC = @ac_ct_CC@
ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
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@
@ -201,18 +205,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@
lt_ECHO = @lt_ECHO@
@ -222,8 +231,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@
@ -234,8 +245,12 @@ INCLUDES = -I $(newlib_basedir)/../newlib/libm/common $(NEWLIB_CFLAGS) $(CROSS_C
AM_CCASFLAGS = $(INCLUDES)
LIB_SOURCES = \
f_atan2.S f_atan2f.S f_exp.c f_expf.c \
f_frexp.S f_frexpf.S f_log.S f_logf.S f_log10.S f_log10f.S \
f_ldexp.S f_ldexpf.S f_pow.c f_powf.c f_tan.S f_tanf.S f_math.h i386mach.h
f_frexp.S f_frexpf.S f_llrint.c f_llrintf.c f_llrintl.c \
f_log.S f_logf.S f_log10.S f_log10f.S \
f_ldexp.S f_ldexpf.S f_lrint.c f_lrintf.c f_lrintl.c \
f_pow.c f_powf.c f_rint.c f_rintf.c f_rintl.c \
f_tan.S f_tanf.S f_math.h \
i386mach.h
libi386_la_LDFLAGS = -Xcompiler -nostdlib
@USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = libi386.la
@ -412,6 +427,42 @@ lib_a-f_expf.o: f_expf.c
lib_a-f_expf.obj: f_expf.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-f_expf.obj `if test -f 'f_expf.c'; then $(CYGPATH_W) 'f_expf.c'; else $(CYGPATH_W) '$(srcdir)/f_expf.c'; fi`
lib_a-f_llrint.o: f_llrint.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-f_llrint.o `test -f 'f_llrint.c' || echo '$(srcdir)/'`f_llrint.c
lib_a-f_llrint.obj: f_llrint.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-f_llrint.obj `if test -f 'f_llrint.c'; then $(CYGPATH_W) 'f_llrint.c'; else $(CYGPATH_W) '$(srcdir)/f_llrint.c'; fi`
lib_a-f_llrintf.o: f_llrintf.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-f_llrintf.o `test -f 'f_llrintf.c' || echo '$(srcdir)/'`f_llrintf.c
lib_a-f_llrintf.obj: f_llrintf.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-f_llrintf.obj `if test -f 'f_llrintf.c'; then $(CYGPATH_W) 'f_llrintf.c'; else $(CYGPATH_W) '$(srcdir)/f_llrintf.c'; fi`
lib_a-f_llrintl.o: f_llrintl.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-f_llrintl.o `test -f 'f_llrintl.c' || echo '$(srcdir)/'`f_llrintl.c
lib_a-f_llrintl.obj: f_llrintl.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-f_llrintl.obj `if test -f 'f_llrintl.c'; then $(CYGPATH_W) 'f_llrintl.c'; else $(CYGPATH_W) '$(srcdir)/f_llrintl.c'; fi`
lib_a-f_lrint.o: f_lrint.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-f_lrint.o `test -f 'f_lrint.c' || echo '$(srcdir)/'`f_lrint.c
lib_a-f_lrint.obj: f_lrint.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-f_lrint.obj `if test -f 'f_lrint.c'; then $(CYGPATH_W) 'f_lrint.c'; else $(CYGPATH_W) '$(srcdir)/f_lrint.c'; fi`
lib_a-f_lrintf.o: f_lrintf.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-f_lrintf.o `test -f 'f_lrintf.c' || echo '$(srcdir)/'`f_lrintf.c
lib_a-f_lrintf.obj: f_lrintf.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-f_lrintf.obj `if test -f 'f_lrintf.c'; then $(CYGPATH_W) 'f_lrintf.c'; else $(CYGPATH_W) '$(srcdir)/f_lrintf.c'; fi`
lib_a-f_lrintl.o: f_lrintl.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-f_lrintl.o `test -f 'f_lrintl.c' || echo '$(srcdir)/'`f_lrintl.c
lib_a-f_lrintl.obj: f_lrintl.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-f_lrintl.obj `if test -f 'f_lrintl.c'; then $(CYGPATH_W) 'f_lrintl.c'; else $(CYGPATH_W) '$(srcdir)/f_lrintl.c'; fi`
lib_a-f_pow.o: f_pow.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-f_pow.o `test -f 'f_pow.c' || echo '$(srcdir)/'`f_pow.c
@ -424,6 +475,24 @@ lib_a-f_powf.o: f_powf.c
lib_a-f_powf.obj: f_powf.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-f_powf.obj `if test -f 'f_powf.c'; then $(CYGPATH_W) 'f_powf.c'; else $(CYGPATH_W) '$(srcdir)/f_powf.c'; fi`
lib_a-f_rint.o: f_rint.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-f_rint.o `test -f 'f_rint.c' || echo '$(srcdir)/'`f_rint.c
lib_a-f_rint.obj: f_rint.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-f_rint.obj `if test -f 'f_rint.c'; then $(CYGPATH_W) 'f_rint.c'; else $(CYGPATH_W) '$(srcdir)/f_rint.c'; fi`
lib_a-f_rintf.o: f_rintf.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-f_rintf.o `test -f 'f_rintf.c' || echo '$(srcdir)/'`f_rintf.c
lib_a-f_rintf.obj: f_rintf.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-f_rintf.obj `if test -f 'f_rintf.c'; then $(CYGPATH_W) 'f_rintf.c'; else $(CYGPATH_W) '$(srcdir)/f_rintf.c'; fi`
lib_a-f_rintl.o: f_rintl.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-f_rintl.o `test -f 'f_rintl.c' || echo '$(srcdir)/'`f_rintl.c
lib_a-f_rintl.obj: f_rintl.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-f_rintl.obj `if test -f 'f_rintl.c'; then $(CYGPATH_W) 'f_rintl.c'; else $(CYGPATH_W) '$(srcdir)/f_rintl.c'; fi`
mostlyclean-libtool:
-rm -f *.lo

View File

@ -0,0 +1,74 @@
/*
* ====================================================
* x87 FP implementation contributed to Newlib by
* Dave Korn, November 2007. This file is placed in the
* public domain. Permission to use, copy, modify, and
* distribute this software is freely granted.
* ====================================================
*/
#ifdef __GNUC__
#if !defined(_SOFT_FLOAT)
#include <math.h>
/*
FUNCTION
<<llrint>>, <<llrintf>>, <<llrintl>>---round and convert to long long integer
INDEX
llrint
INDEX
llrintf
INDEX
llrintl
ANSI_SYNOPSIS
#include <math.h>
long long int llrint(double x);
long long int llrintf(float x);
long long int llrintl(long double x);
TRAD_SYNOPSIS
ANSI-only.
DESCRIPTION
The <<llrint>>, <<llrintf>> and <<llrintl>> functions round <[x]> to the nearest integer value,
according to the current rounding direction. If the rounded value is outside the
range of the return type, the numeric result is unspecified. A range error may
occur if the magnitude of <[x]> is too large.
RETURNS
These functions return the rounded integer value of <[x]>.
<<llrint>>, <<llrintf>> and <<llrintl>> return the result as a long long integer.
PORTABILITY
<<llrint>>, <<llrintf>> and <<llrintl>> are ANSI.
<<llrint>>, <<llrintf>> and <<llrintl>> are only available on i386 platforms when
hardware floating point support is available and when compiling with GCC.
*/
/*
* Fast math version of llrint(x)
* Return x rounded to integral value according to the prevailing
* rounding mode.
* Method:
* Using inline x87 asms.
* Exception:
* Governed by x87 FPCR.
*/
long long int _f_llrint (double x)
{
long long int _result;
asm ("fistpll %0" : "=m" (_result) : "t" (x) : "st");
return _result;
}
/* For now, we only have the fast math version. */
long long int llrint (double x) {
return _f_llrint(x);
}
#endif /* !_SOFT_FLOAT */
#endif /* __GNUC__ */

View File

@ -0,0 +1,38 @@
/*
* ====================================================
* x87 FP implementation contributed to Newlib by
* Dave Korn, November 2007. This file is placed in the
* public domain. Permission to use, copy, modify, and
* distribute this software is freely granted.
* ====================================================
*/
#ifdef __GNUC__
#if !defined(_SOFT_FLOAT)
#include <math.h>
/*
* Fast math version of llrintf(x)
* Return x rounded to integral value according to the prevailing
* rounding mode.
* Method:
* Using inline x87 asms.
* Exception:
* Governed by x87 FPCR.
*/
long long int _f_llrintf (float x)
{
long long int _result;
asm ("fistpll %0" : "=m" (_result) : "t" (x) : "st");
return _result;
}
/* For now, we only have the fast math version. */
long long int llrintf (float x) {
return _f_llrintf(x);
}
#endif /* !_SOFT_FLOAT */
#endif /* __GNUC__ */

View File

@ -0,0 +1,38 @@
/*
* ====================================================
* x87 FP implementation contributed to Newlib by
* Dave Korn, November 2007. This file is placed in the
* public domain. Permission to use, copy, modify, and
* distribute this software is freely granted.
* ====================================================
*/
#ifdef __GNUC__
#if !defined(_SOFT_FLOAT)
#include <math.h>
/*
* Fast math version of llrintl(x)
* Return x rounded to integral value according to the prevailing
* rounding mode.
* Method:
* Using inline x87 asms.
* Exception:
* Governed by x87 FPCR.
*/
long long int _f_llrintl (long double x)
{
long long int _result;
asm ("fistpll %0" : "=m" (_result) : "t" (x) : "st");
return _result;
}
/* For now, we only have the fast math version. */
long long int llrintl (long double x) {
return _f_llrintl(x);
}
#endif /* !_SOFT_FLOAT */
#endif /* __GNUC__ */

View File

@ -0,0 +1,69 @@
/*
* ====================================================
* x87 FP implementation contributed to Newlib by
* Dave Korn, November 2007. This file is placed in the
* public domain. Permission to use, copy, modify, and
* distribute this software is freely granted.
* ====================================================
*/
#if defined(__GNUC__) && !defined(_SOFT_FLOAT)
#include <math.h>
/*
FUNCTION
<<lrint>>, <<lrintf>>, <<lrintl>>---round and convert to long integer
INDEX
lrint
INDEX
lrintf
INDEX
lrintl
ANSI_SYNOPSIS
#include <math.h>
long int lrint(double x);
long int lrintf(float x);
long int lrintl(long double x);
TRAD_SYNOPSIS
ANSI-only.
DESCRIPTION
The <<lrint>>, <<lrintf>> and <<lrintl>> functions round <[x]> to the nearest integer value,
according to the current rounding direction. If the rounded value is outside the
range of the return type, the numeric result is unspecified. A range error may
occur if the magnitude of <[x]> is too large.
RETURNS
These functions return the rounded integer value of <[x]>.
<<lrint>>, <<lrintf>> and <<lrintl>> return the result as a long integer.
PORTABILITY
<<lrint>>, <<lrintf>>, and <<lrintl>> are ANSI.
<<lrint>> and <<lrintf>> are available on all platforms.
<<lrintl>> is only available on i386 platforms when hardware
floating point support is available and when compiling with GCC.
*/
/*
* Fast math version of lrint(x)
* Return x rounded to integral value according to the prevailing
* rounding mode.
* Method:
* Using inline x87 asms.
* Exception:
* Governed by x87 FPCR.
*/
long int _f_lrint (double x)
{
long int _result;
asm ("fistpl %0" : "=m" (_result) : "t" (x) : "st");
return _result;
}
#endif /* !__GNUC__ || _SOFT_FLOAT */

View File

@ -0,0 +1,32 @@
/*
* ====================================================
* x87 FP implementation contributed to Newlib by
* Dave Korn, November 2007. This file is placed in the
* public domain. Permission to use, copy, modify, and
* distribute this software is freely granted.
* ====================================================
*/
#if defined(__GNUC__) && !defined(_SOFT_FLOAT)
#include <math.h>
/*
* Fast math version of lrintf(x)
* Return x rounded to integral value according to the prevailing
* rounding mode.
* Method:
* Using inline x87 asms.
* Exception:
* Governed by x87 FPCR.
*/
long int _f_lrintf (float x)
{
long int _result;
asm ("fistpl %0" : "=m" (_result) : "t" (x) : "st");
return _result;
}
#endif /* !__GNUC__ || _SOFT_FLOAT */

View File

@ -0,0 +1,38 @@
/*
* ====================================================
* x87 FP implementation contributed to Newlib by
* Dave Korn, November 2007. This file is placed in the
* public domain. Permission to use, copy, modify, and
* distribute this software is freely granted.
* ====================================================
*/
#ifdef __GNUC__
#if !defined(_SOFT_FLOAT)
#include <math.h>
/*
* Fast math version of lrintl(x)
* Return x rounded to integral value according to the prevailing
* rounding mode.
* Method:
* Using inline x87 asms.
* Exception:
* Governed by x87 FPCR.
*/
long int _f_lrintl (long double x)
{
long int _result;
asm ("fistpl %0" : "=m" (_result) : "t" (x) : "st");
return _result;
}
/* For now, there is only the fast math version so we use it. */
long int lrintl (long double x) {
return _f_lrintl(x);
}
#endif /* !_SOFT_FLOAT */
#endif /* __GNUC__ */

View File

@ -0,0 +1,67 @@
/*
* ====================================================
* x87 FP implementation contributed to Newlib by
* Dave Korn, November 2007. This file is placed in the
* public domain. Permission to use, copy, modify, and
* distribute this software is freely granted.
* ====================================================
*/
#if defined(__GNUC__) && !defined(_SOFT_FLOAT)
#include <math.h>
/*
FUNCTION
<<rint>>, <<rintf>>, <<rintl>>---round to integer
INDEX
rint
INDEX
rintf
INDEX
rintl
ANSI_SYNOPSIS
#include <math.h>
double rint(double x);
float rintf(float x);
long double rintl(long double x);
TRAD_SYNOPSIS
ANSI-only.
DESCRIPTION
The <<rint>>, <<rintf>> and <<rintl>> functions round <[x]> to an integer value
in floating-point format, using the current rounding direction. They may
raise the inexact exception if the result differs in value from the argument.
RETURNS
These functions return the rounded integer value of <[x]>.
PORTABILITY
<<rint>>, <<rintf>> and <<rintl>> are ANSI.
<<rint>> and <<rintf>> are available on all platforms.
<<rintl>> is only available on i386 platforms when hardware
floating point support is available and when compiling with GCC.
*/
/*
* Fast math version of rint(x)
* Return x rounded to integral value according to the prevailing
* rounding mode.
* Method:
* Using inline x87 asms.
* Exception:
* Governed by x87 FPCR.
*/
double _f_rint (double x)
{
double _result;
asm ("frndint" : "=t" (_result) : "0" (x));
return _result;
}
#endif /* !__GNUC__ || _SOFT_FLOAT */

View File

@ -0,0 +1,32 @@
/*
* ====================================================
* x87 FP implementation contributed to Newlib by
* Dave Korn, November 2007. This file is placed in the
* public domain. Permission to use, copy, modify, and
* distribute this software is freely granted.
* ====================================================
*/
#if defined(__GNUC__) && !defined(_SOFT_FLOAT)
#include <math.h>
/*
* Fast math version of rintf(x)
* Return x rounded to integral value according to the prevailing
* rounding mode.
* Method:
* Using inline x87 asms.
* Exception:
* Governed by x87 FPCR.
*/
float _f_rintf (float x)
{
float _result;
asm ("frndint" : "=t" (_result) : "0" (x));
return _result;
}
#endif /* !__GNUC__ || _SOFT_FLOAT */

View File

@ -0,0 +1,38 @@
/*
* ====================================================
* x87 FP implementation contributed to Newlib by
* Dave Korn, November 2007. This file is placed in the
* public domain. Permission to use, copy, modify, and
* distribute this software is freely granted.
* ====================================================
*/
#ifdef __GNUC__
#if !defined(_SOFT_FLOAT)
#include <math.h>
/*
* Fast math version of rintl(x)
* Return x rounded to integral value according to the prevailing
* rounding mode.
* Method:
* Using inline x87 asms.
* Exception:
* Governed by x87 FPCR.
*/
long double _f_rintl (long double x)
{
long double _result;
asm ("frndint" : "=t" (_result) : "0" (x));
return _result;
}
/* For now, we only have the fast math version. */
long double rintl (long double x) {
return _f_rintl(x);
}
#endif /* !_SOFT_FLOAT */
#endif /* __GNUC__ */