JIT64: add mulhwx implementation

This commit is contained in:
Fiora 2014-08-26 01:08:04 -07:00
parent 44ee2f20b9
commit 90324f3809
3 changed files with 13 additions and 8 deletions

View File

@ -137,7 +137,7 @@ public:
void addx(UGeckoInstruction inst);
void addcx(UGeckoInstruction inst);
void mulli(UGeckoInstruction inst);
void mulhwux(UGeckoInstruction inst);
void mulhwXx(UGeckoInstruction inst);
void mullwx(UGeckoInstruction inst);
void divwux(UGeckoInstruction inst);
void divwx(UGeckoInstruction inst);

View File

@ -304,8 +304,8 @@ static GekkoOPTemplate table31_2[] =
{1003, &Jit64::divwx}, //"divwox", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 39}},
{459, &Jit64::divwux}, //"divwux", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 39}},
{971, &Jit64::divwux}, //"divwuox", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 39}},
{75, &Jit64::FallBackToInterpreter}, //"mulhwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}},
{11, &Jit64::mulhwux}, //"mulhwux", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}},
{75, &Jit64::mulhwXx}, //"mulhwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}},
{11, &Jit64::mulhwXx}, //"mulhwux", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}},
{235, &Jit64::mullwx}, //"mullwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}},
{747, &Jit64::mullwx}, //"mullwox", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 4}},
{104, &Jit64::negx}, //"negx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}},

View File

@ -1154,15 +1154,19 @@ void Jit64::mullwx(UGeckoInstruction inst)
}
}
void Jit64::mulhwux(UGeckoInstruction inst)
void Jit64::mulhwXx(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(bJITIntegerOff);
int a = inst.RA, b = inst.RB, d = inst.RD;
bool sign = inst.SUBOP10 == 75;
if (gpr.R(a).IsImm() && gpr.R(b).IsImm())
{
gpr.SetImmediate32(d, (u32)(((u64)gpr.R(a).offset * (u64)gpr.R(b).offset) >> 32));
if (sign)
gpr.SetImmediate32(d, (u32)((u64)(((s64)(s32)gpr.R(a).offset * (s64)(s32)gpr.R(b).offset)) >> 32));
else
gpr.SetImmediate32(d, (u32)((gpr.R(a).offset * gpr.R(b).offset) >> 32));
}
else
{
@ -1173,16 +1177,17 @@ void Jit64::mulhwux(UGeckoInstruction inst)
PanicAlert("mulhwux : WTF");
MOV(32, R(EAX), gpr.R(a));
gpr.KillImmediate(b, true, false);
MUL(32, gpr.R(b));
if (sign)
IMUL(32, gpr.R(b));
else
MUL(32, gpr.R(b));
gpr.UnlockAll();
gpr.UnlockAllX();
MOV(32, gpr.R(d), R(EDX));
}
if (inst.Rc)
{
ComputeRC(gpr.R(d));
}
}
void Jit64::divwux(UGeckoInstruction inst)