JitArm64: Implement srwx

This commit is contained in:
degasus 2015-08-23 17:29:02 +02:00
parent 4722a69fd0
commit 7320d519b4
3 changed files with 48 additions and 1 deletions

View File

@ -98,6 +98,7 @@ public:
void subfx(UGeckoInstruction inst);
void addcx(UGeckoInstruction inst);
void slwx(UGeckoInstruction inst);
void srwx(UGeckoInstruction inst);
void rlwimix(UGeckoInstruction inst);
void subfex(UGeckoInstruction inst);
void subfcx(UGeckoInstruction inst);

View File

@ -1011,6 +1011,52 @@ void JitArm64::slwx(UGeckoInstruction inst)
}
}
void JitArm64::srwx(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(bJITIntegerOff);
int a = inst.RA, b = inst.RB, s = inst.RS;
if (gpr.IsImm(b) && gpr.IsImm(s))
{
u32 i = gpr.GetImm(s), amount = gpr.GetImm(b);
gpr.SetImmediate(a, (amount & 0x20) ? 0 : i >> (amount & 0x1F));
if (inst.Rc)
ComputeRC(gpr.GetImm(a), 0);
}
else if (gpr.IsImm(b))
{
u32 amount = gpr.GetImm(b);
if (amount & 0x20)
{
gpr.SetImmediate(a, 0);
if (inst.Rc)
ComputeRC(0, 0);
}
else
{
gpr.BindToRegister(a, a == s);
LSR(gpr.R(a), gpr.R(s), amount & 0x1F);
if (inst.Rc)
ComputeRC(gpr.R(a), 0);
}
}
else
{
gpr.BindToRegister(a, a == b || a == s);
// wipe upper bits. TODO: get rid of it, but then no instruction is allowed to emit some higher bits.
MOV(gpr.R(s), gpr.R(s));
LSRV(EncodeRegTo64(gpr.R(a)), EncodeRegTo64(gpr.R(s)), EncodeRegTo64(gpr.R(b)));
if (inst.Rc)
ComputeRC(gpr.R(a), 0);
}
}
void JitArm64::rlwimix(UGeckoInstruction inst)
{
INSTRUCTION_START

View File

@ -214,7 +214,7 @@ static GekkoOPTemplate table31[] =
{26, &JitArm64::cntlzwx}, // cntlzwx
{922, &JitArm64::extsXx}, // extshx
{954, &JitArm64::extsXx}, // extsbx
{536, &JitArm64::FallBackToInterpreter}, // srwx
{536, &JitArm64::srwx}, // srwx
{792, &JitArm64::FallBackToInterpreter}, // srawx
{824, &JitArm64::srawix}, // srawix
{24, &JitArm64::slwx}, // slwx