2018-09-14 Joseph Myers <joseph@codesourcery.com>
+ * include/math.h [!_ISOMAC && !(__FINITE_MATH_ONLY__ &&
+ __FINITE_MATH_ONLY__ > 0) && !NO_MATH_REDIRECT] (rint): Redirect
+ using MATH_REDIRECT.
+ * sysdeps/aarch64/fpu/s_rint.c: Define NO_MATH_REDIRECT before
+ header inclusion.
+ * sysdeps/aarch64/fpu/s_rintf.c: Likewise.
+ * sysdeps/alpha/fpu/s_rint.c: Likewise.
+ * sysdeps/alpha/fpu/s_rintf.c: Likewise.
+ * sysdeps/i386/fpu/s_rintl.c: Likewise.
+ * sysdeps/ieee754/dbl-64/s_rint.c: Likewise.
+ * sysdeps/ieee754/dbl-64/wordsize-64/s_rint.c: Likewise.
+ * sysdeps/ieee754/float128/s_rintf128.c: Likewise.
+ * sysdeps/ieee754/flt-32/s_rintf.c: Likewise.
+ * sysdeps/ieee754/ldbl-128/s_rintl.c: Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/s_rintl.c: Likewise.
+ * sysdeps/m68k/coldfire/fpu/s_rint.c: Likewise.
+ * sysdeps/m68k/coldfire/fpu/s_rintf.c: Likewise.
+ * sysdeps/m68k/m680x0/fpu/s_rint.c: Likewise.
+ * sysdeps/m68k/m680x0/fpu/s_rintf.c: Likewise.
+ * sysdeps/m68k/m680x0/fpu/s_rintl.c: Likewise.
+ * sysdeps/powerpc/fpu/s_rint.c: Likewise.
+ * sysdeps/powerpc/fpu/s_rintf.c: Likewise.
+ * sysdeps/riscv/rv64/rvd/s_rint.c: Likewise.
+ * sysdeps/riscv/rvf/s_rintf.c: Likewise.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rint.c: Likewise.
+ * sysdeps/sparc/sparc32/sparcv9/fpu/multiarch/s_rintf.c: Likewise.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_rint.c: Likewise.
+ * sysdeps/sparc/sparc64/fpu/multiarch/s_rintf.c: Likewise.
+ * sysdeps/x86_64/fpu/multiarch/s_rint.c: Likewise.
+ * sysdeps/x86_64/fpu/multiarch/s_rintf.c: Likewise.
+ * sysdeps/x86_64/fpu/math_private.h: Remove file.
+ * math/e_scalb.c (invalid_fn): Use rint functions instead of
+ __rint variants.
+ * math/e_scalbf.c (invalid_fn): Likewise.
+ * math/e_scalbl.c (invalid_fn): Likewise.
+ * sysdeps/ieee754/dbl-64/e_gamma_r.c (__ieee754_gamma_r):
+ Likewise.
+ * sysdeps/ieee754/flt-32/e_gammaf_r.c (__ieee754_gammaf_r):
+ Likewise.
+ * sysdeps/ieee754/k_standard.c (__kernel_standard): Likewise.
+ * sysdeps/ieee754/k_standardl.c (__kernel_standard_l): Likewise.
+ * sysdeps/ieee754/ldbl-128/e_gammal_r.c (__ieee754_gammal_r):
+ Likewise.
+ * sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c (__ieee754_gammal_r):
+ Likewise.
+ * sysdeps/ieee754/ldbl-96/e_gammal_r.c (__ieee754_gammal_r):
+ Likewise.
+ * sysdeps/powerpc/powerpc32/fpu/s_llrint.c (__llrint): Likewise.
+ * sysdeps/powerpc/powerpc32/fpu/s_llrintf.c (__llrintf): Likewise.
+
* include/math.h [!_ISOMAC && !(__FINITE_MATH_ONLY__ &&
__FINITE_MATH_ONLY__ > 0) && !NO_MATH_REDIRECT] (MATH_REDIRECT):
New macro.
# define MATH_REDIRECT_UNARY_ARGS(TYPE) TYPE
MATH_REDIRECT (sqrt, "__ieee754_", MATH_REDIRECT_UNARY_ARGS)
MATH_REDIRECT (floor, "__", MATH_REDIRECT_UNARY_ARGS)
+MATH_REDIRECT (rint, "__", MATH_REDIRECT_UNARY_ARGS)
# endif
# endif
__attribute__ ((noinline))
invalid_fn (double x, double fn)
{
- if (__rint (fn) != fn)
+ if (rint (fn) != fn)
return (fn - fn) / (fn - fn);
else if (fn > 65000.0)
return __scalbn (x, 65000);
__attribute__ ((noinline))
invalid_fn (float x, float fn)
{
- if (__rintf (fn) != fn)
+ if (rintf (fn) != fn)
return (fn - fn) / (fn - fn);
else if (fn > 65000.0f)
return __scalbnf (x, 65000);
__attribute__ ((noinline))
invalid_fn (long double x, long double fn)
{
- if (__rintl (fn) != fn)
+ if (rintl (fn) != fn)
return (fn - fn) / (fn - fn);
else if (fn > 65000.0L)
return __scalbnl (x, 65000);
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define NO_MATH_REDIRECT
#include <math.h>
#include <libm-alias-double.h>
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define NO_MATH_REDIRECT
#include <math.h>
#include <libm-alias-float.h>
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
+#define NO_MATH_REDIRECT
#include <math.h>
#include <math_ldbl_opt.h>
#include <libm-alias-double.h>
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
+#define NO_MATH_REDIRECT
#include <math.h>
#include <libm-alias-float.h>
* Public domain.
*/
+#define NO_MATH_REDIRECT
#include <libm-alias-ldouble.h>
#include <math_private.h>
return 1.0 / x;
}
if (__builtin_expect (hx < 0, 0)
- && (uint32_t) hx < 0xfff00000 && __rint (x) == x)
+ && (uint32_t) hx < 0xfff00000 && rint (x) == x)
{
/* Return value for integer x < 0 is NaN with invalid exception. */
*signgamp = 0;
* Inexact flag raised if x not equal to rint(x).
*/
+#define NO_MATH_REDIRECT
#include <math.h>
#include <math_private.h>
#include <libm-alias-double.h>
* Inexact flag raised if x not equal to rint(x).
*/
+#define NO_MATH_REDIRECT
#include <math.h>
#include <math_private.h>
#include <libm-alias-double.h>
+#define NO_MATH_REDIRECT
#include <float128_private.h>
#include "../ldbl-128/s_rintl.c"
return 1.0 / x;
}
if (__builtin_expect (hx < 0, 0)
- && (uint32_t) hx < 0xff800000 && __rintf (x) == x)
+ && (uint32_t) hx < 0xff800000 && rintf (x) == x)
{
/* Return value for integer x < 0 is NaN with invalid exception. */
*signgamp = 0;
* ====================================================
*/
+#define NO_MATH_REDIRECT
#include <math.h>
#include <math_private.h>
#include <libm-alias-float.h>
if (_LIB_VERSION == _SVID_) {
exc.retval = HUGE;
y *= 0.5;
- if(x<zero&&__rint(y)!=y) exc.retval = -HUGE;
+ if(x<zero&&rint(y)!=y) exc.retval = -HUGE;
} else {
exc.retval = HUGE_VAL;
y *= 0.5;
- if(x<zero&&__rint(y)!=y) exc.retval = -HUGE_VAL;
+ if(x<zero&&rint(y)!=y) exc.retval = -HUGE_VAL;
}
if (_LIB_VERSION == _POSIX_)
__set_errno (ERANGE);
exc.name = CSTR ("pow");
exc.retval = zero;
y *= 0.5;
- if (x < zero && __rint (y) != y)
+ if (x < zero && rint (y) != y)
exc.retval = -zero;
if (_LIB_VERSION == _POSIX_)
__set_errno (ERANGE);
{
exc.retval = HUGE;
y *= 0.5;
- if (x < zero && __rintl (y) != y)
+ if (x < zero && rintl (y) != y)
exc.retval = -HUGE;
}
else
{
exc.retval = HUGE_VAL;
y *= 0.5;
- if (x < zero && __rintl (y) != y)
+ if (x < zero && rintl (y) != y)
exc.retval = -HUGE_VAL;
}
if (_LIB_VERSION == _POSIX_)
exc.name = (char *) "powl";
exc.retval = zero;
y *= 0.5;
- if (x < zero && __rintl (y) != y)
+ if (x < zero && rintl (y) != y)
exc.retval = -zero;
if (_LIB_VERSION == _POSIX_)
__set_errno (ERANGE);
*signgamp = 0;
return 1.0 / x;
}
- if (hx < 0 && (uint64_t) hx < 0xffff000000000000ULL && __rintl (x) == x)
+ if (hx < 0 && (uint64_t) hx < 0xffff000000000000ULL && rintl (x) == x)
{
/* Return value for integer x < 0 is NaN with invalid exception. */
*signgamp = 0;
* Inexact flag raised if x not equal to rintl(x).
*/
+#define NO_MATH_REDIRECT
#include <math.h>
#include <math_private.h>
#include <libm-alias-ldouble.h>
*signgamp = 0;
return 1.0 / x;
}
- if (hx < 0 && (uint64_t) hx < 0xfff0000000000000ULL && __rintl (x) == x)
+ if (hx < 0 && (uint64_t) hx < 0xfff0000000000000ULL && rintl (x) == x)
{
/* Return value for integer x < 0 is NaN with invalid exception. */
*signgamp = 0;
/* This has been coded in assembler because GCC makes such a mess of it
when it's coded in C. */
+#define NO_MATH_REDIRECT
#include <math.h>
#include <fenv.h>
#include <math-barriers.h>
*signgamp = 0;
return x + x;
}
- if (__builtin_expect ((es & 0x8000) != 0, 0) && __rintl (x) == x)
+ if (__builtin_expect ((es & 0x8000) != 0, 0) && rintl (x) == x)
{
/* Return value for integer x < 0 is NaN with invalid exception. */
*signgamp = 0;
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
+#define NO_MATH_REDIRECT
#include <libm-alias-double.h>
double
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
+#define NO_MATH_REDIRECT
#include <libm-alias-float.h>
float
+#define NO_MATH_REDIRECT
#include <math-type-macros-double.h>
#include <s_rint_template.c>
+#define NO_MATH_REDIRECT
#include <math-type-macros-float.h>
#include <s_rint_template.c>
+#define NO_MATH_REDIRECT
#include <math-type-macros-ldouble.h>
#include <s_rint_template.c>
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define NO_MATH_REDIRECT
#include <math.h>
#include <libm-alias-double.h>
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define NO_MATH_REDIRECT
#include <math.h>
#include <libm-alias-float.h>
long long int
__llrint (double x)
{
- double rx = __rint (x);
+ double rx = rint (x);
if (HAVE_PPC_FCTIDZ || rx != x)
return (long long int) rx;
else
long long int
__llrintf (float x)
{
- float rx = __rintf (x);
+ float rx = rintf (x);
if (HAVE_PPC_FCTIDZ || rx != x)
return (long long int) rx;
else
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
+#define NO_MATH_REDIRECT
#include <math.h>
#include <math_private.h>
#include <libm-alias-double.h>
License along with the GNU C Library. If not, see
<http://www.gnu.org/licenses/>. */
+#define NO_MATH_REDIRECT
#include <math.h>
#include <math_private.h>
#include <libm-alias-float.h>
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define NO_MATH_REDIRECT
#define __rint __redirect_rint
#include <math.h>
#undef __rint
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define NO_MATH_REDIRECT
#include <math.h>
#include <sparc-ifunc.h>
#include <libm-alias-float.h>
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define NO_MATH_REDIRECT
#include <math.h>
#include <sparc-ifunc.h>
#include <libm-alias-double.h>
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define NO_MATH_REDIRECT
#include <math.h>
#include <sparc-ifunc.h>
#include <libm-alias-float.h>
+++ /dev/null
-#ifndef X86_64_MATH_PRIVATE_H
-#define X86_64_MATH_PRIVATE_H 1
-
-#include_next <math_private.h>
-
-#ifdef __SSE4_1__
-extern __always_inline double
-__rint (double d)
-{
- double res;
-# if defined __AVX__ || defined SSE2AVX
- asm ("vroundsd $4, %1, %0, %0" : "=x" (res) : "xm" (d));
-# else
- asm ("roundsd $4, %1, %0" : "=x" (res) : "xm" (d));
-# endif
- return res;
-}
-
-extern __always_inline float
-__rintf (float d)
-{
- float res;
-# if defined __AVX__ || defined SSE2AVX
- asm ("vroundss $4, %1, %0, %0" : "=x" (res) : "xm" (d));
-# else
- asm ("roundss $4, %1, %0" : "=x" (res) : "xm" (d));
-# endif
- return res;
-}
-#endif /* __SSE4_1__ */
-
-#endif /* X86_64_MATH_PRIVATE_H */
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define NO_MATH_REDIRECT
#include <libm-alias-double.h>
#define rint __redirect_rint
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+#define NO_MATH_REDIRECT
#include <libm-alias-float.h>
#define rintf __redirect_rintf