Skip to content

Commit

Permalink
target/ppc: Update fre to new flags
Browse files Browse the repository at this point in the history
Use float_flag_invalid_snan instead of recomputing
the snan-ness of the operand.

Signed-off-by: Richard Henderson <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Cédric Le Goater <[email protected]>
  • Loading branch information
rth7680 authored and legoater committed Dec 17, 2021
1 parent 053e23a commit 8ea0b14
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions target/ppc/fpu_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -765,20 +765,15 @@ float64 helper_fre(CPUPPCState *env, float64 arg)
{
/* "Estimate" the reciprocal with actual division. */
float64 ret = float64_div(float64_one, arg, &env->fp_status);
int status = get_float_exception_flags(&env->fp_status);
int flags = get_float_exception_flags(&env->fp_status);

if (unlikely(status)) {
if (status & float_flag_invalid) {
if (float64_is_signaling_nan(arg, &env->fp_status)) {
/* sNaN reciprocal */
float_invalid_op_vxsnan(env, GETPC());
}
}
if (status & float_flag_divbyzero) {
float_zero_divide_excp(env, GETPC());
/* For FPSCR.ZE == 0, the result is 1/2. */
ret = float64_set_sign(float64_half, float64_is_neg(arg));
}
if (unlikely(flags & float_flag_invalid_snan)) {
float_invalid_op_vxsnan(env, GETPC());
}
if (unlikely(flags & float_flag_divbyzero)) {
float_zero_divide_excp(env, GETPC());
/* For FPSCR.ZE == 0, the result is 1/2. */
ret = float64_set_sign(float64_half, float64_is_neg(arg));
}

return ret;
Expand Down

0 comments on commit 8ea0b14

Please sign in to comment.