Jit_LoadStoreFloating: stfXXX

This commit is contained in:
MerryMage 2018-10-15 21:01:48 +01:00
parent f564da7233
commit dcfe955087
1 changed files with 24 additions and 22 deletions

View File

@ -107,26 +107,31 @@ void Jit64::stfXXX(UGeckoInstruction inst)
{ {
if (js.op->fprIsStoreSafe[s]) if (js.op->fprIsStoreSafe[s])
{ {
CVTSD2SS(XMM0, fpr.R(s)); RCOpArg Rs = fpr.Use(s, RCMode::Read);
RegCache::Realize(Rs);
CVTSD2SS(XMM0, Rs);
} }
else else
{ {
fpr.BindToRegister(s, true, false); RCX64Reg Rs = fpr.Bind(s, RCMode::Read);
ConvertDoubleToSingle(XMM0, fpr.RX(s)); RegCache::Realize(Rs);
ConvertDoubleToSingle(XMM0, Rs);
} }
MOVD_xmm(R(RSCRATCH), XMM0); MOVD_xmm(R(RSCRATCH), XMM0);
} }
else else
{ {
if (fpr.R(s).IsSimpleReg()) RCOpArg Rs = fpr.Use(s, RCMode::Read);
MOVQ_xmm(R(RSCRATCH), fpr.RX(s)); RegCache::Realize(Rs);
if (Rs.IsSimpleReg())
MOVQ_xmm(R(RSCRATCH), Rs.GetSimpleReg());
else else
MOV(64, R(RSCRATCH), fpr.R(s)); MOV(64, R(RSCRATCH), Rs);
} }
if (!indexed && (!a || gpr.R(a).IsImm())) if (!indexed && (!a || gpr.IsImm(a)))
{ {
u32 addr = (a ? gpr.R(a).Imm32() : 0) + imm; u32 addr = (a ? gpr.Imm32(a) : 0) + imm;
bool exception = bool exception =
WriteToConstAddress(accessSize, R(RSCRATCH), addr, CallerSavedRegistersInUse()); WriteToConstAddress(accessSize, R(RSCRATCH), addr, CallerSavedRegistersInUse());
@ -138,33 +143,34 @@ void Jit64::stfXXX(UGeckoInstruction inst)
} }
else else
{ {
gpr.KillImmediate(a, true, true); RCOpArg Ra = gpr.UseNoImm(a, RCMode::ReadWrite);
RegCache::Realize(Ra);
MemoryExceptionCheck(); MemoryExceptionCheck();
ADD(32, gpr.R(a), Imm32((u32)imm)); ADD(32, Ra, Imm32((u32)imm));
} }
} }
fpr.UnlockAll();
gpr.UnlockAll();
return; return;
} }
s32 offset = 0; s32 offset = 0;
if (update) RCOpArg Ra = update ? gpr.Bind(a, RCMode::ReadWrite) : gpr.Use(a, RCMode::Read);
gpr.BindToRegister(a, true, true); RegCache::Realize(Ra);
if (indexed) if (indexed)
{ {
MOV_sum(32, RSCRATCH2, a ? gpr.R(a) : Imm32(0), gpr.R(b)); RCOpArg Rb = gpr.Use(b, RCMode::Read);
RegCache::Realize(Rb);
MOV_sum(32, RSCRATCH2, a ? Ra.Location() : Imm32(0), Rb);
} }
else else
{ {
if (update) if (update)
{ {
LEA(32, RSCRATCH2, MDisp(gpr.RX(a), imm)); MOV_sum(32, RSCRATCH2, Ra, Imm32(imm));
} }
else else
{ {
offset = imm; offset = imm;
MOV(32, R(RSCRATCH2), gpr.R(a)); MOV(32, R(RSCRATCH2), Ra);
} }
} }
@ -176,11 +182,7 @@ void Jit64::stfXXX(UGeckoInstruction inst)
SafeWriteRegToReg(RSCRATCH, RSCRATCH2, accessSize, offset, registersInUse); SafeWriteRegToReg(RSCRATCH, RSCRATCH2, accessSize, offset, registersInUse);
if (update) if (update)
MOV(32, gpr.R(a), R(RSCRATCH2)); MOV(32, Ra, R(RSCRATCH2));
fpr.UnlockAll();
gpr.UnlockAll();
gpr.UnlockAllX();
} }
// This one is a little bit weird; it stores the low 32 bits of a double without converting it // This one is a little bit weird; it stores the low 32 bits of a double without converting it