Jit64: Correctly handle NaNs for ps_mulsX

This commit is contained in:
JosJuice 2022-11-25 22:36:06 +01:00
parent d3180e3516
commit cbceae9176

View File

@ -98,23 +98,26 @@ void Jit64::ps_muls(UGeckoInstruction inst)
RCOpArg Ra = fpr.Use(a, RCMode::Read);
RCOpArg Rc = fpr.Use(c, RCMode::Read);
RCX64Reg Rd = fpr.Bind(d, RCMode::Write);
RegCache::Realize(Ra, Rc, Rd);
RCX64Reg Rc_duplicated = m_accurate_nans ? fpr.Scratch() : fpr.Scratch(XMM1);
RegCache::Realize(Ra, Rc, Rd, Rc_duplicated);
switch (inst.SUBOP5)
{
case 12: // ps_muls0
MOVDDUP(XMM1, Rc);
MOVDDUP(Rc_duplicated, Rc);
break;
case 13: // ps_muls1
avx_op(&XEmitter::VSHUFPD, &XEmitter::SHUFPD, XMM1, Rc, Rc, 3);
avx_op(&XEmitter::VSHUFPD, &XEmitter::SHUFPD, Rc_duplicated, Rc, Rc, 3);
break;
default:
PanicAlertFmt("ps_muls WTF!!!");
}
if (round_input)
Force25BitPrecision(XMM1, R(XMM1), XMM0);
Force25BitPrecision(XMM1, R(Rc_duplicated), XMM0);
else if (XMM1 != Rc_duplicated)
MOVAPD(XMM1, Rc_duplicated);
MULPD(XMM1, Ra);
HandleNaNs(inst, XMM1, XMM0, Ra, std::nullopt, Rc);
HandleNaNs(inst, XMM1, XMM0, Ra, std::nullopt, Rc_duplicated);
FinalizeSingleResult(Rd, R(XMM1));
}