@@ -15,6 +15,7 @@ extern int __fesetenv (const fenv_t *__envp);
extern int __feupdateenv (const fenv_t *__envp);
libm_hidden_proto (feraiseexcept)
+libm_hidden_proto (__feraiseexcept)
libm_hidden_proto (fegetenv)
libm_hidden_proto (fegetround)
libm_hidden_proto (fesetenv)
@@ -27,7 +27,7 @@ invalid_fn (double x, double fn)
{
if (__rint (fn) != fn)
{
- feraiseexcept (FE_INVALID);
+ __feraiseexcept (FE_INVALID);
return __nan ("");
}
else if (fn > 65000.0)
@@ -30,6 +30,7 @@ __feraiseexcept (int excepts)
strong_alias (__feraiseexcept, __old_feraiseexcept)
compat_symbol (libm, __old_feraiseexcept, feraiseexcept, GLIBC_2_1);
#endif
+libm_hidden_def (__feraiseexcept)
libm_hidden_ver (__feraiseexcept, feraiseexcept)
versioned_symbol (libm, __feraiseexcept, feraiseexcept, GLIBC_2_2);
@@ -29,7 +29,7 @@ __acos (double x)
&& _LIB_VERSION != _IEEE_)
{
/* acos(|x|>1) */
- feraiseexcept (FE_INVALID);
+ __feraiseexcept (FE_INVALID);
return __kernel_standard (x, x, 1);
}
@@ -29,7 +29,7 @@ __asin (double x)
&& _LIB_VERSION != _IEEE_)
{
/* asin(|x|>1) */
- feraiseexcept (FE_INVALID);
+ __feraiseexcept (FE_INVALID);
return __kernel_standard (x, x, 2);
}
@@ -31,7 +31,7 @@ __ilogb (double x)
|| __builtin_expect (r == INT_MAX, 0))
{
__set_errno (EDOM);
- feraiseexcept (FE_INVALID);
+ __feraiseexcept (FE_INVALID);
}
return r;
}
@@ -47,13 +47,13 @@ y0 (double x)
if (x < 0.0)
{
/* d = zero/(x-x) */
- feraiseexcept (FE_INVALID);
+ __feraiseexcept (FE_INVALID);
return __kernel_standard (x, x, 9);
}
else if (x == 0.0)
{
/* d = -one/(x-x) */
- feraiseexcept (FE_DIVBYZERO);
+ __feraiseexcept (FE_DIVBYZERO);
return __kernel_standard (x, x, 8);
}
else if (_LIB_VERSION != _POSIX_)
@@ -47,13 +47,13 @@ y1 (double x)
if (x < 0.0)
{
/* d = zero/(x-x) */
- feraiseexcept (FE_INVALID);
+ __feraiseexcept (FE_INVALID);
return __kernel_standard (x, x, 11);
}
else if (x == 0.0)
{
/* d = -one/(x-x) */
- feraiseexcept (FE_DIVBYZERO);
+ __feraiseexcept (FE_DIVBYZERO);
return __kernel_standard (x, x, 10);
}
else if (_LIB_VERSION != _POSIX_)
@@ -47,13 +47,13 @@ yn (int n, double x)
if (x < 0.0)
{
/* d = zero/(x-x) */
- feraiseexcept (FE_INVALID);
+ __feraiseexcept (FE_INVALID);
return __kernel_standard (n, x, 13);
}
else if (x == 0.0)
{
/* d = -one/(x-x) */
- feraiseexcept (FE_DIVBYZERO);
+ __feraiseexcept (FE_DIVBYZERO);
return __kernel_standard (n, x, 12);
}
else if (_LIB_VERSION != _POSIX_)
@@ -29,12 +29,12 @@ __log (double x)
{
if (x == 0.0)
{
- feraiseexcept (FE_DIVBYZERO);
+ __feraiseexcept (FE_DIVBYZERO);
return __kernel_standard (x, x, 16); /* log(0) */
}
else
{
- feraiseexcept (FE_INVALID);
+ __feraiseexcept (FE_INVALID);
return __kernel_standard (x, x, 17); /* log(x<0) */
}
}
@@ -29,12 +29,12 @@ __log10 (double x)
{
if (x == 0.0)
{
- feraiseexcept (FE_DIVBYZERO);
+ __feraiseexcept (FE_DIVBYZERO);
return __kernel_standard (x, x, 18); /* log10(0) */
}
else
{
- feraiseexcept (FE_INVALID);
+ __feraiseexcept (FE_INVALID);
return __kernel_standard (x, x, 19); /* log10(x<0) */
}
}
@@ -45,7 +45,7 @@ feupdateenv (const fenv_t *envp)
_FPU_SETFPSR (fpsr_new);
if (excepts & (fpcr_new >> FE_EXCEPT_SHIFT))
- return feraiseexcept (excepts);
+ return __feraiseexcept (excepts);
return 0;
}
@@ -80,7 +80,7 @@ feupdateenv (const fenv_t *envp)
}
if (excepts & (fpcr_new >> FE_EXCEPT_SHIFT))
- return feraiseexcept (excepts);
+ return __feraiseexcept (excepts);
return 0;
}
@@ -21,7 +21,7 @@
#include <float.h>
int
-feraiseexcept (int excepts)
+__feraiseexcept (int excepts)
{
int fpsr;
const float fp_zero = 0.0;
@@ -88,4 +88,6 @@ feraiseexcept (int excepts)
return 0;
}
-libm_hidden_def (feraiseexcept)
+libm_hidden_def (__feraiseexcept)
+weak_alias (__feraiseexcept, feraiseexcept)
+libm_hidden_weak (feraiseexcept)
@@ -159,7 +159,7 @@ libc_feupdateenv_test_aarch64 (const fenv_t *envp, int ex)
/* Raise the exceptions if enabled in the new FP state. */
if (__glibc_unlikely (excepts & (new_fpcr >> FE_EXCEPT_SHIFT)))
- feraiseexcept (excepts);
+ __feraiseexcept (excepts);
return excepts & ex;
}
@@ -33,7 +33,7 @@ __feupdateenv (const fenv_t *envp)
/* Raise the saved exception. Incidently for us the implementation
defined format of the values in objects of type fexcept_t is the
same as the ones specified using the FE_* constants. */
- feraiseexcept (tmp & SWCR_STATUS_MASK);
+ __feraiseexcept (tmp & SWCR_STATUS_MASK);
/* Success. */
return 0;
@@ -129,7 +129,7 @@ libc_feupdateenv_test_vfp (const fenv_t *envp, int ex)
/* Raise the exceptions if enabled in the new FP state. */
if (__glibc_unlikely (excepts & (new_fpscr >> FE_EXCEPT_SHIFT)))
- feraiseexcept (excepts);
+ __feraiseexcept (excepts);
return excepts & ex;
}
@@ -46,7 +46,7 @@ feupdateenv (const fenv_t *envp)
/* Raise the exceptions if enabled in the new FP state. */
if (excepts & (new_fpscr >> FE_EXCEPT_SHIFT))
- return feraiseexcept (excepts);
+ return __feraiseexcept (excepts);
return 0;
}
@@ -69,7 +69,7 @@ feupdateenv (const fenv_t *envp)
/* Raise the exceptions if enabled in the new FP state. */
if (excepts & (new_fpscr >> FE_EXCEPT_SHIFT))
- return feraiseexcept (excepts);
+ return __feraiseexcept (excepts);
return 0;
}
@@ -23,7 +23,7 @@
int
-feraiseexcept (int excepts)
+__feraiseexcept (int excepts)
{
/* Fail if a VFP unit isn't present unless nothing needs to be done. */
if (!ARM_HAVE_VFP)
@@ -102,4 +102,6 @@ feraiseexcept (int excepts)
return 0;
}
}
-libm_hidden_def (feraiseexcept)
+libm_hidden_def (__feraiseexcept)
+weak_alias (__feraiseexcept, feraiseexcept)
+libm_hidden_weak (feraiseexcept)
@@ -25,7 +25,7 @@
page 10-5 "Delayed Trapping" in the PA-RISC 2.0 Architecture manual */
int
-feraiseexcept (int excepts)
+__feraiseexcept (int excepts)
{
/* Raise exceptions represented by EXCEPTS. But we must raise only one
signal at a time. It is important that if the overflow/underflow
@@ -98,4 +98,6 @@ feraiseexcept (int excepts)
/* Success. */
return 0;
}
-libm_hidden_def (feraiseexcept)
+libm_hidden_def (__feraiseexcept)
+weak_alias (__feraiseexcept, feraiseexcept)
+libm_hidden_weak (feraiseexcept)
@@ -119,5 +119,6 @@ strong_alias (__feraiseexcept, __old_feraiseexcept)
compat_symbol (libm, __old_feraiseexcept, feraiseexcept, GLIBC_2_1);
#endif
+libm_hidden_def (__feraiseexcept)
libm_hidden_ver (__feraiseexcept, feraiseexcept)
versioned_symbol (libm, __feraiseexcept, feraiseexcept, GLIBC_2_2);
@@ -32,7 +32,7 @@ feupdateenv (const fenv_t *envp)
fesetenv (envp);
/* Raise the saved exceptions. */
- feraiseexcept ((int) (fpsr >> 13) & FE_ALL_EXCEPT);
+ __feraiseexcept ((int) (fpsr >> 13) & FE_ALL_EXCEPT);
/* Success. */
return 0;
@@ -24,7 +24,7 @@
#include <unistd.h>
int
-feraiseexcept (int excepts)
+__feraiseexcept (int excepts)
{
double tmp;
double dummy;
@@ -75,4 +75,6 @@ feraiseexcept (int excepts)
/* Success. */
return 0;
}
-libm_hidden_def (feraiseexcept)
+libm_hidden_def (__feraiseexcept)
+weak_alias (__feraiseexcept, feraiseexcept)
+libm_hidden_weak (feraiseexcept)
@@ -21,7 +21,7 @@
#include <math.h>
int
-feraiseexcept (int excepts)
+__feraiseexcept (int excepts)
{
/* Raise exceptions represented by EXCEPTS. But we must raise only one
signal at a time. It is important that if the overflow/underflow
@@ -63,4 +63,6 @@ feraiseexcept (int excepts)
/* Success. */
return 0;
}
-libm_hidden_def (feraiseexcept)
+libm_hidden_def (__feraiseexcept)
+weak_alias (__feraiseexcept, feraiseexcept)
+libm_hidden_weak (feraiseexcept)
@@ -34,7 +34,7 @@ __feupdateenv (const fenv_t *envp)
/* Raise the saved exception. Incidently for us the implementation
defined format of the values in objects of type fexcept_t is the
same as the ones specified using the FE_* constants. */
- feraiseexcept ((int) fpsr);
+ __feraiseexcept ((int) fpsr);
/* Success. */
return 0;
@@ -28,6 +28,7 @@
#include_next <math_private.h>
#define feraiseexcept(excepts) ({ 0; })
+#define __feraiseexcept(excepts) ({ 0; })
#define feclearexcept(exc) ({ 0; })
#endif
@@ -35,7 +35,7 @@ feupdateenv (const fenv_t *envp)
/* Raise the safed exception. Incidently for us the implementation
defined format of the values in objects of type fexcept_t is the
same as the ones specified using the FE_* constants. */
- feraiseexcept (temp);
+ __feraiseexcept (temp);
/* Success. */
return 0;
@@ -22,7 +22,7 @@
#include <fpu_control.h>
int
-feraiseexcept (int excepts)
+__feraiseexcept (int excepts)
{
fpu_control_t cw;
@@ -43,4 +43,6 @@ feraiseexcept (int excepts)
return 0;
}
-libm_hidden_def (feraiseexcept)
+libm_hidden_def (__feraiseexcept)
+weak_alias (__feraiseexcept, feraiseexcept)
+libm_hidden_weak (feraiseexcept)
@@ -142,12 +142,12 @@ __slow_ieee754_sqrt (double x)
/* For some reason, some PowerPC32 processors don't implement
FE_INVALID_SQRT. */
#ifdef FE_INVALID_SQRT
- feraiseexcept (FE_INVALID_SQRT);
+ __feraiseexcept (FE_INVALID_SQRT);
fenv_union_t u = { .fenv = fegetenv_register () };
if ((u.l & FE_INVALID) == 0)
#endif
- feraiseexcept (FE_INVALID);
+ __feraiseexcept (FE_INVALID);
x = a_nan.value;
}
return f_wash (x);
@@ -63,5 +63,6 @@ strong_alias (__feraiseexcept, __old_feraiseexcept)
compat_symbol (libm, __old_feraiseexcept, feraiseexcept, GLIBC_2_1);
#endif
+libm_hidden_def (__feraiseexcept)
libm_hidden_ver (__feraiseexcept, feraiseexcept)
versioned_symbol (libm, __feraiseexcept, feraiseexcept, GLIBC_2_2);
@@ -38,5 +38,6 @@ strong_alias (__feraiseexcept, __old_feraiseexcept)
compat_symbol (libm, __old_feraiseexcept, feraiseexcept, GLIBC_2_1);
#endif
+libm_hidden_def (__feraiseexcept)
libm_hidden_ver (__feraiseexcept, feraiseexcept)
versioned_symbol (libm, __feraiseexcept, feraiseexcept, GLIBC_2_2);
@@ -36,5 +36,6 @@ strong_alias (__feraiseexcept, __old_feraiseexcept)
compat_symbol (libm, __old_feraiseexcept, feraiseexcept, GLIBC_2_1);
#endif
+libm_hidden_def (__feraiseexcept)
libm_hidden_ver (__feraiseexcept, feraiseexcept)
versioned_symbol (libm, __feraiseexcept, feraiseexcept, GLIBC_2_2);
@@ -32,7 +32,7 @@ feupdateenv (const fenv_t *envp)
/* Raise the exceptions since the last call to feholdenv */
/* re install saved environment. */
fesetenv (envp);
- feraiseexcept ((int) temp);
+ __feraiseexcept ((int) temp);
/* Success. */
return 0;
@@ -37,7 +37,7 @@ fexceptadd (float d, float e)
int
-feraiseexcept (int excepts)
+__feraiseexcept (int excepts)
{
/* Raise exceptions represented by EXPECTS. But we must raise only
one signal at a time. It is important that if the overflow/underflow
@@ -69,4 +69,6 @@ feraiseexcept (int excepts)
/* Success. */
return 0;
}
-libm_hidden_def (feraiseexcept)
+libm_hidden_def (__feraiseexcept)
+weak_alias (__feraiseexcept, feraiseexcept)
+libm_hidden_weak (feraiseexcept)
@@ -32,7 +32,7 @@ feupdateenv (const fenv_t *envp)
defined format of the values in objects of type fexcept_t is the
same as the ones specified using the FE_* constants. */
fesetenv (envp);
- feraiseexcept ((int) temp);
+ __feraiseexcept ((int) temp);
return 0;
}
@@ -23,7 +23,7 @@
#include <math.h>
int
-feraiseexcept (int excepts)
+__feraiseexcept (int excepts)
{
if (excepts == 0)
return 0;
@@ -70,4 +70,6 @@ feraiseexcept (int excepts)
return 0;
}
-libm_hidden_def (feraiseexcept)
+libm_hidden_def (__feraiseexcept)
+weak_alias (__feraiseexcept, feraiseexcept)
+libm_hidden_weak (feraiseexcept)
@@ -34,7 +34,7 @@ __feupdateenv (const fenv_t *envp)
/* Raise the safed exception. Incidently for us the implementation
defined format of the values in objects of type fexcept_t is the
same as the ones specified using the FE_* constants. */
- feraiseexcept ((int) tmp);
+ __feraiseexcept ((int) tmp);
/* Success. */
return 0;
@@ -86,5 +86,6 @@ strong_alias (__feraiseexcept, __old_feraiseexcept)
compat_symbol (libm, __old_feraiseexcept, feraiseexcept, GLIBC_2_1);
#endif
+libm_hidden_def (__feraiseexcept)
libm_hidden_ver (__feraiseexcept, feraiseexcept)
versioned_symbol (libm, __feraiseexcept, feraiseexcept, GLIBC_2_2);
@@ -26,6 +26,7 @@
#include_next <math_private.h>
#define feraiseexcept(excepts) ({ 0; })
+#define __feraiseexcept(excepts) ({ 0; })
#define feclearexcept(exc) ({ 0; })
#endif
@@ -52,6 +52,7 @@ END(__feraiseexcept)
strong_alias (__feraiseexcept, __old_feraiseexcept)
compat_symbol (libm, __old_feraiseexcept, feraiseexcept, GLIBC_2_1);
# endif
+libm_hidden_def (__feraiseexcept)
libm_hidden_ver (__feraiseexcept, feraiseexcept)
versioned_symbol (libm, __feraiseexcept, feraiseexcept, GLIBC_2_2);
#endif
@@ -107,39 +107,43 @@ __BEGIN_DECLS
/* Optimized versions. */
extern int __REDIRECT_NTH (__feraiseexcept_renamed, (int), feraiseexcept);
-__extern_inline int
-__NTH (feraiseexcept (int __excepts))
+__extern_always_inline void
+__NTH (__feraiseexcept_invalid_divbyzero (int __excepts))
{
- if (__builtin_constant_p (__excepts)
- && (__excepts & ~(FE_INVALID | FE_DIVBYZERO)) == 0)
+ if ((FE_INVALID & __excepts) != 0)
{
- if ((FE_INVALID & __excepts) != 0)
- {
- /* One example of an invalid operation is 0.0 / 0.0. */
- float __f = 0.0;
+ /* One example of an invalid operation is 0.0 / 0.0. */
+ float __f = 0.0;
# ifdef __SSE_MATH__
- __asm__ __volatile__ ("divss %0, %0 " : : "x" (__f));
+ __asm__ __volatile__ ("divss %0, %0 " : : "x" (__f));
# else
- __asm__ __volatile__ ("fdiv %%st, %%st(0); fwait"
- : "=t" (__f) : "0" (__f));
+ __asm__ __volatile__ ("fdiv %%st, %%st(0); fwait"
+ : "=t" (__f) : "0" (__f));
# endif
- (void) &__f;
- }
- if ((FE_DIVBYZERO & __excepts) != 0)
- {
- float __f = 1.0;
- float __g = 0.0;
+ (void) &__f;
+ }
+ if ((FE_DIVBYZERO & __excepts) != 0)
+ {
+ float __f = 1.0;
+ float __g = 0.0;
# ifdef __SSE_MATH__
- __asm__ __volatile__ ("divss %1, %0" : : "x" (__f), "x" (__g));
+ __asm__ __volatile__ ("divss %1, %0" : : "x" (__f), "x" (__g));
# else
- __asm__ __volatile__ ("fdivp %%st, %%st(1); fwait"
- : "=t" (__f) : "0" (__f), "u" (__g) : "st(1)");
+ __asm__ __volatile__ ("fdivp %%st, %%st(1); fwait"
+ : "=t" (__f) : "0" (__f), "u" (__g) : "st(1)");
# endif
- (void) &__f;
- }
-
+ (void) &__f;
+ }
+}
+__extern_inline int
+__NTH (feraiseexcept (int __excepts))
+{
+ if (__builtin_constant_p (__excepts)
+ && (__excepts & ~(FE_INVALID | FE_DIVBYZERO)) == 0)
+ {
+ __feraiseexcept_invalid_divbyzero (__excepts);
return 0;
}
new file mode 100644
@@ -0,0 +1,42 @@
+/* Wrapper for x86 bits/fenv.h for use when building glibc.
+ Copyright (C) 1997-2014 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
+ 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include_next <bits/fenv.h>
+
+/* Ensure __feraiseexcept calls in glibc are optimized the same as
+ feraiseexcept calls. */
+
+#ifdef __USE_EXTERN_INLINES
+__BEGIN_DECLS
+
+extern int __REDIRECT_NTH (____feraiseexcept_renamed, (int), __feraiseexcept);
+__extern_inline int
+__NTH (__feraiseexcept (int __excepts))
+{
+ if (__builtin_constant_p (__excepts)
+ && (__excepts & ~(FE_INVALID | FE_DIVBYZERO)) == 0)
+ {
+ __feraiseexcept_invalid_divbyzero (__excepts);
+ return 0;
+ }
+
+ return ____feraiseexcept_renamed (__excepts);
+}
+
+__END_DECLS
+#endif
@@ -116,5 +116,6 @@ __feraiseexcept (int excepts)
/* Success. */
return 0;
}
-strong_alias (__feraiseexcept, feraiseexcept)
-libm_hidden_def (feraiseexcept)
+libm_hidden_def (__feraiseexcept)
+weak_alias (__feraiseexcept, feraiseexcept)
+libm_hidden_weak (feraiseexcept)