JitArm64: Avoid double rounding in fctiwzx
FCVT doesn't necessarily round to zero, so the result might be inaccurate if we use it. To ensure correct rounding, we use FCVTS from double FPR to 32-bit GPR. Unfortunately, FCVTS can't do double FPR to single FPR.
This commit is contained in:
parent
5ec65a20d6
commit
8b4f16a310
|
@ -339,8 +339,12 @@ void JitArm64::fctiwzx(UGeckoInstruction inst)
|
|||
}
|
||||
else
|
||||
{
|
||||
m_float_emit.FCVT(32, 64, EncodeRegToDouble(VD), EncodeRegToDouble(VB));
|
||||
m_float_emit.FCVTS(EncodeRegToSingle(VD), EncodeRegToSingle(VD), ROUND_Z);
|
||||
ARM64Reg V1 = gpr.GetReg();
|
||||
|
||||
m_float_emit.FCVTS(V1, EncodeRegToDouble(VB), ROUND_Z);
|
||||
m_float_emit.FMOV(EncodeRegToSingle(VD), V1);
|
||||
|
||||
gpr.Unlock(V1);
|
||||
}
|
||||
m_float_emit.ORR(EncodeRegToDouble(VD), EncodeRegToDouble(VD), EncodeRegToDouble(V0));
|
||||
fpr.Unlock(V0);
|
||||
|
|
Loading…
Reference in New Issue