mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-30 15:52:09 +00:00
Fix the code for MODF_RK in the JIT compiler.
This commit is contained in:
parent
566eb58000
commit
96b8f12a30
1 changed files with 19 additions and 13 deletions
|
@ -757,21 +757,27 @@ void JitCompiler::EmitMODF_RR()
|
||||||
|
|
||||||
void JitCompiler::EmitMODF_RK()
|
void JitCompiler::EmitMODF_RK()
|
||||||
{
|
{
|
||||||
auto label = EmitThrowExceptionLabel(X_DIVISION_BY_ZERO);
|
if (konstf[C] == 0.)
|
||||||
cc.ptest(regF[C], regF[C]);
|
{
|
||||||
cc.je(label);
|
EmitThrowException(X_DIVISION_BY_ZERO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto tmpPtr = newTempIntPtr();
|
||||||
|
cc.mov(tmpPtr, asmjit::imm_ptr(&konstf[C]));
|
||||||
|
|
||||||
auto tmp = newTempXmmSd();
|
auto tmp = newTempXmmSd();
|
||||||
cc.movsd(tmp, asmjit::x86::ptr(ToMemAddress(&konstf[C])));
|
cc.movsd(tmp, asmjit::x86::qword_ptr(tmpPtr));
|
||||||
|
|
||||||
auto result = newResultXmmSd();
|
auto result = newResultXmmSd();
|
||||||
auto call = CreateCall<double, double, double>([](double a, double b) -> double {
|
auto call = CreateCall<double, double, double>([](double a, double b) -> double {
|
||||||
return a - floor(a / b) * b;
|
return a - floor(a / b) * b;
|
||||||
});
|
});
|
||||||
call->setRet(0, result);
|
call->setRet(0, result);
|
||||||
call->setArg(0, regF[B]);
|
call->setArg(0, regF[B]);
|
||||||
call->setArg(1, tmp);
|
call->setArg(1, tmp);
|
||||||
cc.movsd(regF[A], result);
|
cc.movsd(regF[A], result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void JitCompiler::EmitMODF_KR()
|
void JitCompiler::EmitMODF_KR()
|
||||||
|
|
Loading…
Reference in a new issue