Small JIT WIP fix: I figured out how subfic and subfcx work. It was a

bit surprising to me that the carry flag works differently between PPC 
and x86...



git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1789 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
magumagu9 2009-01-05 04:18:10 +00:00
parent 8842357b34
commit fdd06da500

View File

@ -179,29 +179,31 @@
void Jit64::subfic(UGeckoInstruction inst) void Jit64::subfic(UGeckoInstruction inst)
{ {
Default(inst); IREmitter::InstLoc nota, lhs, val, test;
return; nota = ibuild.EmitXor(ibuild.EmitLoadGReg(inst.RA),
// FIXME: Disabling until I figure out subfcx ibuild.EmitIntConst(-1));
IREmitter::InstLoc val, test, c; if (inst.SIMM_16 == -1) {
c = ibuild.EmitIntConst(inst.SIMM_16); val = nota;
val = ibuild.EmitSub(c, ibuild.EmitLoadGReg(inst.RA)); test = ibuild.EmitIntConst(1);
} else {
lhs = ibuild.EmitIntConst(inst.SIMM_16 + 1);
val = ibuild.EmitAdd(nota, lhs);
test = ibuild.EmitICmpUgt(lhs, val);
}
ibuild.EmitStoreGReg(val, inst.RD); ibuild.EmitStoreGReg(val, inst.RD);
test = ibuild.EmitICmpUgt(val, c);
ibuild.EmitStoreCarry(test); ibuild.EmitStoreCarry(test);
} }
void Jit64::subfcx(UGeckoInstruction inst) void Jit64::subfcx(UGeckoInstruction inst)
{ {
Default(inst);
return;
// FIXME: Figure out what the heck is going wrong here...
if (inst.OE) PanicAlert("OE: subfcx"); if (inst.OE) PanicAlert("OE: subfcx");
IREmitter::InstLoc val, test, lhs, rhs; IREmitter::InstLoc val, test, lhs, rhs;
lhs = ibuild.EmitLoadGReg(inst.RB); lhs = ibuild.EmitLoadGReg(inst.RB);
rhs = ibuild.EmitLoadGReg(inst.RA); rhs = ibuild.EmitLoadGReg(inst.RA);
val = ibuild.EmitSub(lhs, rhs); val = ibuild.EmitSub(lhs, rhs);
ibuild.EmitStoreGReg(val, inst.RD); ibuild.EmitStoreGReg(val, inst.RD);
test = ibuild.EmitICmpUgt(rhs, lhs); test = ibuild.EmitICmpEq(rhs, ibuild.EmitIntConst(0));
test = ibuild.EmitOr(test, ibuild.EmitICmpUgt(lhs, val));
ibuild.EmitStoreCarry(test); ibuild.EmitStoreCarry(test);
if (inst.Rc) if (inst.Rc)
ComputeRC(ibuild, val); ComputeRC(ibuild, val);