thumb32: Implement MUL

This commit is contained in:
Lioncash 2021-02-06 18:37:35 -05:00 committed by MerryMage
parent a599c29d9e
commit 153d87c843
4 changed files with 28 additions and 1 deletions

View file

@ -152,6 +152,7 @@ if ("A32" IN_LIST DYNARMIC_FRONTENDS)
frontend/A32/translate/impl/thumb16.cpp
frontend/A32/translate/impl/thumb32.cpp
frontend/A32/translate/impl/thumb32_misc.cpp
frontend/A32/translate/impl/thumb32_multiply.cpp
frontend/A32/translate/impl/thumb32_parallel.cpp
frontend/A32/translate/impl/translate_arm.h
frontend/A32/translate/impl/translate_thumb.h

View file

@ -261,7 +261,7 @@ INST(thumb32_SEL, "SEL", "111110101010nnnn1111dd
INST(thumb32_CLZ, "CLZ", "111110101011nnnn1111dddd1000mmmm")
// Multiply, Multiply Accumulate, and Absolute Difference
//INST(thumb32_MUL, "MUL", "111110110000----1111----0000----")
INST(thumb32_MUL, "MUL", "111110110000nnnn1111dddd0000mmmm")
//INST(thumb32_MLA, "MLA", "111110110000------------0000----")
//INST(thumb32_MLS, "MLS", "111110110000------------0001----")
//INST(thumb32_SMULXY, "SMULXY", "111110110001----1111----00------")

View file

@ -0,0 +1,23 @@
/* This file is part of the dynarmic project.
* Copyright (c) 2021 MerryMage
* SPDX-License-Identifier: 0BSD
*/
#include "frontend/A32/translate/impl/translate_thumb.h"
namespace Dynarmic::A32 {
bool ThumbTranslatorVisitor::thumb32_MUL(Reg n, Reg d, Reg m) {
if (d == Reg::PC || n == Reg::PC || m == Reg::PC) {
return UnpredictableInstruction();
}
const auto reg_m = ir.GetRegister(m);
const auto reg_n = ir.GetRegister(n);
const auto result = ir.Mul(reg_n, reg_m);
ir.SetRegister(d, result);
return true;
}
} // namespace Dynarmic::A32

View file

@ -128,6 +128,9 @@ struct ThumbTranslatorVisitor final {
bool thumb32_REVSH(Reg n, Reg d, Reg m);
bool thumb32_SEL(Reg n, Reg d, Reg m);
// thumb32 multiply instructions
bool thumb32_MUL(Reg n, Reg d, Reg m);
// thumb32 parallel add/sub instructions
bool thumb32_SADD8(Reg n, Reg d, Reg m);
bool thumb32_SADD16(Reg n, Reg d, Reg m);