mirror of
https://github.com/azahar-emu/dynarmic
synced 2025-11-09 16:40:03 +01:00
52 lines
1.4 KiB
C++
52 lines
1.4 KiB
C++
/* 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_MLA(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 result = ir.Add(ir.Mul(reg_n, reg_m), reg_a);
|
|
|
|
ir.SetRegister(d, result);
|
|
return true;
|
|
}
|
|
|
|
bool ThumbTranslatorVisitor::thumb32_MLS(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 result = ir.Sub(reg_a, ir.Mul(reg_n, reg_m));
|
|
|
|
ir.SetRegister(d, result);
|
|
return true;
|
|
}
|
|
|
|
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
|