Core: Make sure precision is set to 53bit

This commit is contained in:
zilmar 2024-03-07 20:52:24 +10:30
parent 290040d945
commit 97ec1f533b
1 changed files with 7 additions and 5 deletions

View File

@ -287,22 +287,24 @@ void CX86RegInfo::FixRoundModel(FPU_ROUND RoundMethod)
m_Assembler.fpuStoreControl(&m_fpuControl, "m_fpuControl");
asmjit::x86::Gp reg = Map_TempReg(x86Reg_Unknown, -1, false, false);
m_Assembler.MoveVariableToX86reg(reg, &m_fpuControl, "m_fpuControl");
m_Assembler.and_(reg, 0xF3FF);
m_Assembler.and_(reg, 0xF0FF);
uint16_t Precision = 0x200;
if (RoundMethod == RoundDefault)
{
asmjit::x86::Gp RoundReg = Map_TempReg(x86Reg_Unknown, -1, false, false);
m_Assembler.OrVariableToX86Reg(reg, &CX86RecompilerOps::m_RoundingModeValue, "m_RoundingModeValue");
m_Assembler.or_(reg, Precision);
SetX86Protected(GetIndexFromX86Reg(RoundReg), false);
}
else
{
switch (RoundMethod)
{
case RoundTruncate: m_Assembler.or_(reg, 0x0C00); break;
case RoundNearest: m_Assembler.or_(reg, 0x0000); break;
case RoundDown: m_Assembler.or_(reg, 0x0400); break;
case RoundUp: m_Assembler.or_(reg, 0x0800); break;
case RoundTruncate: m_Assembler.or_(reg, 0x0C00 | Precision); break;
case RoundNearest: m_Assembler.or_(reg, 0x0000 | Precision); break;
case RoundDown: m_Assembler.or_(reg, 0x0400 | Precision); break;
case RoundUp: m_Assembler.or_(reg, 0x0800 | Precision); break;
default:
g_Notify->DisplayError("Unknown rounding model");
}