mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-01-06 22:48:25 +01:00
thumb32: Implement CLZ
Also fleshes out the generator to allow for generating thumb32 instructions as well.
This commit is contained in:
parent
8c09da666a
commit
8d53048750
5 changed files with 127 additions and 27 deletions
|
|
@ -151,6 +151,7 @@ if ("A32" IN_LIST DYNARMIC_FRONTENDS)
|
|||
frontend/A32/translate/impl/synchronization.cpp
|
||||
frontend/A32/translate/impl/thumb16.cpp
|
||||
frontend/A32/translate/impl/thumb32.cpp
|
||||
frontend/A32/translate/impl/thumb32_misc.cpp
|
||||
frontend/A32/translate/impl/translate_arm.h
|
||||
frontend/A32/translate/impl/translate_thumb.h
|
||||
frontend/A32/translate/impl/vfp.cpp
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ std::optional<std::reference_wrapper<const Thumb32Matcher<V>>> DecodeThumb32(u32
|
|||
//INST(&V::thumb32_RBIT, "RBIT", "111110101001----1111----1010----"),
|
||||
//INST(&V::thumb32_REVSH, "REVSH", "111110101001----1111----1011----"),
|
||||
//INST(&V::thumb32_SEL, "SEL", "111110101010----1111----1000----"),
|
||||
//INST(&V::thumb32_CLZ, "CLZ", "111110101011----1111----1000----"),
|
||||
INST(&V::thumb32_CLZ, "CLZ", "111110101011nnnn1111dddd1000mmmm"),
|
||||
|
||||
// Multiply, Multiply Accumulate, and Absolute Difference
|
||||
//INST(&V::thumb32_MUL, "MUL", "111110110000----1111----0000----"),
|
||||
|
|
|
|||
22
src/frontend/A32/translate/impl/thumb32_misc.cpp
Normal file
22
src/frontend/A32/translate/impl/thumb32_misc.cpp
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/* This file is part of the dynarmic project.
|
||||
* Copyright (c) 2016 MerryMage
|
||||
* SPDX-License-Identifier: 0BSD
|
||||
*/
|
||||
|
||||
#include "frontend/A32/translate/impl/translate_thumb.h"
|
||||
|
||||
namespace Dynarmic::A32 {
|
||||
|
||||
bool ThumbTranslatorVisitor::thumb32_CLZ(Reg n, Reg d, Reg m) {
|
||||
if (m != n || d == Reg::PC || m == Reg::PC) {
|
||||
return UnpredictableInstruction();
|
||||
}
|
||||
|
||||
const auto reg_m = ir.GetRegister(m);
|
||||
const auto result = ir.CountLeadingZeros(reg_m);
|
||||
|
||||
ir.SetRegister(d, result);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Dynarmic::A32
|
||||
|
|
@ -115,6 +115,9 @@ struct ThumbTranslatorVisitor final {
|
|||
bool thumb32_BL_imm(Imm<11> hi, Imm<11> lo);
|
||||
bool thumb32_BLX_imm(Imm<11> hi, Imm<11> lo);
|
||||
bool thumb32_UDF();
|
||||
|
||||
// thumb32 miscellaneous instructions
|
||||
bool thumb32_CLZ(Reg n, Reg d, Reg m);
|
||||
};
|
||||
|
||||
} // namespace Dynarmic::A32
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue