diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp index 9c1484cfe0..2ce40f08c8 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp @@ -110,6 +110,7 @@ void Jit64::stfXXX(UGeckoInstruction inst) RCOpArg Rs = fpr.Use(s, RCMode::Read); RegCache::Realize(Rs); CVTSD2SS(XMM0, Rs); + MOVD_xmm(R(RSCRATCH), XMM0); } else { @@ -118,7 +119,6 @@ void Jit64::stfXXX(UGeckoInstruction inst) MOVAPD(XMM0, Rs); CALL(asm_routines.cdts); } - MOVD_xmm(R(RSCRATCH), XMM0); } else { diff --git a/Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp b/Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp index d7f7077f6e..f841a216c2 100644 --- a/Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp +++ b/Source/Core/Core/PowerPC/Jit64Common/Jit64AsmCommon.cpp @@ -50,8 +50,8 @@ alignas(16) static const __m128i double_bottom_bits = _mm_set_epi64x(0, 0x07ffff void CommonAsmRoutines::GenConvertDoubleToSingle() { - // Input in XMM0, output to XMM0 - // Clobbers RSCRATCH/RSCRATCH2/XMM1 + // Input in XMM0, output to RSCRATCH + // Clobbers RSCRATCH/RSCRATCH2/XMM0/XMM1 const void* start = GetCodePtr(); @@ -79,6 +79,7 @@ void CommonAsmRoutines::GenConvertDoubleToSingle() // OR them togther POR(XMM0, R(XMM1)); + MOVD_xmm(R(RSCRATCH), XMM0); RET(); // Denormalise @@ -95,13 +96,13 @@ void CommonAsmRoutines::GenConvertDoubleToSingle() // fraction >> shift PSRLQ(XMM0, R(XMM1)); + MOVD_xmm(R(RSCRATCH), XMM0); // OR the sign bit in. SHR(64, R(RSCRATCH2), Imm8(32)); AND(32, R(RSCRATCH2), Imm32(0x80000000)); - MOVQ_xmm(XMM1, R(RSCRATCH2)); - POR(XMM0, R(XMM1)); + OR(32, R(RSCRATCH), R(RSCRATCH2)); RET(); JitRegister::Register(start, GetCodePtr(), "JIT_cdts"); diff --git a/Source/UnitTests/Core/PowerPC/Jit64Common/ConvertDoubleToSingle.cpp b/Source/UnitTests/Core/PowerPC/Jit64Common/ConvertDoubleToSingle.cpp index c21ef579aa..41ca31b273 100644 --- a/Source/UnitTests/Core/PowerPC/Jit64Common/ConvertDoubleToSingle.cpp +++ b/Source/UnitTests/Core/PowerPC/Jit64Common/ConvertDoubleToSingle.cpp @@ -37,7 +37,7 @@ public: // Call MOVQ_xmm(XMM0, R(ABI_PARAM1)); ABI_CallFunction(raw_cdts); - MOVQ_xmm(R(ABI_RETURN), XMM0); + MOV(32, R(ABI_RETURN), R(RSCRATCH)); ABI_PopRegistersAndAdjustStack(ABI_ALL_CALLEE_SAVED, 8, 16); RET();