[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 33/35] target/ppc: Update fres to new flags and float64r32
From: |
Richard Henderson |
Subject: |
[PATCH 33/35] target/ppc: Update fres to new flags and float64r32 |
Date: |
Fri, 19 Nov 2021 17:05:00 +0100 |
There is no double-rounding bug here, because the result is
merely an estimate to within 1 part in 256, but perform the
operation with float64r32_div for consistency.
Use float_flag_invalid_snan instead of recomputing the
snan-ness of the operand.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/ppc/fpu_helper.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c
index cb511f2050..ea238929da 100644
--- a/target/ppc/fpu_helper.c
+++ b/target/ppc/fpu_helper.c
@@ -813,20 +813,20 @@ float64 helper_fre(CPUPPCState *env, float64 arg)
/* fres - fres. */
uint64_t helper_fres(CPUPPCState *env, uint64_t arg)
{
- CPU_DoubleU farg;
- float32 f32;
+ /* "Estimate" the reciprocal with actual division. */
+ float64 ret = float64r32_div(float64_one, arg, &env->fp_status);
+ int flags = get_float_exception_flags(&env->fp_status);
- farg.ll = arg;
-
- if (unlikely(float64_is_signaling_nan(farg.d, &env->fp_status))) {
- /* sNaN reciprocal */
+ if (unlikely(flags & float_flag_invalid_snan)) {
float_invalid_op_vxsnan(env, GETPC());
}
- farg.d = float64_div(float64_one, farg.d, &env->fp_status);
- f32 = float64_to_float32(farg.d, &env->fp_status);
- farg.d = float32_to_float64(f32, &env->fp_status);
+ 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 farg.ll;
+ return ret;
}
/* frsqrte - frsqrte. */
--
2.25.1
- [PATCH 24/35] target/ppc: Update sqrt for new flags, (continued)
- [PATCH 24/35] target/ppc: Update sqrt for new flags, Richard Henderson, 2021/11/19
- [PATCH 25/35] target/ppc: Update xsrqpi and xsrqpxp to new flags, Richard Henderson, 2021/11/19
- [PATCH 26/35] target/ppc: Update fre to new flags, Richard Henderson, 2021/11/19
- [PATCH 28/35] target/ppc: Add helpers for fmadds et al, Richard Henderson, 2021/11/19
- [PATCH 27/35] softfloat: Add float64r32 arithmetic routines, Richard Henderson, 2021/11/19
- [PATCH 29/35] target/ppc: Add helper for fsqrts, Richard Henderson, 2021/11/19
- [PATCH 30/35] target/ppc: Add helpers for fadds, fsubs, fdivs, Richard Henderson, 2021/11/19
- [PATCH 31/35] target/ppc: Add helper for fmuls, Richard Henderson, 2021/11/19
- [PATCH 32/35] target/ppc: Add helper for frsqrtes, Richard Henderson, 2021/11/19
- [PATCH 34/35] target/ppc: Use helper_todouble/tosingle in helper_xststdcsp, Richard Henderson, 2021/11/19
- [PATCH 33/35] target/ppc: Update fres to new flags and float64r32,
Richard Henderson <=
- [PATCH 35/35] test/tcg/ppc64le: Add float reference files, Richard Henderson, 2021/11/19
- Re: [PATCH 35/35] test/tcg/ppc64le: Add float reference files, Cédric Le Goater, 2021/11/21
- Re: [PATCH 35/35] test/tcg/ppc64le: Add float reference files, Richard Henderson, 2021/11/22
- Re: [PATCH 35/35] test/tcg/ppc64le: Add float reference files, Cédric Le Goater, 2021/11/22
- Re: [PATCH 35/35] test/tcg/ppc64le: Add float reference files, Richard Henderson, 2021/11/22
- Re: [PATCH 35/35] test/tcg/ppc64le: Add float reference files, Cédric Le Goater, 2021/11/22
- Re: [PATCH 35/35] test/tcg/ppc64le: Add float reference files, Richard Henderson, 2021/11/22
- Re: [PATCH 35/35] test/tcg/ppc64le: Add float reference files, Cédric Le Goater, 2021/11/24
- Re: [PATCH 35/35] test/tcg/ppc64le: Add float reference files, Richard Henderson, 2021/11/24
- Re: [PATCH 35/35] test/tcg/ppc64le: Add float reference files, Cédric Le Goater, 2021/11/29