Skip to content

Commit

Permalink
Merge pull request #272 from magumagu/jitil-fix-srawi
Browse files Browse the repository at this point in the history
JitIL: fix carry computation for srawi.
  • Loading branch information
Sonicadvance1 committed Apr 14, 2014
2 parents f034983 + 1a4156a commit 3910437
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Source/Core/Core/PowerPC/JitILCommon/JitILBase_Integer.cpp
Expand Up @@ -503,16 +503,18 @@ void JitILBase::srawix(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(bJITIntegerOff)
IREmitter::InstLoc val = ibuild.EmitLoadGReg(inst.RS), test;
val = ibuild.EmitSarl(val, ibuild.EmitIntConst(inst.SH));
ibuild.EmitStoreGReg(val, inst.RA);
// Shift right by two
IREmitter::InstLoc input = ibuild.EmitLoadGReg(inst.RS);
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;
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));

ibuild.EmitStoreCarry(test);
if (inst.Rc)
ComputeRC(ibuild, val);
ComputeRC(ibuild, output);
}

// count leading zeroes
Expand Down

0 comments on commit 3910437

Please sign in to comment.