thumb32: Implement USADA8

This commit is contained in:
Lioncash 2021-02-06 19:01:14 -05:00 committed by MerryMage
parent ed453aa52d
commit 50d81f95e5
3 changed files with 17 additions and 1 deletions

View file

@ -276,7 +276,7 @@ INST(thumb32_MLS, "MLS", "111110110000nnnnaaaadd
//INST(thumb32_SMMLA, "SMMLA", "111110110101------------000-----")
//INST(thumb32_SMMLS, "SMMLS", "111110110110------------000-----")
INST(thumb32_USAD8, "USAD8", "111110110111nnnn1111dddd0000mmmm")
//INST(thumb32_USADA8, "USADA8", "111110110111------------0000----")
INST(thumb32_USADA8, "USADA8", "111110110111nnnnaaaadddd0000mmmm")
// Long Multiply, Long Multiply Accumulate, and Divide
//INST(thumb32_SMULL, "SMULL", "111110111000------------0000----")

View file

@ -61,4 +61,19 @@ bool ThumbTranslatorVisitor::thumb32_USAD8(Reg n, Reg d, Reg m) {
return true;
}
bool ThumbTranslatorVisitor::thumb32_USADA8(Reg n, Reg a, Reg d, Reg m) {
if (d == Reg::PC || n == Reg::PC || m == Reg::PC) {
return UnpredictableInstruction();
}
const auto reg_a = ir.GetRegister(a);
const auto reg_m = ir.GetRegister(m);
const auto reg_n = ir.GetRegister(n);
const auto tmp = ir.PackedAbsDiffSumS8(reg_n, reg_m);
const auto result = ir.AddWithCarry(reg_a, tmp, ir.Imm1(0));
ir.SetRegister(d, result.result);
return true;
}
} // namespace Dynarmic::A32

View file

@ -133,6 +133,7 @@ struct ThumbTranslatorVisitor final {
bool thumb32_MLS(Reg n, Reg a, Reg d, Reg m);
bool thumb32_MUL(Reg n, Reg d, Reg m);
bool thumb32_USAD8(Reg n, Reg d, Reg m);
bool thumb32_USADA8(Reg n, Reg a, Reg d, Reg m);
// thumb32 parallel add/sub instructions
bool thumb32_SADD8(Reg n, Reg d, Reg m);