From d897acfd3c00e2ab529ca621ac2f24ca6e8f108b Mon Sep 17 00:00:00 2001 From: joevt Date: Tue, 9 Apr 2024 02:04:32 -0700 Subject: [PATCH] poweropcodes: Fix nabs. Calculate overflow first before calculating condition codes because the overflow condition is copied from XER. --- cpu/ppc/poweropcodes.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpu/ppc/poweropcodes.cpp b/cpu/ppc/poweropcodes.cpp index 5583727..9a0df83 100644 --- a/cpu/ppc/poweropcodes.cpp +++ b/cpu/ppc/poweropcodes.cpp @@ -332,10 +332,10 @@ void dppc_interpreter::power_nabs() { ppc_grab_regsda(ppc_cur_instruction); uint32_t ppc_result_d = (int32_t(ppc_result_a) < 0) ? ppc_result_a : -ppc_result_a; - if (rec) - ppc_changecrf0(ppc_result_d); if (ov) ppc_state.spr[SPR::XER] &= ~XER::OV; + if (rec) + ppc_changecrf0(ppc_result_d); ppc_store_iresult_reg(reg_d, ppc_result_d); }