JIT: use LZCNT in cntlzw

This commit is contained in:
Fiora 2014-09-14 05:36:23 -07:00
parent 997c5c2d0e
commit 40b18f09b2
1 changed files with 13 additions and 7 deletions

View File

@ -1901,13 +1901,19 @@ void Jit64::cntlzwx(UGeckoInstruction inst)
else
{
gpr.Lock(a, s);
gpr.KillImmediate(s, true, false);
gpr.BindToRegister(a, (a == s), true);
BSR(32, gpr.R(a).GetSimpleReg(), gpr.R(s));
FixupBranch gotone = J_CC(CC_NZ);
MOV(32, gpr.R(a), Imm32(63));
SetJumpTarget(gotone);
XOR(32, gpr.R(a), Imm8(0x1f)); // flip order
gpr.BindToRegister(a, a == s, true);
if (cpu_info.bLZCNT)
{
LZCNT(32, gpr.RX(a), gpr.R(s));
}
else
{
BSR(32, gpr.RX(a), gpr.R(s));
FixupBranch gotone = J_CC(CC_NZ);
MOV(32, gpr.R(a), Imm32(63));
SetJumpTarget(gotone);
XOR(32, gpr.R(a), Imm8(0x1f)); // flip order
}
gpr.UnlockAll();
}