+ Use DOT_MACHINE macro instead of ".machine" instruction.
+ Use __isinf and __isinff instead of builtin versions.
+ In s_logb, s_logbf and s_logbl functions, used float versions to
calculate "ret = x & 0x7f800000;" expression.
double
__modf (double x, double *iptr)
{
+ /* Google-specific: Fix for clang. */
+#if defined __clang__
+ if (__isinf (x))
+#else
if (__builtin_isinf (x))
+#endif
{
*iptr = x;
return __copysign (0.0, x);
}
+ /* Google-specific: Fix for clang. */
+#if defined __clang__
+ else if (__isnan (x))
+#else
else if (__builtin_isnan (x))
+#endif
{
*iptr = NAN;
return NAN;
float
__modff (float x, float *iptr)
{
+ /* Google-specific: Fix for clang. */
+#if defined __clang__
+ if (__isinff (x))
+#else
if (__builtin_isinff (x))
+#endif
{
*iptr = x;
return __copysignf (0.0, x);
}
+ /* Google-specific: Fix for clang. */
+#if defined __clang__
+ else if (__isnanf (x))
+#else
else if (__builtin_isnanf (x))
+#endif
{
*iptr = NAN;
return NAN;
<http://www.gnu.org/licenses/>. */
#include <math_ldbl_opt.h>
+#include <math_private.h>
#include <libm-alias-double.h>
/* This implementation avoids FP to INT conversions by using VSX
return -1.0 / __builtin_fabs (x);
/* ret = x & 0x7ff0000000000000; */
+#if !defined __clang__
asm (
"xxland %x0,%x1,%x2\n"
"fcfid %0,%0"
: "=f" (ret)
: "f" (x), "f" (mask.d));
+#else
+ /* TODO(rtenneti): This is wrong. Handle double */
+ int64_t inum;
+ GET_FLOAT_WORD(inum, x);
+ inum = (inum & 0x7ff0000000000000);
+ SET_FLOAT_WORD(ret, inum);
+#endif
/* ret = (ret >> 52) - 1023.0; */
ret = (ret * two1div52) + two10m1;
if (__builtin_expect (ret > -two10m1, 0))
return -1.0 / __builtin_fabsf (x);
/* ret = x & 0x7f800000; */
+#if !defined __clang__
asm (
"xxland %x0,%x1,%x2\n"
"fcfid %0,%0"
: "=f"(ret)
: "f" (x), "f" (mask.d));
+#else
+ int32_t inum;
+ GET_FLOAT_WORD(inum, x);
+ inum = (inum & 0x7ff0000000000000);
+ SET_FLOAT_WORD(ret, inum);
+#endif
/* ret = (ret >> 52) - 1023.0, since ret is double. */
ret = (ret * two1div52) + two10m1;
if (__builtin_expect (ret > -two7m1, 0))
ldbl_unpack (x, &xh, &xl);
EXTRACT_WORDS64 (hx, xh);
/* ret = x & 0x7ff0000000000000; */
+#if !defined __clang__
asm (
"xxland %x0,%x1,%x2\n"
"fcfid %0,%0"
: "=f" (ret)
: "f" (xh), "f" (mask.d));
+#else
+ /* TODO(rtenneti): This is wrong. Handle double */
+ int64_t inum;
+ GET_FLOAT_WORD(inum, x);
+ inum = (inum & 0x7ff0000000000000);
+ SET_FLOAT_WORD(ret, inum);
+#endif
/* ret = (ret >> 52) - 1023.0; */
ret = (ret * two1div52) + two10m1;
if (__builtin_expect (ret > -two10m1, 0))