Merge pull request #272 from magumagu/jitil-fix-srawi

JitIL: fix carry computation for srawi.
This commit is contained in:
Ryan Houdek 2014-04-14 00:38:06 -05:00
commit 3910437447

View File

@ -503,16 +503,18 @@ void JitILBase::srawix(UGeckoInstruction inst)
{ {
INSTRUCTION_START INSTRUCTION_START
JITDISABLE(bJITIntegerOff) JITDISABLE(bJITIntegerOff)
IREmitter::InstLoc val = ibuild.EmitLoadGReg(inst.RS), test; // Shift right by two
val = ibuild.EmitSarl(val, ibuild.EmitIntConst(inst.SH)); IREmitter::InstLoc input = ibuild.EmitLoadGReg(inst.RS);
ibuild.EmitStoreGReg(val, inst.RA); IREmitter::InstLoc output = ibuild.EmitSarl(input, ibuild.EmitIntConst(inst.SH));
ibuild.EmitStoreGReg(output, inst.RA);
// Check whether the input is negative and any bits got shifted out.
unsigned int mask = -1u << inst.SH; unsigned int mask = -1u << inst.SH;
test = ibuild.EmitOr(val, ibuild.EmitIntConst(mask & 0x7FFFFFFF)); IREmitter::InstLoc test = ibuild.EmitOr(input, ibuild.EmitIntConst(mask & 0x7FFFFFFF));
test = ibuild.EmitICmpUgt(test, ibuild.EmitIntConst(mask)); test = ibuild.EmitICmpUgt(test, ibuild.EmitIntConst(mask));
ibuild.EmitStoreCarry(test); ibuild.EmitStoreCarry(test);
if (inst.Rc) if (inst.Rc)
ComputeRC(ibuild, val); ComputeRC(ibuild, output);
} }
// count leading zeroes // count leading zeroes