[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 036/102] target/ppc: Clean up do_fri
From: |
Cédric Le Goater |
Subject: |
[PULL 036/102] target/ppc: Clean up do_fri |
Date: |
Wed, 15 Dec 2021 18:02:51 +0100 |
From: Richard Henderson <richard.henderson@linaro.org>
Let float64_round_to_int detect and silence snans.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211119160502.17432-18-richard.henderson@linaro.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
target/ppc/fpu_helper.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c
index d4f72c296fad..7716bb15b1d2 100644
--- a/target/ppc/fpu_helper.c
+++ b/target/ppc/fpu_helper.c
@@ -644,25 +644,23 @@ FPU_FCFI(fcfidus, uint64_to_float32, 1)
static uint64_t do_fri(CPUPPCState *env, uint64_t arg,
FloatRoundMode rounding_mode)
{
- CPU_DoubleU farg;
FloatRoundMode old_rounding_mode =
get_float_rounding_mode(&env->fp_status);
+ int flags;
- farg.ll = arg;
+ set_float_rounding_mode(rounding_mode, &env->fp_status);
+ arg = float64_round_to_int(arg, &env->fp_status);
+ set_float_rounding_mode(old_rounding_mode, &env->fp_status);
- if (unlikely(float64_is_signaling_nan(farg.d, &env->fp_status))) {
- /* sNaN round */
+ flags = get_float_exception_flags(&env->fp_status);
+ if (flags & float_flag_invalid_snan) {
float_invalid_op_vxsnan(env, GETPC());
- farg.ll = arg | 0x0008000000000000ULL;
- } else {
- set_float_rounding_mode(rounding_mode, &env->fp_status);
- farg.ll = float64_round_to_int(farg.d, &env->fp_status);
- set_float_rounding_mode(old_rounding_mode, &env->fp_status);
-
- /* fri* does not set FPSCR[XX] */
- env->fp_status.float_exception_flags &= ~float_flag_inexact;
}
+
+ /* fri* does not set FPSCR[XX] */
+ set_float_exception_flags(flags & ~float_flag_inexact, &env->fp_status);
do_float_check_status(env, GETPC());
- return farg.ll;
+
+ return arg;
}
uint64_t helper_frin(CPUPPCState *env, uint64_t arg)
--
2.31.1
- [PULL 034/102] target/ppc: Use FloatRoundMode in do_fri, (continued)
- [PULL 034/102] target/ppc: Use FloatRoundMode in do_fri, Cédric Le Goater, 2021/12/15
- [PULL 029/102] target/ppc: Update float_invalid_op_div for new flags, Cédric Le Goater, 2021/12/15
- [PULL 040/102] target/ppc: Split out do_frsp, Cédric Le Goater, 2021/12/15
- [PULL 030/102] target/ppc: Move float_check_status from FPU_FCTI to translate, Cédric Le Goater, 2021/12/15
- [PULL 032/102] target/ppc: Fix VXCVI return value, Cédric Le Goater, 2021/12/15
- [PULL 039/102] target/ppc: Do not call do_float_check_status from do_fmadd, Cédric Le Goater, 2021/12/15
- [PULL 050/102] target/ppc: Add helper for fmuls, Cédric Le Goater, 2021/12/15
- [PULL 051/102] target/ppc: Add helper for frsqrtes, Cédric Le Goater, 2021/12/15
- [PULL 055/102] target/ppc: Disable unused facilities in the e600 CPU, Cédric Le Goater, 2021/12/15
- [PULL 047/102] target/ppc: Add helpers for fmadds et al, Cédric Le Goater, 2021/12/15
- [PULL 036/102] target/ppc: Clean up do_fri,
Cédric Le Goater <=
- [PULL 038/102] target/ppc: Split out do_fmadd, Cédric Le Goater, 2021/12/15
- [PULL 033/102] target/ppc: Remove inline from do_fri, Cédric Le Goater, 2021/12/15
- [PULL 048/102] target/ppc: Add helper for fsqrts, Cédric Le Goater, 2021/12/15
- [PULL 042/102] target/ppc: Use helper_todouble in do_frsp, Cédric Le Goater, 2021/12/15
- [PULL 046/102] softfloat: Add float64r32 arithmetic routines, Cédric Le Goater, 2021/12/15
- [PULL 049/102] target/ppc: Add helpers for fadds, fsubs, fdivs, Cédric Le Goater, 2021/12/15
- [PULL 054/102] target/ppc: Disable software TLB for the 7450 family, Cédric Le Goater, 2021/12/15
- [PULL 053/102] target/ppc: Use helper_todouble/tosingle in helper_xststdcsp, Cédric Le Goater, 2021/12/15
- [PULL 058/102] target/ppc: Remove 603e exception model, Cédric Le Goater, 2021/12/15
- [PULL 062/102] ppc: Mark the 'taihu' machine as deprecated, Cédric Le Goater, 2021/12/15