From ade6ae24e9b6332d77ddc4cf598e9da40a0bc28b Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Thu, 11 Oct 2018 04:32:49 +0200 Subject: [PATCH] - fix CASTB opcode implementation --- src/scripting/vm/jit_move.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/scripting/vm/jit_move.cpp b/src/scripting/vm/jit_move.cpp index ce7b72f208..9b82f44118 100644 --- a/src/scripting/vm/jit_move.cpp +++ b/src/scripting/vm/jit_move.cpp @@ -165,8 +165,9 @@ void JitCompiler::EmitCASTB() { if (C == CASTB_I) { - cc.mov(regD[A], regD[B]); - cc.shr(regD[A], 31); + cc.cmp(regD[B], (int)0); + cc.setne(regD[A]); + cc.movzx(regD[A], regD[A].r8Lo()); // not sure if this is needed } else if (C == CASTB_F) { @@ -174,14 +175,16 @@ void JitCompiler::EmitCASTB() auto one = newTempInt32(); cc.xorpd(zero, zero); cc.mov(one, 1); - cc.ucomisd(regF[A], zero); + cc.xor_(regD[A], regD[A]); + cc.ucomisd(regF[B], zero); cc.setp(regD[A]); cc.cmovne(regD[A], one); } else if (C == CASTB_A) { - cc.test(regA[A], regA[A]); + cc.test(regA[B], regA[B]); cc.setne(regD[A]); + cc.movzx(regD[A], regD[A].r8Lo()); // not sure if this is needed } else {