Jit64AsmCommon: Make ConvertDoubleToSingle use RSCRATCH as output

This commit is contained in:
MerryMage 2019-05-25 22:51:02 +01:00
parent ec8d57d882
commit 12314577c1
3 changed files with 7 additions and 6 deletions

View File

@ -110,6 +110,7 @@ void Jit64::stfXXX(UGeckoInstruction inst)
RCOpArg Rs = fpr.Use(s, RCMode::Read); RCOpArg Rs = fpr.Use(s, RCMode::Read);
RegCache::Realize(Rs); RegCache::Realize(Rs);
CVTSD2SS(XMM0, Rs); CVTSD2SS(XMM0, Rs);
MOVD_xmm(R(RSCRATCH), XMM0);
} }
else else
{ {
@ -118,7 +119,6 @@ void Jit64::stfXXX(UGeckoInstruction inst)
MOVAPD(XMM0, Rs); MOVAPD(XMM0, Rs);
CALL(asm_routines.cdts); CALL(asm_routines.cdts);
} }
MOVD_xmm(R(RSCRATCH), XMM0);
} }
else else
{ {

View File

@ -50,8 +50,8 @@ alignas(16) static const __m128i double_bottom_bits = _mm_set_epi64x(0, 0x07ffff
void CommonAsmRoutines::GenConvertDoubleToSingle() void CommonAsmRoutines::GenConvertDoubleToSingle()
{ {
// Input in XMM0, output to XMM0 // Input in XMM0, output to RSCRATCH
// Clobbers RSCRATCH/RSCRATCH2/XMM1 // Clobbers RSCRATCH/RSCRATCH2/XMM0/XMM1
const void* start = GetCodePtr(); const void* start = GetCodePtr();
@ -79,6 +79,7 @@ void CommonAsmRoutines::GenConvertDoubleToSingle()
// OR them togther // OR them togther
POR(XMM0, R(XMM1)); POR(XMM0, R(XMM1));
MOVD_xmm(R(RSCRATCH), XMM0);
RET(); RET();
// Denormalise // Denormalise
@ -95,13 +96,13 @@ void CommonAsmRoutines::GenConvertDoubleToSingle()
// fraction >> shift // fraction >> shift
PSRLQ(XMM0, R(XMM1)); PSRLQ(XMM0, R(XMM1));
MOVD_xmm(R(RSCRATCH), XMM0);
// OR the sign bit in. // OR the sign bit in.
SHR(64, R(RSCRATCH2), Imm8(32)); SHR(64, R(RSCRATCH2), Imm8(32));
AND(32, R(RSCRATCH2), Imm32(0x80000000)); AND(32, R(RSCRATCH2), Imm32(0x80000000));
MOVQ_xmm(XMM1, R(RSCRATCH2));
POR(XMM0, R(XMM1)); OR(32, R(RSCRATCH), R(RSCRATCH2));
RET(); RET();
JitRegister::Register(start, GetCodePtr(), "JIT_cdts"); JitRegister::Register(start, GetCodePtr(), "JIT_cdts");

View File

@ -37,7 +37,7 @@ public:
// Call // Call
MOVQ_xmm(XMM0, R(ABI_PARAM1)); MOVQ_xmm(XMM0, R(ABI_PARAM1));
ABI_CallFunction(raw_cdts); 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); ABI_PopRegistersAndAdjustStack(ABI_ALL_CALLEE_SAVED, 8, 16);
RET(); RET();