Merge pull request #9878 from JosJuice/jitarm64-addmex

JitArm64: Implement addmex/subfmex
This commit is contained in:
Markus Wick 2021-07-10 10:11:20 +02:00 committed by GitHub
commit 4ba4d7cc7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 50 additions and 38 deletions

View File

@ -966,11 +966,12 @@ void JitArm64::subfex(UGeckoInstruction inst)
JITDISABLE(bJITIntegerOff);
FALLBACK_IF(inst.OE);
bool mex = inst.SUBOP10 & 32;
int a = inst.RA, b = inst.RB, d = inst.RD;
if (gpr.IsImm(a) && gpr.IsImm(b))
if (gpr.IsImm(a) && (mex || gpr.IsImm(b)))
{
u32 i = gpr.GetImm(a), j = gpr.GetImm(b);
u32 i = gpr.GetImm(a), j = mex ? -1 : gpr.GetImm(b);
gpr.BindToRegister(d, false);
@ -1023,18 +1024,23 @@ void JitArm64::subfex(UGeckoInstruction inst)
else
{
gpr.BindToRegister(d, d == a || d == b);
ARM64Reg RB = mex ? gpr.GetReg() : gpr.R(b);
if (mex)
MOVI2R(RB, -1);
if (js.carryFlag == CarryFlag::ConstantTrue)
{
CARRY_IF_NEEDED(SUB, SUBS, gpr.R(d), gpr.R(b), gpr.R(a));
CARRY_IF_NEEDED(SUB, SUBS, gpr.R(d), RB, gpr.R(a));
}
else
{
LoadCarry();
CARRY_IF_NEEDED(SBC, SBCS, gpr.R(d), gpr.R(b), gpr.R(a));
CARRY_IF_NEEDED(SBC, SBCS, gpr.R(d), RB, gpr.R(a));
}
ComputeCarry();
if (mex)
gpr.Unlock(RB);
}
if (inst.Rc)
@ -1154,11 +1160,12 @@ void JitArm64::addex(UGeckoInstruction inst)
JITDISABLE(bJITIntegerOff);
FALLBACK_IF(inst.OE);
bool mex = inst.SUBOP10 & 32;
int a = inst.RA, b = inst.RB, d = inst.RD;
if (gpr.IsImm(a) && gpr.IsImm(b))
if (gpr.IsImm(a) && (mex || gpr.IsImm(b)))
{
u32 i = gpr.GetImm(a), j = gpr.GetImm(b);
u32 i = gpr.GetImm(a), j = mex ? -1 : gpr.GetImm(b);
gpr.BindToRegister(d, false);
@ -1211,18 +1218,23 @@ void JitArm64::addex(UGeckoInstruction inst)
else
{
gpr.BindToRegister(d, d == a || d == b);
ARM64Reg RB = mex ? gpr.GetReg() : gpr.R(b);
if (mex)
MOVI2R(RB, -1);
if (js.carryFlag == CarryFlag::ConstantFalse)
{
CARRY_IF_NEEDED(ADD, ADDS, gpr.R(d), gpr.R(a), gpr.R(b));
CARRY_IF_NEEDED(ADD, ADDS, gpr.R(d), gpr.R(a), RB);
}
else
{
LoadCarry();
CARRY_IF_NEEDED(ADC, ADCS, gpr.R(d), gpr.R(a), gpr.R(b));
CARRY_IF_NEEDED(ADC, ADCS, gpr.R(d), gpr.R(a), RB);
}
ComputeCarry();
if (mex)
gpr.Unlock(RB);
}
if (inst.Rc)

View File

@ -156,8 +156,8 @@ constexpr std::array<GekkoOPTemplate, 107> table31{{
{522, &JitArm64::addcx}, // addcox
{138, &JitArm64::addex}, // addex
{650, &JitArm64::addex}, // addeox
{234, &JitArm64::FallBackToInterpreter}, // addmex
{746, &JitArm64::FallBackToInterpreter}, // addmeox
{234, &JitArm64::addex}, // addmex
{746, &JitArm64::addex}, // addmeox
{202, &JitArm64::addzex}, // addzex
{714, &JitArm64::addzex}, // addzeox
{491, &JitArm64::divwx}, // divwx
@ -176,8 +176,8 @@ constexpr std::array<GekkoOPTemplate, 107> table31{{
{520, &JitArm64::subfcx}, // subfcox
{136, &JitArm64::subfex}, // subfex
{648, &JitArm64::subfex}, // subfeox
{232, &JitArm64::FallBackToInterpreter}, // subfmex
{744, &JitArm64::FallBackToInterpreter}, // subfmeox
{232, &JitArm64::subfex}, // subfmex
{744, &JitArm64::subfex}, // subfmeox
{200, &JitArm64::subfzex}, // subfzex
{712, &JitArm64::subfzex}, // subfzeox