JitArm64: Implement addmex/subfmex

This commit is contained in:
JosJuice 2021-06-17 15:17:17 +02:00
parent cfcc994f6c
commit fc60e62622
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

@ -150,36 +150,36 @@ constexpr std::array<GekkoOPTemplate, 13> table19{{
}};
constexpr std::array<GekkoOPTemplate, 107> table31{{
{266, &JitArm64::addx}, // addx
{778, &JitArm64::addx}, // addox
{10, &JitArm64::addcx}, // addcx
{522, &JitArm64::addcx}, // addcox
{138, &JitArm64::addex}, // addex
{650, &JitArm64::addex}, // addeox
{234, &JitArm64::FallBackToInterpreter}, // addmex
{746, &JitArm64::FallBackToInterpreter}, // addmeox
{202, &JitArm64::addzex}, // addzex
{714, &JitArm64::addzex}, // addzeox
{491, &JitArm64::divwx}, // divwx
{1003, &JitArm64::divwx}, // divwox
{459, &JitArm64::divwux}, // divwux
{971, &JitArm64::divwux}, // divwuox
{75, &JitArm64::mulhwx}, // mulhwx
{11, &JitArm64::mulhwux}, // mulhwux
{235, &JitArm64::mullwx}, // mullwx
{747, &JitArm64::mullwx}, // mullwox
{104, &JitArm64::negx}, // negx
{616, &JitArm64::negx}, // negox
{40, &JitArm64::subfx}, // subfx
{552, &JitArm64::subfx}, // subfox
{8, &JitArm64::subfcx}, // subfcx
{520, &JitArm64::subfcx}, // subfcox
{136, &JitArm64::subfex}, // subfex
{648, &JitArm64::subfex}, // subfeox
{232, &JitArm64::FallBackToInterpreter}, // subfmex
{744, &JitArm64::FallBackToInterpreter}, // subfmeox
{200, &JitArm64::subfzex}, // subfzex
{712, &JitArm64::subfzex}, // subfzeox
{266, &JitArm64::addx}, // addx
{778, &JitArm64::addx}, // addox
{10, &JitArm64::addcx}, // addcx
{522, &JitArm64::addcx}, // addcox
{138, &JitArm64::addex}, // addex
{650, &JitArm64::addex}, // addeox
{234, &JitArm64::addex}, // addmex
{746, &JitArm64::addex}, // addmeox
{202, &JitArm64::addzex}, // addzex
{714, &JitArm64::addzex}, // addzeox
{491, &JitArm64::divwx}, // divwx
{1003, &JitArm64::divwx}, // divwox
{459, &JitArm64::divwux}, // divwux
{971, &JitArm64::divwux}, // divwuox
{75, &JitArm64::mulhwx}, // mulhwx
{11, &JitArm64::mulhwux}, // mulhwux
{235, &JitArm64::mullwx}, // mullwx
{747, &JitArm64::mullwx}, // mullwox
{104, &JitArm64::negx}, // negx
{616, &JitArm64::negx}, // negox
{40, &JitArm64::subfx}, // subfx
{552, &JitArm64::subfx}, // subfox
{8, &JitArm64::subfcx}, // subfcx
{520, &JitArm64::subfcx}, // subfcox
{136, &JitArm64::subfex}, // subfex
{648, &JitArm64::subfex}, // subfeox
{232, &JitArm64::subfex}, // subfmex
{744, &JitArm64::subfex}, // subfmeox
{200, &JitArm64::subfzex}, // subfzex
{712, &JitArm64::subfzex}, // subfzeox
{28, &JitArm64::boolX}, // andx
{60, &JitArm64::boolX}, // andcx