srwx and slwx optimizations

This commit is contained in:
calc84maniac 2012-01-02 18:00:28 -05:00
parent 9c4106027c
commit 6ecae3e556
1 changed files with 32 additions and 22 deletions

View File

@ -1652,27 +1652,32 @@ void Jit64::srwx(UGeckoInstruction inst)
{ {
u32 amount = (u32)gpr.R(b).offset; u32 amount = (u32)gpr.R(b).offset;
gpr.SetImmediate32(a, (amount & 0x20) ? 0 : ((u32)gpr.R(s).offset >> (amount & 0x1f))); gpr.SetImmediate32(a, (amount & 0x20) ? 0 : ((u32)gpr.R(s).offset >> (amount & 0x1f)));
if (inst.Rc)
{
ComputeRC(gpr.R(a));
}
} }
else else
{ {
gpr.FlushLockX(ECX); gpr.FlushLockX(ECX);
gpr.Lock(a, b, s); gpr.Lock(a, b, s);
gpr.BindToRegister(a, a == s || a == b || s == b, true); gpr.BindToRegister(a, true, true);
MOV(32, R(ECX), gpr.R(b)); MOV(32, R(ECX), gpr.R(b));
XOR(32, R(EAX), R(EAX));
TEST(32, R(ECX), Imm32(32)); TEST(32, R(ECX), Imm32(32));
FixupBranch branch = J_CC(CC_NZ); if (a != s)
MOV(32, R(EAX), gpr.R(s)); {
SHR(32, R(EAX), R(ECX)); MOV(32, gpr.R(a), gpr.R(s));
SetJumpTarget(branch);
MOV(32, gpr.R(a), R(EAX));
gpr.UnlockAll();
gpr.UnlockAllX();
} }
FixupBranch branch = J_CC(CC_Z);
XOR(32, gpr.R(a), gpr.R(a));
SetJumpTarget(branch);
SHR(32, gpr.R(a), R(ECX));
if (inst.Rc) if (inst.Rc)
{ {
ComputeRC(gpr.R(a)); GenerateRC();
}
gpr.UnlockAll();
gpr.UnlockAllX();
} }
} }
@ -1688,27 +1693,32 @@ void Jit64::slwx(UGeckoInstruction inst)
{ {
u32 amount = (u32)gpr.R(b).offset; u32 amount = (u32)gpr.R(b).offset;
gpr.SetImmediate32(a, (amount & 0x20) ? 0 : (u32)gpr.R(s).offset << amount); gpr.SetImmediate32(a, (amount & 0x20) ? 0 : (u32)gpr.R(s).offset << amount);
if (inst.Rc)
{
ComputeRC(gpr.R(a));
}
} }
else else
{ {
gpr.FlushLockX(ECX); gpr.FlushLockX(ECX);
gpr.Lock(a, b, s); gpr.Lock(a, b, s);
gpr.BindToRegister(a, a == s || a == b || s == b, true); gpr.BindToRegister(a, true, true);
MOV(32, R(ECX), gpr.R(b)); MOV(32, R(ECX), gpr.R(b));
XOR(32, R(EAX), R(EAX));
TEST(32, R(ECX), Imm32(32)); TEST(32, R(ECX), Imm32(32));
FixupBranch branch = J_CC(CC_NZ); if (a != s)
MOV(32, R(EAX), gpr.R(s)); {
SHL(32, R(EAX), R(ECX)); MOV(32, gpr.R(a), gpr.R(s));
SetJumpTarget(branch);
MOV(32, gpr.R(a), R(EAX));
gpr.UnlockAll();
gpr.UnlockAllX();
} }
FixupBranch branch = J_CC(CC_Z);
XOR(32, gpr.R(a), gpr.R(a));
SetJumpTarget(branch);
SHL(32, gpr.R(a), R(ECX));
if (inst.Rc) if (inst.Rc)
{ {
ComputeRC(gpr.R(a)); GenerateRC();
}
gpr.UnlockAll();
gpr.UnlockAllX();
} }
} }