Merge pull request #419 from magumagu/jit-load-store-cleanup
Jit load store cleanup
This commit is contained in:
commit
e9975cdd63
|
@ -176,14 +176,14 @@ void Jit64::lXXx(UGeckoInstruction inst)
|
|||
{
|
||||
u32 val = (u32)gpr.R(a).offset + (s32)inst.SIMM_16;
|
||||
opAddress = Imm32(val);
|
||||
if (update && !js.memcheck)
|
||||
if (update)
|
||||
gpr.SetImmediate32(a, val);
|
||||
}
|
||||
else if ((inst.OPCD == 31) && gpr.R(a).IsImm() && gpr.R(b).IsImm() && !js.memcheck)
|
||||
{
|
||||
u32 val = (u32)gpr.R(a).offset + (u32)gpr.R(b).offset;
|
||||
opAddress = Imm32(val);
|
||||
if (update && !js.memcheck)
|
||||
if (update)
|
||||
gpr.SetImmediate32(a, val);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -324,12 +324,8 @@ void Jit64::lfsx(UGeckoInstruction inst)
|
|||
#else
|
||||
MOVD_xmm(XMM0, MComplex(RBX, EAX, SCALE_1, 0));
|
||||
#endif
|
||||
MEMCHECK_START
|
||||
|
||||
PSHUFB(XMM0, M((void *)bswapShuffle1x4));
|
||||
ConvertSingleToDouble(s, XMM0);
|
||||
|
||||
MEMCHECK_END
|
||||
} else {
|
||||
SafeLoadToReg(EAX, R(EAX), 32, 0, RegistersInUse(), false);
|
||||
|
||||
|
|
|
@ -358,74 +358,44 @@ void EmuCodeBlock::SafeLoadToReg(X64Reg reg_value, const Gen::OpArg & opAddress,
|
|||
}
|
||||
else
|
||||
{
|
||||
OpArg addr_loc = opAddress;
|
||||
if (offset)
|
||||
{
|
||||
addr_loc = R(EAX);
|
||||
MOV(32, R(EAX), opAddress);
|
||||
ADD(32, R(EAX), Imm32(offset));
|
||||
TEST(32, R(EAX), Imm32(mem_mask));
|
||||
FixupBranch fast = J_CC(CC_Z, true);
|
||||
|
||||
ABI_PushRegistersAndAdjustStack(registersInUse, false);
|
||||
switch (accessSize)
|
||||
{
|
||||
case 32: ABI_CallFunctionR((void *)&Memory::Read_U32, EAX); break;
|
||||
case 16: ABI_CallFunctionR((void *)&Memory::Read_U16_ZX, EAX); break;
|
||||
case 8: ABI_CallFunctionR((void *)&Memory::Read_U8_ZX, EAX); break;
|
||||
}
|
||||
ABI_PopRegistersAndAdjustStack(registersInUse, false);
|
||||
|
||||
MEMCHECK_START
|
||||
|
||||
if (signExtend && accessSize < 32)
|
||||
{
|
||||
// Need to sign extend values coming from the Read_U* functions.
|
||||
MOVSX(32, accessSize, reg_value, R(EAX));
|
||||
}
|
||||
else if (reg_value != EAX)
|
||||
{
|
||||
MOVZX(32, accessSize, reg_value, R(EAX));
|
||||
}
|
||||
|
||||
MEMCHECK_END
|
||||
|
||||
FixupBranch exit = J();
|
||||
SetJumpTarget(fast);
|
||||
UnsafeLoadToReg(reg_value, R(EAX), accessSize, 0, signExtend);
|
||||
SetJumpTarget(exit);
|
||||
}
|
||||
else
|
||||
TEST(32, addr_loc, Imm32(mem_mask));
|
||||
|
||||
FixupBranch fast = J_CC(CC_Z, true);
|
||||
|
||||
ABI_PushRegistersAndAdjustStack(registersInUse, false);
|
||||
switch (accessSize)
|
||||
{
|
||||
TEST(32, opAddress, Imm32(mem_mask));
|
||||
FixupBranch fast = J_CC(CC_Z, true);
|
||||
|
||||
ABI_PushRegistersAndAdjustStack(registersInUse, false);
|
||||
switch (accessSize)
|
||||
{
|
||||
case 32: ABI_CallFunctionA((void *)&Memory::Read_U32, opAddress); break;
|
||||
case 16: ABI_CallFunctionA((void *)&Memory::Read_U16_ZX, opAddress); break;
|
||||
case 8: ABI_CallFunctionA((void *)&Memory::Read_U8_ZX, opAddress); break;
|
||||
}
|
||||
ABI_PopRegistersAndAdjustStack(registersInUse, false);
|
||||
|
||||
MEMCHECK_START
|
||||
|
||||
if (signExtend && accessSize < 32)
|
||||
{
|
||||
// Need to sign extend values coming from the Read_U* functions.
|
||||
MOVSX(32, accessSize, reg_value, R(EAX));
|
||||
}
|
||||
else if (reg_value != EAX)
|
||||
{
|
||||
MOVZX(32, accessSize, reg_value, R(EAX));
|
||||
}
|
||||
|
||||
MEMCHECK_END
|
||||
|
||||
FixupBranch exit = J();
|
||||
SetJumpTarget(fast);
|
||||
UnsafeLoadToReg(reg_value, opAddress, accessSize, offset, signExtend);
|
||||
SetJumpTarget(exit);
|
||||
case 32: ABI_CallFunctionA((void *)&Memory::Read_U32, addr_loc); break;
|
||||
case 16: ABI_CallFunctionA((void *)&Memory::Read_U16_ZX, addr_loc); break;
|
||||
case 8: ABI_CallFunctionA((void *)&Memory::Read_U8_ZX, addr_loc); break;
|
||||
}
|
||||
ABI_PopRegistersAndAdjustStack(registersInUse, false);
|
||||
|
||||
MEMCHECK_START
|
||||
|
||||
if (signExtend && accessSize < 32)
|
||||
{
|
||||
// Need to sign extend values coming from the Read_U* functions.
|
||||
MOVSX(32, accessSize, reg_value, R(EAX));
|
||||
}
|
||||
else if (reg_value != EAX)
|
||||
{
|
||||
MOVZX(32, accessSize, reg_value, R(EAX));
|
||||
}
|
||||
|
||||
MEMCHECK_END
|
||||
|
||||
FixupBranch exit = J();
|
||||
SetJumpTarget(fast);
|
||||
UnsafeLoadToReg(reg_value, addr_loc, accessSize, 0, signExtend);
|
||||
SetJumpTarget(exit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue