x64Emitter: J_CC: use 32 bit offset automatically
This commit is contained in:
parent
3a06907653
commit
f8280401f6
|
@ -447,27 +447,25 @@ FixupBranch XEmitter::J_CC(CCFlags conditionCode, bool force5bytes)
|
||||||
return branch;
|
return branch;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XEmitter::J_CC(CCFlags conditionCode, const u8 * addr, bool force5Bytes)
|
void XEmitter::J_CC(CCFlags conditionCode, const u8* addr)
|
||||||
{
|
{
|
||||||
u64 fn = (u64)addr;
|
u64 fn = (u64)addr;
|
||||||
if (!force5Bytes)
|
s64 distance = (s64)(fn - ((u64)code + 2));
|
||||||
|
if (distance < -0x80 || distance >= 0x80)
|
||||||
{
|
{
|
||||||
s64 distance = (s64)(fn - ((u64)code + 2));
|
distance = (s64)(fn - ((u64)code + 6));
|
||||||
_assert_msg_(DYNA_REC, distance >= -0x80 && distance < 0x80, "Jump target too far away, needs force5Bytes = true");
|
|
||||||
//8 bits will do
|
|
||||||
Write8(0x70 + conditionCode);
|
|
||||||
Write8((u8)(s8)distance);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
s64 distance = (s64)(fn - ((u64)code + 6));
|
|
||||||
_assert_msg_(DYNA_REC,
|
_assert_msg_(DYNA_REC,
|
||||||
distance >= -0x80000000LL && distance < 0x80000000LL,
|
distance >= -0x80000000LL && distance < 0x80000000LL,
|
||||||
"Jump target too far away, needs indirect register");
|
"Jump target too far away, needs indirect register");
|
||||||
Write8(0x0F);
|
Write8(0x0F);
|
||||||
Write8(0x80 + conditionCode);
|
Write8(0x80 + conditionCode);
|
||||||
Write32((u32)(s32)distance);
|
Write32((u32)(s32)distance);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Write8(0x70 + conditionCode);
|
||||||
|
Write8((u8)(s8)distance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XEmitter::SetJumpTarget(const FixupBranch &branch)
|
void XEmitter::SetJumpTarget(const FixupBranch &branch)
|
||||||
|
|
|
@ -331,7 +331,7 @@ public:
|
||||||
|
|
||||||
FixupBranch J_CC(CCFlags conditionCode, bool force5bytes = false);
|
FixupBranch J_CC(CCFlags conditionCode, bool force5bytes = false);
|
||||||
//void J_CC(CCFlags conditionCode, JumpTarget target);
|
//void J_CC(CCFlags conditionCode, JumpTarget target);
|
||||||
void J_CC(CCFlags conditionCode, const u8 * addr, bool force5Bytes = false);
|
void J_CC(CCFlags conditionCode, const u8* addr);
|
||||||
|
|
||||||
void SetJumpTarget(const FixupBranch &branch);
|
void SetJumpTarget(const FixupBranch &branch);
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,7 @@ void Jit64AsmRoutineManager::Generate()
|
||||||
SetJumpTarget(noExtException);
|
SetJumpTarget(noExtException);
|
||||||
|
|
||||||
TEST(32, M((void*)PowerPC::GetStatePtr()), Imm32(0xFFFFFFFF));
|
TEST(32, M((void*)PowerPC::GetStatePtr()), Imm32(0xFFFFFFFF));
|
||||||
J_CC(CC_Z, outerLoop, true);
|
J_CC(CC_Z, outerLoop);
|
||||||
|
|
||||||
//Landing pad for drec space
|
//Landing pad for drec space
|
||||||
ABI_PopAllCalleeSavedRegsAndAdjustStack();
|
ABI_PopAllCalleeSavedRegsAndAdjustStack();
|
||||||
|
|
|
@ -769,7 +769,7 @@ void VertexLoader::CompileVertexTranslator()
|
||||||
SUB(32, M(&loop_counter), Imm8(1));
|
SUB(32, M(&loop_counter), Imm8(1));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
J_CC(CC_NZ, loop_start, true);
|
J_CC(CC_NZ, loop_start);
|
||||||
ABI_PopAllCalleeSavedRegsAndAdjustStack();
|
ABI_PopAllCalleeSavedRegsAndAdjustStack();
|
||||||
RET();
|
RET();
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue