Generalize constant folding for rlwinm.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1640 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
magumagu9 2008-12-23 13:16:52 +00:00
parent 6dd9fa75f8
commit 590adfce53
1 changed files with 8 additions and 12 deletions

View File

@ -671,19 +671,15 @@
INSTRUCTION_START; INSTRUCTION_START;
int a = inst.RA; int a = inst.RA;
int s = inst.RS; int s = inst.RS;
if (gpr.R(a).IsImm() || gpr.R(s).IsImm()) if (gpr.R(s).IsImm() && !inst.Rc)
{ {
if (gpr.R(s).IsImm()) unsigned mask = Helper_Mask(inst.MB, inst.ME);
{ unsigned result = gpr.R(s).offset;
if (gpr.R(s).offset == 0 && !inst.Rc) { if (inst.SH != 0)
// This is pretty common for some reason result = (result << inst.SH) |
gpr.LoadToX64(a, false); (result >> (32 - inst.SH));
XOR(32, gpr.R(a), gpr.R(a)); result &= mask;
return; gpr.SetImmediate32(a, result);
}
// This might also be worth doing.
}
Default(inst);
return; return;
} }