[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 036/101] target/ppc: Clean up do_fri
From: |
Cédric Le Goater |
Subject: |
[PULL 036/101] target/ppc: Clean up do_fri |
Date: |
Thu, 16 Dec 2021 21:25:09 +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 013/101] ppc/pnv.c: add a friendly warning when accel=kvm is used, (continued)
- [PULL 013/101] ppc/pnv.c: add a friendly warning when accel=kvm is used, Cédric Le Goater, 2021/12/16
- [PULL 024/101] softfloat: Add flag specific to sqrt(-x), Cédric Le Goater, 2021/12/16
- [PULL 037/101] target/ppc: Update fmadd for new flags, Cédric Le Goater, 2021/12/16
- [PULL 033/101] target/ppc: Remove inline from do_fri, Cédric Le Goater, 2021/12/16
- [PULL 030/101] target/ppc: Move float_check_status from FPU_FCTI to translate, Cédric Le Goater, 2021/12/16
- [PULL 042/101] target/ppc: Use helper_todouble in do_frsp, Cédric Le Goater, 2021/12/16
- [PULL 049/101] target/ppc: Add helpers for fadds, fsubs, fdivs, Cédric Le Goater, 2021/12/16
- [PULL 048/101] target/ppc: Add helper for fsqrts, Cédric Le Goater, 2021/12/16
- [PULL 043/101] target/ppc: Update sqrt for new flags, Cédric Le Goater, 2021/12/16
- [PULL 056/101] target/ppc: Remove the software TLB model of 7450 CPUs, Cédric Le Goater, 2021/12/16
- [PULL 036/101] target/ppc: Clean up do_fri,
Cédric Le Goater <=
- [PULL 040/101] target/ppc: Split out do_frsp, Cédric Le Goater, 2021/12/16
- [PULL 051/101] target/ppc: Add helper for frsqrtes, Cédric Le Goater, 2021/12/16
- [PULL 038/101] target/ppc: Split out do_fmadd, Cédric Le Goater, 2021/12/16
- [PULL 046/101] softfloat: Add float64r32 arithmetic routines, Cédric Le Goater, 2021/12/16
- [PULL 052/101] target/ppc: Update fres to new flags and float64r32, Cédric Le Goater, 2021/12/16
- [PULL 060/101] target/ppc: remove 401/403 CPUs, Cédric Le Goater, 2021/12/16
- [PULL 065/101] ppc/ppc405: Drop flag parameter in ppc405_set_bootinfo(), Cédric Le Goater, 2021/12/16
- [PULL 032/101] target/ppc: Fix VXCVI return value, Cédric Le Goater, 2021/12/16
- [PULL 041/101] target/ppc: Update do_frsp for new flags, Cédric Le Goater, 2021/12/16
- [PULL 067/101] ppc/ppc405: Add some address space definitions, Cédric Le Goater, 2021/12/16