about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/i386/fpu/feupdateenv.c3
-rw-r--r--sysdeps/i386/fpu/ftestexcept.c3
-rw-r--r--sysdeps/i386/i686/multiarch/s_fmaf.c2
-rw-r--r--sysdeps/ia64/fpu/feupdateenv.c3
-rw-r--r--sysdeps/ia64/fpu/ftestexcept.c3
-rw-r--r--sysdeps/ieee754/dbl-64/s_fmaf.c50
-rw-r--r--sysdeps/powerpc/fpu/feupdateenv.c3
-rw-r--r--sysdeps/powerpc/fpu/ftestexcept.c3
-rw-r--r--sysdeps/s390/fpu/feupdateenv.c3
-rw-r--r--sysdeps/s390/fpu/ftestexcept.c3
-rw-r--r--sysdeps/sh/sh4/fpu/ftestexcept.c3
-rw-r--r--sysdeps/sparc/fpu/feupdateenv.c3
-rw-r--r--sysdeps/sparc/fpu/ftestexcept.c3
-rw-r--r--sysdeps/x86_64/fpu/feupdateenv.c3
-rw-r--r--sysdeps/x86_64/fpu/ftestexcept.c3
-rw-r--r--sysdeps/x86_64/multiarch/s_fmaf.c4
16 files changed, 79 insertions, 16 deletions
diff --git a/sysdeps/i386/fpu/feupdateenv.c b/sysdeps/i386/fpu/feupdateenv.c
index a58963837f..e283403bf7 100644
--- a/sysdeps/i386/fpu/feupdateenv.c
+++ b/sysdeps/i386/fpu/feupdateenv.c
@@ -1,5 +1,5 @@
 /* Install given floating-point environment and raise exceptions.
-   Copyright (C) 1997,99,2000,01,07 Free Software Foundation, Inc.
+   Copyright (C) 1997,99,2000,01,07,2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -57,4 +57,5 @@ strong_alias (__feupdateenv, __old_feupdateenv)
 compat_symbol (libm, BP_SYM (__old_feupdateenv), BP_SYM (feupdateenv), GLIBC_2_1);
 #endif
 
+libm_hidden_ver (__feupdateenv, feupdateenv)
 versioned_symbol (libm, BP_SYM (__feupdateenv), BP_SYM (feupdateenv), GLIBC_2_2);
diff --git a/sysdeps/i386/fpu/ftestexcept.c b/sysdeps/i386/fpu/ftestexcept.c
index 1979fe13fd..1c0ae0d02c 100644
--- a/sysdeps/i386/fpu/ftestexcept.c
+++ b/sysdeps/i386/fpu/ftestexcept.c
@@ -1,5 +1,5 @@
 /* Test exception in current environment.
-   Copyright (C) 1997, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2003, 2004, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -38,3 +38,4 @@ fetestexcept (int excepts)
 
   return (temp | xtemp) & excepts & FE_ALL_EXCEPT;
 }
+libm_hidden_def (fetestexcept)
diff --git a/sysdeps/i386/i686/multiarch/s_fmaf.c b/sysdeps/i386/i686/multiarch/s_fmaf.c
index 4ea9be48ac..a52bd56e8f 100644
--- a/sysdeps/i386/i686/multiarch/s_fmaf.c
+++ b/sysdeps/i386/i686/multiarch/s_fmaf.c
@@ -33,4 +33,4 @@ weak_alias (__fmaf, fmaf)
 # define __fmaf __fmaf_ia32
 #endif
 
-#include <math/s_fmaf.c>
+#include <sysdeps/ieee754/dbl-64/s_fmaf.c>
diff --git a/sysdeps/ia64/fpu/feupdateenv.c b/sysdeps/ia64/fpu/feupdateenv.c
index 72f12287fa..f961fdca38 100644
--- a/sysdeps/ia64/fpu/feupdateenv.c
+++ b/sysdeps/ia64/fpu/feupdateenv.c
@@ -1,5 +1,5 @@
 /* Install given floating-point environment and raise exceptions.
-   Copyright (C) 1997, 2000, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2000, 2007, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Christian Boissat <Christian.Boissat@cern.ch>, 1999.
 
@@ -38,3 +38,4 @@ feupdateenv (const fenv_t *envp)
   /* Success.  */
   return 0;
 }
