Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2007-12-20 01:20:25 +0300
committerJeff Johnston <jjohnstn@redhat.com>2007-12-20 01:20:25 +0300
commit3cc8a378d117ead86181ed4d9b440d5a59b08779 (patch)
treed121480085cdb7b25e61b7b7c1126fa09e47ed93 /newlib/libm
parent73063e9364ec6dc9b2e909c295969190e9626e5f (diff)
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.
Diffstat (limited to 'newlib/libm')
-rw-r--r--newlib/libm/machine/i386/Makefile.am9
-rw-r--r--newlib/libm/machine/i386/Makefile.in101
-rw-r--r--newlib/libm/machine/i386/f_llrint.c74
-rw-r--r--newlib/libm/machine/i386/f_llrintf.c38
-rw-r--r--newlib/libm/machine/i386/f_llrintl.c38
-rw-r--r--newlib/libm/machine/i386/f_lrint.c69
-rw-r--r--newlib/libm/machine/i386/f_lrintf.c32
-rw-r--r--newlib/libm/machine/i386/f_lrintl.c38
-rw-r--r--newlib/libm/machine/i386/f_rint.c67
-rw-r--r--newlib/libm/machine/i386/f_rintf.c32
-rw-r--r--newlib/libm/machine/i386/f_rintl.c38
11 files changed, 518 insertions, 18 deletions
diff --git a/newlib/libm/machine/i386/Makefile.am b/newlib/libm/machine/i386/Makefile.am
index c858ea414..6fade2d9a 100644
--- a/newlib/libm/machine/i386/Makefile.am
+++ b/newlib/libm/machine/i386/Makefile.am
@@ -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
+
diff --git a/newlib/libm/machine/i386/Makefile.in b/newlib/libm/machine/i386/Makefile.in
index 2a0f9fdb0..7c2c1e804 100644
--- a/newlib/libm/machine/i386/Makefile.in
+++ b/newlib/libm/machine/i386/Makefile.in
@@ -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
diff --git a/newlib/libm/machine/i386/f_llrint.c b/newlib/libm/machine/i386/f_llrint.c
new file mode 100644
index 000000000..0fe27d7df
--- /dev/null
+++ b/newlib/libm/machine/i386/f_llrint.c
@@ -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__ */
diff --git a/newlib/libm/machine/i386/f_llrintf.c b/newlib/libm/machine/i386/f_llrintf.c
new file mode 100644
index 000000000..6b2dfb39b
--- /dev/null
+++ b/newlib/libm/machine/i386/f_llrintf.c
@@ -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__ */
diff --git a/newlib/libm/machine/i386/f_llrintl.c b/newlib/libm/machine/i386/f_llrintl.c
new file mode 100644
index 000000000..610270c3d
--- /dev/null
+++ b/newlib/libm/machine/i386/f_llrintl.c
@@ -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__ */
diff --git a/newlib/libm/machine/i386/f_lrint.c b/newlib/libm/machine/i386/f_lrint.c
new file mode 100644
index 000000000..b8cdabb5d
--- /dev/null
+++ b/newlib/libm/machine/i386/f_lrint.c
@@ -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 */
+
diff --git a/newlib/libm/machine/i386/f_lrintf.c b/newlib/libm/machine/i386/f_lrintf.c
new file mode 100644
index 000000000..da8ffa62d
--- /dev/null
+++ b/newlib/libm/machine/i386/f_lrintf.c
@@ -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 */
+
diff --git a/newlib/libm/machine/i386/f_lrintl.c b/newlib/libm/machine/i386/f_lrintl.c
new file mode 100644
index 000000000..eae2bca28
--- /dev/null
+++ b/newlib/libm/machine/i386/f_lrintl.c
@@ -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__ */
diff --git a/newlib/libm/machine/i386/f_rint.c b/newlib/libm/machine/i386/f_rint.c
new file mode 100644
index 000000000..e335d463c
--- /dev/null
+++ b/newlib/libm/machine/i386/f_rint.c
@@ -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 */
+
diff --git a/newlib/libm/machine/i386/f_rintf.c b/newlib/libm/machine/i386/f_rintf.c
new file mode 100644
index 000000000..a7dabb7f3
--- /dev/null
+++ b/newlib/libm/machine/i386/f_rintf.c
@@ -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 */
+
diff --git a/newlib/libm/machine/i386/f_rintl.c b/newlib/libm/machine/i386/f_rintl.c
new file mode 100644
index 000000000..0e67739b5
--- /dev/null
+++ b/newlib/libm/machine/i386/f_rintl.c
@@ -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__ */