From 89a464dafa92fa669634480f4265100612a8d197 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Tue, 17 Aug 2021 17:39:47 +0200 Subject: [PATCH] Interpreter: Optimize FEX calculation The next commit will make the interpreter run this after every float instruction, so I think a little optimization here is justified. --- Source/Core/Core/PowerPC/Gekko.h | 6 ++++++ .../PowerPC/Interpreter/Interpreter_SystemRegisters.cpp | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/PowerPC/Gekko.h b/Source/Core/Core/PowerPC/Gekko.h index 9f89004552..f8dc7e87af 100644 --- a/Source/Core/Core/PowerPC/Gekko.h +++ b/Source/Core/Core/PowerPC/Gekko.h @@ -419,11 +419,17 @@ enum FPSCRExceptionFlag : u32 FPSCR_VXSQRT = 1U << (31 - 22), FPSCR_VXCVI = 1U << (31 - 23), FPSCR_VE = 1U << (31 - 24), + FPSCR_OE = 1U << (31 - 25), + FPSCR_UE = 1U << (31 - 26), + FPSCR_ZE = 1U << (31 - 27), + FPSCR_XE = 1U << (31 - 28), FPSCR_VX_ANY = FPSCR_VXSNAN | FPSCR_VXISI | FPSCR_VXIDI | FPSCR_VXZDZ | FPSCR_VXIMZ | FPSCR_VXVC | FPSCR_VXSOFT | FPSCR_VXSQRT | FPSCR_VXCVI, FPSCR_ANY_X = FPSCR_OX | FPSCR_UX | FPSCR_ZX | FPSCR_XX | FPSCR_VX_ANY, + + FPSCR_ANY_E = FPSCR_VE | FPSCR_OE | FPSCR_UE | FPSCR_ZE | FPSCR_XE, }; // Floating Point Status and Control Register diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp index 7917eba188..3f7b82717a 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_SystemRegisters.cpp @@ -40,8 +40,7 @@ static void FPSCRUpdated(UReg_FPSCR fp) static void UpdateFPSCR(UReg_FPSCR* fpscr) { fpscr->VX = (fpscr->Hex & FPSCR_VX_ANY) != 0; - fpscr->FEX = (fpscr->VX & fpscr->VE) | (fpscr->OX & fpscr->OE) | (fpscr->UX & fpscr->UE) | - (fpscr->ZX & fpscr->ZE) | (fpscr->XX & fpscr->XE); + fpscr->FEX = ((fpscr->Hex >> 22) & (fpscr->Hex & FPSCR_ANY_E)) != 0; } void Interpreter::mtfsb0x(UGeckoInstruction inst)