+libm_hidden_def (feupdateenv)
diff --git a/sysdeps/ia64/fpu/ftestexcept.c b/sysdeps/ia64/fpu/ftestexcept.c
index 64c37d8c8f..0d8190b46e 100644
--- a/sysdeps/ia64/fpu/ftestexcept.c
+++ b/sysdeps/ia64/fpu/ftestexcept.c
@@ -1,5 +1,5 @@
 /* Test exception in current environment.
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Christian Boissat <Christian.Boissat@cern.ch>, 1999.
 
@@ -30,3 +30,4 @@ fetestexcept (int excepts)
 
   return (fpsr >> 13) & excepts & FE_ALL_EXCEPT;
 }
+libm_hidden_def (fetestexcept)
diff --git a/sysdeps/ieee754/dbl-64/s_fmaf.c b/sysdeps/ieee754/dbl-64/s_fmaf.c
new file mode 100644
index 0000000000..9721876601
--- /dev/null
+++ b/sysdeps/ieee754/dbl-64/s_fmaf.c
@@ -0,0 +1,50 @@
+/* Compute x * y + z as ternary operation.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@redhat.com>, 2010.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+#include <fenv.h>
+#include <ieee754.h>
+
+/* This implementation relies on double being more than twice as
+   precise as float and uses rounding to odd in order to avoid problems
+   with double rounding.
+   See a paper by Boldo and Melquiond:
+   http://www.lri.fr/~melquion/doc/08-tc.pdf  */
+
+float
+__fmaf (float x, float y, float z)
+{
+  fenv_t env;
+  /* Multiplication is always exact.  */
+  double temp = (double) x * (double) y;
+  union ieee754_double u;
+  feholdexcept (&env);
+  fesetround (FE_TOWARDZERO);
+  /* Perform addition with round to odd.  */
+  u.d = temp + (double) z;
+  if ((u.ieee.mantissa1 & 1) == 0 && u.ieee.exponent != 0xff)
+    u.ieee.mantissa1 |= fetestexcept (FE_INEXACT) != 0;
+  feupdateenv (&env);
+  /* And finally truncation with round to nearest.  */
+  return (float) u.d;
+}
+#ifndef __fmaf
+weak_alias (__fmaf, fmaf)
+#endif
diff --git a/sysdeps/powerpc/fpu/feupdateenv.c b/sysdeps/powerpc/fpu/feupdateenv.c
index 5fca301fe5..9a157c54fb 100644
--- a/sysdeps/powerpc/fpu/feupdateenv.c
+++ b/sysdeps/powerpc/fpu/feupdateenv.c
@@ -1,5 +1,5 @@
 /* Install given floating-point environment and raise exceptions.
-   Copyright (C) 1997, 1999, 2000, 2001, 2007, 2008
+   Copyright (C) 1997, 1999, 2000, 2001, 2007, 2008, 2010
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -66,4 +66,5 @@ strong_alias (__feupdateenv, __old_feupdateenv)
 compat_symbol (libm, BP_SYM (__old_feupdateenv), BP_SYM (feupdateenv), GLIBC_2_1);
 #endif
 
+libm_hidden_ver (__feupdateenv, feupdateenv)
 versioned_symbol (libm, BP_SYM (__feupdateenv), BP_SYM (feupdateenv), GLIBC_2_2);
diff --git a/sysdeps/powerpc/fpu/ftestexcept.c b/sysdeps/powerpc/fpu/ftestexcept.c
index 64406c41dc..cda11f56b4 100644
--- a/sysdeps/powerpc/fpu/ftestexcept.c
+++ b/sysdeps/powerpc/fpu/ftestexcept.c
@@ -1,5 +1,5 @@
 /* Test exception in current environment.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -31,3 +31,4 @@ fetestexcept (int excepts)
      just:  */
   return u.l[1] & excepts;
 }
+libm_hidden_def (fetestexcept)
diff --git a/sysdeps/s390/fpu/feupdateenv.c b/sysdeps/s390/fpu/feupdateenv.c
index 64411e880b..80f9687d71 100644
--- a/sysdeps/s390/fpu/feupdateenv.c
+++ b/sysdeps/s390/fpu/feupdateenv.c
@@ -1,5 +1,5 @@
 /* Install given floating-point environment and raise exceptions.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com).
 
@@ -38,3 +38,4 @@ feupdateenv (const fenv_t *envp)
   /* Success.  */
   return 0;
 }
