armjit: Maintain rounding mode throughout jit.

This commit is contained in:
Unknown W. Brackets 2014-08-22 19:57:50 -07:00
parent 925557ed47
commit e9b5e6f277
4 changed files with 12 additions and 13 deletions

View File

@ -114,7 +114,9 @@ void Jit::GenerateFixedCode()
MovToPC(R0);
outerLoop = GetCodePtr();
SaveDowncount();
ClearRoundingMode();
QuickCallFunction(R0, &CoreTiming::Advance);
SetRoundingMode();
RestoreDowncount();
FixupBranch skipToRealDispatch = B(); //skip the sync and compare first time
@ -173,7 +175,9 @@ void Jit::GenerateFixedCode()
// No block found, let's jit
SaveDowncount();
ClearRoundingMode();
QuickCallFunction(R2, (void *)&JitAt);
SetRoundingMode();
RestoreDowncount();
B(dispatcherNoCheck); // no point in special casing this
@ -195,6 +199,7 @@ void Jit::GenerateFixedCode()
}
SaveDowncount();
ClearRoundingMode();
ADD(R_SP, R_SP, 4);

View File

@ -559,6 +559,7 @@ void Jit::Comp_Syscall(MIPSOpcode op)
QuickCallFunction(R1, (void *)&CallSyscall);
}
RestoreDowncount();
SetRoundingMode();
WriteSyscallExit();
js.compiling = false;

View File

@ -467,10 +467,13 @@ void Jit::Comp_Generic(MIPSOpcode op)
if (func)
{
SaveDowncount();
// TODO: Perhaps keep the rounding mode for interp?
ClearRoundingMode();
gpr.SetRegImm(SCRATCHREG1, js.compilerPC);
MovToPC(SCRATCHREG1);
gpr.SetRegImm(R0, op.encoding);
QuickCallFunction(R1, (void *)func);
SetRoundingMode();
RestoreDowncount();
}
@ -544,20 +547,18 @@ void Jit::WriteDownCountR(ARMReg reg)
void Jit::ClearRoundingMode()
{
if (js.roundingModeSet && g_Config.bSetRoundingMode)
if (g_Config.bSetRoundingMode)
{
VMRS(SCRATCHREG2);
// Assume we're always in round-to-nearest mode beforehand.
BIC(SCRATCHREG1, SCRATCHREG2, AssumeMakeOperand2(3 << 22));
VMSR(SCRATCHREG1);
js.roundingModeSet = false;
}
}
void Jit::SetRoundingMode()
{
if (!js.roundingModeSet && g_Config.bSetRoundingMode)
if (g_Config.bSetRoundingMode)
{
LDR(SCRATCHREG1, CTXREG, offsetof(MIPSState, fcr31));
AND(SCRATCHREG1, SCRATCHREG1, Operand2(3));
@ -575,8 +576,6 @@ void Jit::SetRoundingMode()
// Assume we're always in round-to-nearest mode beforehand.
ORR(SCRATCHREG1, SCRATCHREG2, Operand2(SCRATCHREG1, ST_LSL, 22));
VMSR(SCRATCHREG1);
js.roundingModeSet = true;
}
}
@ -587,7 +586,6 @@ void Jit::SetRoundingMode()
void Jit::WriteExit(u32 destination, int exit_num)
{
WriteDownCount();
ClearRoundingMode();
//If nobody has taken care of this yet (this can be removed when all branches are done)
JitBlock *b = js.curBlock;
b->exitAddress[exit_num] = destination;
@ -609,7 +607,6 @@ void Jit::WriteExitDestInR(ARMReg Reg)
{
MovToPC(Reg);
WriteDownCount();
ClearRoundingMode();
// TODO: shouldn't need an indirect branch here...
B((const void *)dispatcher);
}
@ -617,7 +614,6 @@ void Jit::WriteExitDestInR(ARMReg Reg)
void Jit::WriteSyscallExit()
{
WriteDownCount();
ClearRoundingMode();
B((const void *)dispatcherCheckCoreState);
}

View File

@ -58,8 +58,7 @@ namespace MIPSComp {
: startDefaultPrefix(true),
prefixSFlag(PREFIX_UNKNOWN),
prefixTFlag(PREFIX_UNKNOWN),
prefixDFlag(PREFIX_UNKNOWN),
roundingModeSet(false) {}
prefixDFlag(PREFIX_UNKNOWN) {}
u32 compilerPC;
u32 blockStart;
@ -82,8 +81,6 @@ namespace MIPSComp {
PrefixState prefixTFlag;
PrefixState prefixDFlag;
bool roundingModeSet;
void PrefixStart() {
if (startDefaultPrefix) {
EatPrefix();