mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-01-07 06:58:15 +01:00
thumb32: Implement REV16
This commit is contained in:
parent
cee31c5274
commit
0304dc7ce4
4 changed files with 23 additions and 1 deletions
|
|
@ -280,7 +280,7 @@ std::optional<std::reference_wrapper<const Thumb32Matcher<V>>> DecodeThumb32(u32
|
|||
//INST(&V::thumb32_QSUB, "QSUB", "111110101000----1111----1010----"),
|
||||
//INST(&V::thumb32_QDSUB, "QDSUB", "111110101000----1111----1011----"),
|
||||
//INST(&V::thumb32_REV, "REV", "111110101001----1111----1000----"),
|
||||
//INST(&V::thumb32_REV16, "REV16", "111110101001----1111----1001----"),
|
||||
INST(&V::thumb32_REV16, "REV16", "111110101001nnnn1111dddd1001mmmm"),
|
||||
INST(&V::thumb32_RBIT, "RBIT", "111110101001nnnn1111dddd1010mmmm"),
|
||||
INST(&V::thumb32_REVSH, "REVSH", "111110101001nnnn1111dddd1011mmmm"),
|
||||
INST(&V::thumb32_SEL, "SEL", "111110101010nnnn1111dddd1000mmmm"),
|
||||
|
|
|
|||
|
|
@ -44,6 +44,20 @@ bool ThumbTranslatorVisitor::thumb32_RBIT(Reg n, Reg d, Reg m) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ThumbTranslatorVisitor::thumb32_REV16(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 lo = ir.And(ir.LogicalShiftRight(reg_m, ir.Imm8(8), ir.Imm1(0)).result, ir.Imm32(0x00FF00FF));
|
||||
const auto hi = ir.And(ir.LogicalShiftLeft(reg_m, ir.Imm8(8), ir.Imm1(0)).result, ir.Imm32(0xFF00FF00));
|
||||
const auto result = ir.Or(lo, hi);
|
||||
|
||||
ir.SetRegister(d, result);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ThumbTranslatorVisitor::thumb32_REVSH(Reg n, Reg d, Reg m) {
|
||||
if (m != n || d == Reg::PC || m == Reg::PC) {
|
||||
return UnpredictableInstruction();
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ struct ThumbTranslatorVisitor final {
|
|||
// thumb32 miscellaneous instructions
|
||||
bool thumb32_CLZ(Reg n, Reg d, Reg m);
|
||||
bool thumb32_RBIT(Reg n, Reg d, Reg m);
|
||||
bool thumb32_REV16(Reg n, Reg d, Reg m);
|
||||
bool thumb32_REVSH(Reg n, Reg d, Reg m);
|
||||
bool thumb32_SEL(Reg n, Reg d, Reg m);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue