thumb32: Implement SMMLA{R}

This commit is contained in:
Lioncash 2021-02-07 13:14:47 -05:00
parent b6add0ddf4
commit 0c542777b0
3 changed files with 22 additions and 2 deletions

View file

@ -272,8 +272,8 @@ INST(thumb32_SMUAD, "SMUAD", "111110110010nnnn1111dd
//INST(thumb32_SMLAWY, "SMLAWY", "111110110011------------000-----")
INST(thumb32_SMUSD, "SMUSD", "111110110100nnnn1111dddd000Mmmmm")
//INST(thumb32_SMLSD, "SMLSD", "111110110100------------000-----")
INST(thumb32_SMMUL, "SMMUL", "111110110101nnnn1111dddd000Mmmmm")
//INST(thumb32_SMMLA, "SMMLA", "111110110101------------000-----")
INST(thumb32_SMMUL, "SMMUL", "111110110101nnnn1111dddd000Rmmmm")
INST(thumb32_SMMLA, "SMMLA", "111110110101nnnnaaaadddd000Rmmmm")
//INST(thumb32_SMMLS, "SMMLS", "111110110110------------000-----")
INST(thumb32_USAD8, "USAD8", "111110110111nnnn1111dddd0000mmmm")
INST(thumb32_USADA8, "USADA8", "111110110111nnnnaaaadddd0000mmmm")

View file

@ -67,6 +67,25 @@ bool ThumbTranslatorVisitor::thumb32_SMLAXY(Reg n, Reg a, Reg d, bool N, bool M,
return true;
}
bool ThumbTranslatorVisitor::thumb32_SMMLA(Reg n, Reg a, Reg d, bool R, Reg m) {
if (d == Reg::PC || n == Reg::PC || m == Reg::PC || a == Reg::PC) {
return UnpredictableInstruction();
}
const auto n64 = ir.SignExtendWordToLong(ir.GetRegister(n));
const auto m64 = ir.SignExtendWordToLong(ir.GetRegister(m));
const auto a64 = ir.Pack2x32To1x64(ir.Imm32(0), ir.GetRegister(a));
const auto temp = ir.Add(a64, ir.Mul(n64, m64));
const auto result_carry = ir.MostSignificantWord(temp);
auto result = result_carry.result;
if (R) {
result = ir.AddWithCarry(result, ir.Imm32(0), result_carry.carry).result;
}
ir.SetRegister(d, result);
return true;
}
bool ThumbTranslatorVisitor::thumb32_SMMUL(Reg n, Reg d, bool R, Reg m) {
if (d == Reg::PC || n == Reg::PC || m == Reg::PC) {
return UnpredictableInstruction();

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_SMLAXY(Reg n, Reg a, Reg d, bool N, bool M, Reg m);
bool thumb32_SMMLA(Reg n, Reg a, Reg d, bool R, Reg m);
bool thumb32_SMMUL(Reg n, Reg d, bool R, Reg m);
bool thumb32_SMUAD(Reg n, Reg d, bool M, Reg m);
bool thumb32_SMUSD(Reg n, Reg d, bool M, Reg m);