From bce4c98475389b5aa5829565a66db6adf1916b78 Mon Sep 17 00:00:00 2001 From: joevt Date: Mon, 2 Dec 2024 00:57:43 -0800 Subject: [PATCH] ppcfpopcodes: Fix fdiv for MPC601. --- cpu/ppc/ppcfpopcodes.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cpu/ppc/ppcfpopcodes.cpp b/cpu/ppc/ppcfpopcodes.cpp index 3e2790c..45cff8b 100644 --- a/cpu/ppc/ppcfpopcodes.cpp +++ b/cpu/ppc/ppcfpopcodes.cpp @@ -232,7 +232,15 @@ template void dppc_interpreter::ppc_fdiv(uint32_t opcode) { ppc_grab_regsfpdab(opcode); - double ppc_dblresult64_d = val_reg_a / val_reg_b; + double ppc_dblresult64_d; + + if (is_601 && FPR_INT(reg_b) == 0x8000000000000000 && val_reg_a > 0) { + ppc_dblresult64_d = val_reg_b; + fpresult_update(ppc_dblresult64_d); + return; + } + + ppc_dblresult64_d = val_reg_a / val_reg_b; if (val_reg_b == 0.0) { ppc_state.fpscr |= 0xa0000000;