Skip to content

Commit

Permalink
Interpreter: Optimize FEX calculation
Browse files Browse the repository at this point in the history
The next commit will make the interpreter run this after every
float instruction, so I think a little optimization here is justified.
  • Loading branch information
JosJuice committed Oct 13, 2021
1 parent 83c6df1 commit 89a464d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Source/Core/Core/PowerPC/Gekko.h
Expand Up @@ -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
Expand Down
Expand Up @@ -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)
Expand Down

0 comments on commit 89a464d

Please sign in to comment.