[6097] target-ppc: use float_flag_divbyzero instead of checking the operands
Revision: 6097
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6097 Author: aurel32 Date: 2008-12-18 22:44:21 +0000 (Thu, 18 Dec 2008)
Log Message:
-----------
target-ppc: use float_flag_divbyzero instead of checking the operands
Signed-off-by Aurelien Jarno <[email protected]>
Modified Paths:
--------------
trunk/target-ppc/op_helper.c
Modified: trunk/target-ppc/op_helper.c
===================================================================
target-ppc/op_helper.c +7 -21
@@ -697,7 +697,7 @@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 @@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 @@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 @@ }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 @@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 @@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);