mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-25 15:31:17 +01:00
JIT64: Optimize cmpXX
Use TEST instead of CMP if we're comparing against 0 (rather common), and optimize the case of immediate compares further.
This commit is contained in:
parent
41c3dde737
commit
61af91ff16
@ -479,13 +479,29 @@ void Jit64::cmpXX(UGeckoInstruction inst)
|
|||||||
MOVZX(64, 32, RAX, gpr.R(a));
|
MOVZX(64, 32, RAX, gpr.R(a));
|
||||||
|
|
||||||
if (comparand.IsImm())
|
if (comparand.IsImm())
|
||||||
MOV(32, R(ABI_PARAM1), comparand);
|
{
|
||||||
|
// sign extension will ruin this, so store it in a register
|
||||||
|
if (comparand.offset & 0x80000000U)
|
||||||
|
{
|
||||||
|
MOV(32, R(ABI_PARAM1), comparand);
|
||||||
|
comparand = R(ABI_PARAM1);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
MOVZX(64, 32, ABI_PARAM1, comparand);
|
MOVZX(64, 32, ABI_PARAM1, comparand);
|
||||||
|
comparand = R(ABI_PARAM1);
|
||||||
comparand = R(ABI_PARAM1);
|
}
|
||||||
|
}
|
||||||
|
if (comparand.IsImm() && !comparand.offset)
|
||||||
|
{
|
||||||
|
if (merge_branch)
|
||||||
|
TEST(64, R(RAX), R(RAX));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SUB(64, R(RAX), comparand);
|
||||||
}
|
}
|
||||||
SUB(64, R(RAX), comparand);
|
|
||||||
MOV(64, M(&PowerPC::ppcState.cr_val[crf]), R(RAX));
|
MOV(64, M(&PowerPC::ppcState.cr_val[crf]), R(RAX));
|
||||||
|
|
||||||
if (merge_branch)
|
if (merge_branch)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user