提交 e33e94f9 编写于 作者: A aurel32

target-ppc: use float_flag_divbyzero instead of checking the operands

Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6097 c046a42c-6fe2-441c-8c8c-71466251a162
上级 ca587a8e
......@@ -697,7 +697,7 @@ static always_inline uint64_t fload_invalid_op_excp (int op)
return ret;
}
static always_inline uint64_t float_zero_divide_excp (uint64_t arg1, uint64_t arg2)
static always_inline void float_zero_divide_excp (void)
{
env->fpscr |= 1 << FPSCR_ZX;
env->fpscr &= ~((1 << FPSCR_FR) | (1 << FPSCR_FI));
......@@ -710,12 +710,7 @@ static always_inline uint64_t float_zero_divide_excp (uint64_t arg1, uint64_t ar
helper_raise_exception_err(POWERPC_EXCP_PROGRAM,
POWERPC_EXCP_FP | POWERPC_EXCP_FP_ZX);
}
} else {
/* Set the result to infinity */
arg1 = ((arg1 ^ arg2) & 0x8000000000000000ULL);
arg1 |= 0x7FFULL << 52;
}
return arg1;
}
static always_inline void float_overflow_excp (void)
......@@ -969,7 +964,9 @@ void helper_float_check_status (void)
helper_raise_exception_err(env->exception_index, env->error_code);
} else {
int status = get_float_exception_flags(&env->fp_status);
if (status & float_flag_overflow) {
if (status & float_flag_divbyzero) {
float_zero_divide_excp();
} else if (status & float_flag_overflow) {
float_overflow_excp();
} else if (status & float_flag_underflow) {
float_underflow_excp();
......@@ -1086,14 +1083,9 @@ uint64_t helper_fdiv (uint64_t arg1, uint64_t arg2)
} 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) && 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 {
/* Division by zero */
farg1.ll = float_zero_divide_excp(farg1.d, farg2.d);
}
} else if (unlikely(float64_is_zero(farg1.d) && float64_is_zero(farg2.d))) {
/* Division of zero by zero */
farg1.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXZDZ);
} else {
farg1.d = float64_div(farg1.d, farg2.d, &env->fp_status);
}
......@@ -1513,9 +1505,6 @@ uint64_t helper_fre (uint64_t arg)
if (unlikely(float64_is_signaling_nan(farg.d))) {
/* sNaN reciprocal */
farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN);
} else if (unlikely(float64_is_zero(farg.d))) {
/* Zero reciprocal */
farg.ll = float_zero_divide_excp(fone.d, farg.d);
} else {
farg.d = float64_div(fone.d, farg.d, &env->fp_status);
}
......@@ -1533,9 +1522,6 @@ uint64_t helper_fres (uint64_t arg)
if (unlikely(float64_is_signaling_nan(farg.d))) {
/* sNaN reciprocal */
farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN);
} else if (unlikely(float64_is_zero(farg.d))) {
/* Zero reciprocal */
farg.ll = float_zero_divide_excp(fone.d, farg.d);
} else {
farg.d = float64_div(fone.d, farg.d, &env->fp_status);
f32 = float64_to_float32(farg.d, &env->fp_status);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册