From 2c89d1e69447d0bc593d22206c58ad7647686f31 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Thu, 11 Oct 2018 03:53:11 +0200 Subject: [PATCH] - fix missing convert from float to double in LSP and LSP_R opcodes - fix missing convert from double to float in SSP and SSP_R opcodes --- src/scripting/vm/jit_load.cpp | 6 ++++-- src/scripting/vm/jit_store.cpp | 10 ++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/scripting/vm/jit_load.cpp b/src/scripting/vm/jit_load.cpp index e8864af5c..5f0b8d52f 100644 --- a/src/scripting/vm/jit_load.cpp +++ b/src/scripting/vm/jit_load.cpp @@ -172,13 +172,15 @@ void JitCompiler::EmitLHU_R() void JitCompiler::EmitLSP() { EmitNullPointerThrow(B, X_READ_NIL); - cc.movss(regF[A], asmjit::x86::dword_ptr(regA[B], konstd[C])); + cc.xorpd(regF[A], regF[A]); + cc.cvtss2sd(regF[A], asmjit::x86::dword_ptr(regA[B], konstd[C])); } void JitCompiler::EmitLSP_R() { EmitNullPointerThrow(B, X_READ_NIL); - cc.movss(regF[A], asmjit::x86::dword_ptr(regA[B], regD[C])); + cc.xorpd(regF[A], regF[A]); + cc.cvtss2sd(regF[A], asmjit::x86::dword_ptr(regA[B], regD[C])); } void JitCompiler::EmitLDP() diff --git a/src/scripting/vm/jit_store.cpp b/src/scripting/vm/jit_store.cpp index 3ae500a1a..c1d739f0f 100644 --- a/src/scripting/vm/jit_store.cpp +++ b/src/scripting/vm/jit_store.cpp @@ -40,13 +40,19 @@ void JitCompiler::EmitSW_R() void JitCompiler::EmitSSP() { EmitNullPointerThrow(A, X_WRITE_NIL); - cc.movss(asmjit::x86::dword_ptr(regA[A], konstd[C]), regF[B]); + auto tmp = newTempXmmSd(); + cc.xorpd(tmp, tmp); + cc.cvtsd2ss(tmp, regF[B]); + cc.movss(asmjit::x86::dword_ptr(regA[A], konstd[C]), tmp); } void JitCompiler::EmitSSP_R() { EmitNullPointerThrow(A, X_WRITE_NIL); - cc.movss(asmjit::x86::dword_ptr(regA[A], regD[C]), regF[B]); + auto tmp = newTempXmmSd(); + cc.xorpd(tmp, tmp); + cc.cvtsd2ss(tmp, regF[B]); + cc.movss(asmjit::x86::dword_ptr(regA[A], regD[C]), tmp); } void JitCompiler::EmitSDP()