return f.l;
}
-static always_inline int fpisneg (float64 d)
-{
- CPU_DoubleU u;
-
- u.d = d;
-
- return u.ll >> 63 != 0;
-}
-
static always_inline int isden (float64 d)
{
CPU_DoubleU u;
return ((u.ll >> 52) & 0x7FF) == 0;
}
-static always_inline int iszero (float64 d)
-{
- CPU_DoubleU u;
-
- u.d = d;
-
- return (u.ll & ~0x8000000000000000ULL) == 0;
-}
-
-static always_inline int isinfinity (float64 d)
-{
- CPU_DoubleU u;
-
- u.d = d;
-
- return ((u.ll >> 52) & 0x7FF) == 0x7FF &&
- (u.ll & 0x000FFFFFFFFFFFFFULL) == 0;
-}
#ifdef CONFIG_SOFTFLOAT
static always_inline int isfinite (float64 d)
int isneg;
int ret;
farg.ll = arg;
- isneg = fpisneg(farg.d);
+ isneg = float64_is_neg(farg.d);
if (unlikely(float64_is_nan(farg.d))) {
if (float64_is_signaling_nan(farg.d)) {
/* Signaling NaN: flags are undefined */
/* Quiet NaN */
ret = 0x11;
}
- } else if (unlikely(isinfinity(farg.d))) {
+ } else if (unlikely(float64_is_infinity(farg.d))) {
/* +/- infinity */
if (isneg)
ret = 0x09;
else
ret = 0x05;
} else {
- if (iszero(farg.d)) {
+ if (float64_is_zero(farg.d)) {
/* +/- zero */
if (isneg)
ret = 0x12;
/* sNaN addition */
farg1.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN);
} else if (likely(isfinite(farg1.d) || isfinite(farg2.d) ||
- fpisneg(farg1.d) == fpisneg(farg2.d))) {
+ float64_is_neg(farg1.d) == float64_is_neg(farg2.d))) {
farg1.d = float64_add(farg1.d, farg2.d, &env->fp_status);
} else {
/* Magnitude subtraction of infinities */
/* sNaN subtraction */
farg1.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN);
} else if (likely(isfinite(farg1.d) || isfinite(farg2.d) ||
- fpisneg(farg1.d) != fpisneg(farg2.d))) {
+ float64_is_neg(farg1.d) != float64_is_neg(farg2.d))) {
farg1.d = float64_sub(farg1.d, farg2.d, &env->fp_status);
} else {
/* Magnitude subtraction of infinities */
float64_is_signaling_nan(farg2.d))) {
/* sNaN multiplication */
farg1.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN);
- } else if (unlikely((isinfinity(farg1.d) && iszero(farg2.d)) ||
- (iszero(farg1.d) && isinfinity(farg2.d)))) {
+ } else if (unlikely((float64_is_infinity(farg1.d) && float64_is_zero(farg2.d)) ||
+ (float64_is_zero(farg1.d) && float64_is_infinity(farg2.d)))) {
/* Multiplication of zero by infinity */
farg1.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXIMZ);
} else {
float64_is_signaling_nan(farg2.d))) {
/* sNaN division */
farg1.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN);
- } else if (unlikely(isinfinity(farg1.d) && isinfinity(farg2.d))) {
+ } else if (unlikely(float64_is_infinity(farg1.d) && float64_is_infinity(farg2.d))) {
/* Division of infinity by infinity */
farg1.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXIDI);
- } else if (unlikely(!float64_is_nan(farg1.d) && iszero(farg2.d))) {
- if (iszero(farg1.d)) {
+ } else if (unlikely(!float64_is_nan(farg1.d) && float64_is_zero(farg2.d))) {
+ if (float64_is_zero(farg1.d)) {
/* Division of zero by zero */
farg1.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXZDZ);
} else {
if (unlikely(float64_is_signaling_nan(farg.d))) {
/* sNaN conversion */
farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN | POWERPC_EXCP_FP_VXCVI);
- } else if (unlikely(float64_is_nan(farg.d) || isinfinity(farg.d))) {
+ } else if (unlikely(float64_is_nan(farg.d) || float64_is_infinity(farg.d))) {
/* qNan / infinity conversion */
farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXCVI);
} else {
if (unlikely(float64_is_signaling_nan(farg.d))) {
/* sNaN conversion */
farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN | POWERPC_EXCP_FP_VXCVI);
- } else if (unlikely(float64_is_nan(farg.d) || isinfinity(farg.d))) {
+ } else if (unlikely(float64_is_nan(farg.d) || float64_is_infinity(farg.d))) {
/* qNan / infinity conversion */
farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXCVI);
} else {
if (unlikely(float64_is_signaling_nan(farg.d))) {
/* sNaN conversion */
farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN | POWERPC_EXCP_FP_VXCVI);
- } else if (unlikely(float64_is_nan(farg.d) || isinfinity(farg.d))) {
+ } else if (unlikely(float64_is_nan(farg.d) || float64_is_infinity(farg.d))) {
/* qNan / infinity conversion */
farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXCVI);
} else {
if (unlikely(float64_is_signaling_nan(farg.d))) {
/* sNaN conversion */
farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN | POWERPC_EXCP_FP_VXCVI);
- } else if (unlikely(float64_is_nan(farg.d) || isinfinity(farg.d))) {
+ } else if (unlikely(float64_is_nan(farg.d) || float64_is_infinity(farg.d))) {
/* qNan / infinity conversion */
farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXCVI);
} else {
if (unlikely(float64_is_signaling_nan(farg.d))) {
/* sNaN round */
farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN | POWERPC_EXCP_FP_VXCVI);
- } else if (unlikely(float64_is_nan(farg.d) || isinfinity(farg.d))) {
+ } else if (unlikely(float64_is_nan(farg.d) || float64_is_infinity(farg.d))) {
/* qNan / infinity round */
farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXCVI);
} else {
if (unlikely(float64_is_signaling_nan(farg.d))) {
/* sNaN square root */
farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN);
- } else if (unlikely(fpisneg(farg.d) && !iszero(farg.d))) {
+ } else if (unlikely(float64_is_neg(farg.d) && !float64_is_zero(farg.d))) {
/* Square root of a negative nonzero number */
farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSQRT);
} else {
if (unlikely(float64_is_signaling_nan(farg.d))) {
/* sNaN reciprocal */
farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN);
- } else if (unlikely(iszero(farg.d))) {
+ } else if (unlikely(float64_is_zero(farg.d))) {
/* Zero reciprocal */
farg.ll = float_zero_divide_excp(fone.d, farg.d);
} else if (likely(isnormal(farg.d))) {
farg.ll = 0x7FF0000000000000ULL;
} else if (float64_is_nan(farg.d)) {
farg.ll = 0x7FF8000000000000ULL;
- } else if (fpisneg(farg.d)) {
+ } else if (float64_is_neg(farg.d)) {
farg.ll = 0x8000000000000000ULL;
} else {
farg.ll = 0x0000000000000000ULL;
if (unlikely(float64_is_signaling_nan(farg.d))) {
/* sNaN reciprocal */
farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN);
- } else if (unlikely(iszero(farg.d))) {
+ } else if (unlikely(float64_is_zero(farg.d))) {
/* Zero reciprocal */
farg.ll = float_zero_divide_excp(fone.d, farg.d);
} else if (likely(isnormal(farg.d))) {
farg.ll = 0x7FF0000000000000ULL;
} else if (float64_is_nan(farg.d)) {
farg.ll = 0x7FF8000000000000ULL;
- } else if (fpisneg(farg.d)) {
+ } else if (float64_is_neg(farg.d)) {
farg.ll = 0x8000000000000000ULL;
} else {
farg.ll = 0x0000000000000000ULL;
if (unlikely(float64_is_signaling_nan(farg.d))) {
/* sNaN reciprocal square root */
farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN);
- } else if (unlikely(fpisneg(farg.d) && !iszero(farg.d))) {
+ } else if (unlikely(float64_is_neg(farg.d) && !float64_is_zero(farg.d))) {
/* Reciprocal square root of a negative nonzero number */
farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSQRT);
} else if (likely(isnormal(farg.d))) {
farg.ll = 0x7FF0000000000000ULL;
} else if (float64_is_nan(farg.d)) {
farg.ll |= 0x000FFFFFFFFFFFFFULL;
- } else if (fpisneg(farg.d)) {
+ } else if (float64_is_neg(farg.d)) {
farg.ll = 0x7FF8000000000000ULL;
} else {
farg.ll = 0x0000000000000000ULL;
farg1.ll = arg1;
- if (!fpisneg(farg1.d) || iszero(farg1.d))
+ if (!float64_is_neg(farg1.d) || float64_is_zero(farg1.d))
return arg2;
else
return arg3;