+libm_hidden_def (feupdateenv)
diff --git a/sysdeps/s390/fpu/ftestexcept.c b/sysdeps/s390/fpu/ftestexcept.c
index 51af57e90e..50d5afe3ee 100644
--- a/sysdeps/s390/fpu/ftestexcept.c
+++ b/sysdeps/s390/fpu/ftestexcept.c
@@ -1,5 +1,5 @@
 /* Test exception in current environment.
-   Copyright (C) 2000 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com).
 
@@ -31,3 +31,4 @@ fetestexcept (int excepts)
   temp = (temp >> FPC_DXC_SHIFT) | (temp >> FPC_FLAGS_SHIFT);
   return temp & excepts & FE_ALL_EXCEPT;
 }
+libm_hidden_def (fetestexcept)
diff --git a/sysdeps/sh/sh4/fpu/ftestexcept.c b/sysdeps/sh/sh4/fpu/ftestexcept.c
index 17a2ccfc80..a15868b02c 100644
--- a/sysdeps/sh/sh4/fpu/ftestexcept.c
+++ b/sysdeps/sh/sh4/fpu/ftestexcept.c
@@ -1,5 +1,5 @@
 /* Test exception in current environment.
-   Copyright (C) 1997, 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 2000, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -30,3 +30,4 @@ fetestexcept (int excepts)
 
   return temp & excepts & FE_ALL_EXCEPT;
 }
+libm_hidden_def (fetestexcept)
diff --git a/sysdeps/sparc/fpu/feupdateenv.c b/sysdeps/sparc/fpu/feupdateenv.c
index b2615379b9..008c379a1e 100644
--- a/sysdeps/sparc/fpu/feupdateenv.c
+++ b/sysdeps/sparc/fpu/feupdateenv.c
@@ -1,5 +1,5 @@
 /* Install given floating-point environment and raise exceptions.
-   Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2000, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -46,4 +46,5 @@ strong_alias (__feupdateenv, __old_feupdateenv)
 compat_symbol (libm, __old_feupdateenv, feupdateenv, GLIBC_2_1);
 #endif
 
+libm_hidden_ver (__feupdateenv, feupdateenv)
 versioned_symbol (libm, __feupdateenv, feupdateenv, GLIBC_2_2);
diff --git a/sysdeps/sparc/fpu/ftestexcept.c b/sysdeps/sparc/fpu/ftestexcept.c
index abfaa3299d..e77f513b17 100644
--- a/sysdeps/sparc/fpu/ftestexcept.c
+++ b/sysdeps/sparc/fpu/ftestexcept.c
@@ -1,5 +1,5 @@
 /* Test exception in current environment.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -28,3 +28,4 @@ fetestexcept (int excepts)
 
   return tmp & excepts & FE_ALL_EXCEPT;
 }
+libm_hidden_def (fetestexcept)
diff --git a/sysdeps/x86_64/fpu/feupdateenv.c b/sysdeps/x86_64/fpu/feupdateenv.c
index e23f1affa6..291c56bd10 100644
--- a/sysdeps/x86_64/fpu/feupdateenv.c
+++ b/sysdeps/x86_64/fpu/feupdateenv.c
@@ -1,5 +1,5 @@
 /* Install given floating-point environment and raise exceptions.
-   Copyright (C) 1997,99,2000,01,07 Free Software Foundation, Inc.
+   Copyright (C) 1997,99,2000,01,07,2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -48,4 +48,5 @@ strong_alias (__feupdateenv, __old_feupdateenv)
 compat_symbol (libm, __old_feupdateenv, feupdateenv, GLIBC_2_1);
 #endif
 
+libm_hidden_ver (__feupdateenv, feupdateenv)
 versioned_symbol (libm, __feupdateenv, feupdateenv, GLIBC_2_2);
diff --git a/sysdeps/x86_64/fpu/ftestexcept.c b/sysdeps/x86_64/fpu/ftestexcept.c
index 091c25157b..f3b54ad80c 100644
--- a/sysdeps/x86_64/fpu/ftestexcept.c
+++ b/sysdeps/x86_64/fpu/ftestexcept.c
@@ -1,5 +1,5 @@
 /* Test exception in current environment.
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -31,3 +31,4 @@ fetestexcept (int excepts)
 
   return (temp | mxscr) & excepts & FE_ALL_EXCEPT;
 }
+libm_hidden_def (fetestexcept)
diff --git a/sysdeps/x86_64/multiarch/s_fmaf.c b/sysdeps/x86_64/multiarch/s_fmaf.c
index de1c4b6f41..85ef65a50e 100644
--- a/sysdeps/x86_64/multiarch/s_fmaf.c
+++ b/sysdeps/x86_64/multiarch/s_fmaf.c
@@ -1,5 +1,5 @@
 /* FMA version of fmaf.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -39,4 +39,4 @@ weak_alias (__fmaf, fmaf)
 # define __fmaf __fmaf_sse2
 #endif
 
-#include <math/s_fmaf.c>
+#include <sysdeps/ieee754/dbl-64/s_fmaf.c>