From d88d173b38b4f0070db7e490a9abe8c25b81a5cd Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 2 Dec 2018 20:44:36 +0100 Subject: [PATCH] - ptest is a SSE 4.1 instruction --- src/scripting/vm/jit_math.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/scripting/vm/jit_math.cpp b/src/scripting/vm/jit_math.cpp index 2a9c50297a..225ef8173d 100644 --- a/src/scripting/vm/jit_math.cpp +++ b/src/scripting/vm/jit_math.cpp @@ -708,7 +708,9 @@ void JitCompiler::EmitMULF_RK() void JitCompiler::EmitDIVF_RR() { auto label = EmitThrowExceptionLabel(X_DIVISION_BY_ZERO); - cc.ptest(regF[C], regF[C]); + auto zero = newTempXmmSd(); + cc.xorpd(zero, zero); + cc.ucomisd(regF[C], zero); cc.je(label); auto rc = CheckRegF(C, A); @@ -748,7 +750,9 @@ static double DoubleModF(double a, double b) void JitCompiler::EmitMODF_RR() { auto label = EmitThrowExceptionLabel(X_DIVISION_BY_ZERO); - cc.ptest(regF[C], regF[C]); + auto zero = newTempXmmSd(); + cc.xorpd(zero, zero); + cc.ucomisd(regF[C], zero); cc.je(label); auto result = newResultXmmSd(); @@ -787,7 +791,9 @@ void JitCompiler::EmitMODF_KR() using namespace asmjit; auto label = EmitThrowExceptionLabel(X_DIVISION_BY_ZERO); - cc.ptest(regF[C], regF[C]); + auto zero = newTempXmmSd(); + cc.xorpd(zero, zero); + cc.ucomisd(regF[C], zero); cc.je(label); auto tmp = newTempXmmSd();