[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 05/60] target/ppc: Bugfix FP when OE/UE are set
From: |
Daniel Henrique Barboza |
Subject: |
[PULL 05/60] target/ppc: Bugfix FP when OE/UE are set |
Date: |
Wed, 31 Aug 2022 15:49:39 -0300 |
From: "Lucas Mateus Castro (alqotel)" <lucas.araujo@eldorado.org.br>
When an overflow exception occurs and OE is set the intermediate result
should be adjusted (by subtracting from the exponent) to avoid rounding
to inf. The same applies to an underflow exceptionion and UE (but adding
to the exponent). To do this set the fp_status.rebias_overflow when OE
is set and fp_status.rebias_underflow when UE is set as the FPU will
recalculate in case of a overflow/underflow if the according rebias* is
set.
Signed-off-by: Lucas Mateus Castro (alqotel) <lucas.araujo@eldorado.org.br>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220805141522.412864-3-lucas.araujo@eldorado.org.br>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
target/ppc/cpu.c | 2 ++
target/ppc/fpu_helper.c | 2 --
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c
index 401b6f9e63..0ebac04bc4 100644
--- a/target/ppc/cpu.c
+++ b/target/ppc/cpu.c
@@ -120,6 +120,8 @@ void ppc_store_fpscr(CPUPPCState *env, target_ulong val)
val |= FP_FEX;
}
env->fpscr = val;
+ env->fp_status.rebias_overflow = (FP_OE & env->fpscr) ? true : false;
+ env->fp_status.rebias_underflow = (FP_UE & env->fpscr) ? true : false;
if (tcg_enabled()) {
fpscr_set_rounding_mode(env);
}
diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c
index 7ab6beadad..0f045b70f8 100644
--- a/target/ppc/fpu_helper.c
+++ b/target/ppc/fpu_helper.c
@@ -348,7 +348,6 @@ static inline int float_overflow_excp(CPUPPCState *env)
bool overflow_enabled = !!(env->fpscr & FP_OE);
if (overflow_enabled) {
- /* XXX: should adjust the result */
/* Update the floating-point enabled exception summary */
env->fpscr |= FP_FEX;
/* We must update the target FPR before raising the exception */
@@ -367,7 +366,6 @@ static inline void float_underflow_excp(CPUPPCState *env)
/* Update the floating-point exception summary */
env->fpscr |= FP_FX;
if (env->fpscr & FP_UE) {
- /* XXX: should adjust the result */
/* Update the floating-point enabled exception summary */
env->fpscr |= FP_FEX;
/* We must update the target FPR before raising the exception */
--
2.37.2
- [PULL 00/60] ppc queue, Daniel Henrique Barboza, 2022/08/31
- [PULL 02/60] target/ppc: Fix host PVR matching for KVM, Daniel Henrique Barboza, 2022/08/31
- [PULL 03/60] ppc/pnv: Add initial P9/10 SBE model, Daniel Henrique Barboza, 2022/08/31
- [PULL 04/60] fpu: Add rebias bool, value and operation, Daniel Henrique Barboza, 2022/08/31
- [PULL 05/60] target/ppc: Bugfix FP when OE/UE are set,
Daniel Henrique Barboza <=
- [PULL 01/60] pseries: Update SLOF firmware image, Daniel Henrique Barboza, 2022/08/31
- [PULL 06/60] ppc/pnv: add PHB3 bus init helper, Daniel Henrique Barboza, 2022/08/31
- [PULL 07/60] ppc/pnv: add PnvPHB base/proxy device, Daniel Henrique Barboza, 2022/08/31
- [PULL 08/60] ppc/pnv: turn PnvPHB3 into a PnvPHB backend, Daniel Henrique Barboza, 2022/08/31
- [PULL 09/60] ppc/pnv: add PHB4 bus init helper, Daniel Henrique Barboza, 2022/08/31
- [PULL 10/60] ppc/pnv: turn PnvPHB4 into a PnvPHB backend, Daniel Henrique Barboza, 2022/08/31
- [PULL 11/60] ppc/pnv: add pnv-phb-root-port device, Daniel Henrique Barboza, 2022/08/31
- [PULL 12/60] ppc/pnv: remove pnv-phb3-root-port, Daniel Henrique Barboza, 2022/08/31
- [PULL 13/60] ppc/pnv: remove pnv-phb4-root-port, Daniel Henrique Barboza, 2022/08/31
- [PULL 15/60] ppc/pnv: remove pecc->rp_model, Daniel Henrique Barboza, 2022/08/31