Core: Update R4300iOp::COP1_S_MUL to handle exceptions
This commit is contained in:
parent
cbf67cede4
commit
ce69324dbe
|
@ -2151,8 +2151,20 @@ void R4300iOp::COP1_S_MUL()
|
|||
{
|
||||
return;
|
||||
}
|
||||
_FPCR[31] &= ~0x0003F000;
|
||||
fesetround(*_RoundingModel);
|
||||
*(float *)_FPR_S[m_Opcode.fd] = (*(float *)_FPR_S[m_Opcode.fs] * *(float *)_FPR_S[m_Opcode.ft]);
|
||||
feclearexcept(FE_ALL_EXCEPT);
|
||||
|
||||
if (!CheckFPUInput32(*(float *)_FPR_S[m_Opcode.fs]) || !CheckFPUInput32(*(float *)_FPR_S[m_Opcode.ft]))
|
||||
{
|
||||
return;
|
||||
}
|
||||
float Result = (*(float *)_FPR_S[m_Opcode.fs] * *(float *)_FPR_S[m_Opcode.ft]);
|
||||
if (CheckFPUException() || CheckFPUResult32(Result))
|
||||
{
|
||||
return;
|
||||
}
|
||||
*(uint32_t *)_FPR_S[m_Opcode.fd] = *(uint32_t *)&Result;
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_S_DIV()
|
||||
|
@ -2493,7 +2505,6 @@ void R4300iOp::COP1_D_SUB()
|
|||
return;
|
||||
}
|
||||
*(uint64_t *)_FPR_D[m_Opcode.fd] = *(uint64_t *)&Result;
|
||||
|
||||
}
|
||||
|
||||
void R4300iOp::COP1_D_MUL()
|
||||
|
@ -3040,6 +3051,17 @@ bool R4300iOp::CheckFPUException(void)
|
|||
|
||||
bool Res = false;
|
||||
FPStatusReg & StatusReg = (FPStatusReg &)_FPCR[31];
|
||||
if ((Except & FE_UNDERFLOW) != 0)
|
||||
{
|
||||
if (StatusReg.FlushSubnormals == 0 || StatusReg.Enable.Underflow || StatusReg.Enable.Inexact)
|
||||
{
|
||||
StatusReg.Cause.UnimplementedOperation = 1;
|
||||
Res = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Res)
|
||||
{
|
||||
if ((Except & FE_INEXACT) != 0)
|
||||
{
|
||||
StatusReg.Cause.Inexact = 1;
|
||||
|
@ -3100,6 +3122,7 @@ bool R4300iOp::CheckFPUException(void)
|
|||
StatusReg.Flags.InvalidOperation = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Res)
|
||||
{
|
||||
g_Reg->DoFloatingPointException(g_System->m_PipelineStage == PIPELINE_STAGE_JUMP);
|
||||
|
|
Loading…
Reference in New Issue