diff --git a/src/frontend/A32/decoder/thumb32.inc b/src/frontend/A32/decoder/thumb32.inc index 9da07c30..0083caee 100644 --- a/src/frontend/A32/decoder/thumb32.inc +++ b/src/frontend/A32/decoder/thumb32.inc @@ -204,7 +204,7 @@ INST(thumb32_SXTAB16, "SXTAB16", "111110100010nnnn1111dd INST(thumb32_UXTB16, "UXTB16", "11111010001111111111dddd10rrmmmm") INST(thumb32_UXTAB16, "UXTAB16", "111110100011nnnn1111dddd10rrmmmm") INST(thumb32_SXTB, "SXTB", "11111010010011111111dddd10rrmmmm") -//INST(thumb32_SXTAB, "SXTAB", "111110100100----1111----1-------") +INST(thumb32_SXTAB, "SXTAB", "111110100100nnnn1111dddd10rrmmmm") //INST(thumb32_UXTB, "UXTB", "11111010010111111111----1-------") //INST(thumb32_UXTAB, "UXTAB", "111110100101----1111----1-------") diff --git a/src/frontend/A32/translate/impl/thumb32_data_processing_register.cpp b/src/frontend/A32/translate/impl/thumb32_data_processing_register.cpp index e8c4358f..86945a2d 100644 --- a/src/frontend/A32/translate/impl/thumb32_data_processing_register.cpp +++ b/src/frontend/A32/translate/impl/thumb32_data_processing_register.cpp @@ -37,6 +37,19 @@ bool ThumbTranslatorVisitor::thumb32_SXTB16(Reg d, SignExtendRotation rotate, Re return true; } +bool ThumbTranslatorVisitor::thumb32_SXTAB(Reg n, Reg d, SignExtendRotation rotate, Reg m) { + if (d == Reg::PC || m == Reg::PC) { + return UnpredictableInstruction(); + } + + const auto rotated = Rotate(ir, m, rotate); + const auto reg_n = ir.GetRegister(n); + const auto result = ir.Add(reg_n, ir.SignExtendByteToWord(ir.LeastSignificantByte(rotated))); + + ir.SetRegister(d, result); + return true; +} + bool ThumbTranslatorVisitor::thumb32_SXTAB16(Reg n, Reg d, SignExtendRotation rotate, Reg m) { if (d == Reg::PC || m == Reg::PC) { return UnpredictableInstruction(); diff --git a/src/frontend/A32/translate/impl/translate_thumb.h b/src/frontend/A32/translate/impl/translate_thumb.h index a40a07cc..db38df9b 100644 --- a/src/frontend/A32/translate/impl/translate_thumb.h +++ b/src/frontend/A32/translate/impl/translate_thumb.h @@ -124,6 +124,7 @@ struct ThumbTranslatorVisitor final { // thumb32 data processing (register) instructions bool thumb32_SXTB(Reg d, SignExtendRotation rotate, Reg m); bool thumb32_SXTB16(Reg d, SignExtendRotation rotate, Reg m); + bool thumb32_SXTAB(Reg n, Reg d, SignExtendRotation rotate, Reg m); bool thumb32_SXTAB16(Reg n, Reg d, SignExtendRotation rotate, Reg m); bool thumb32_SXTH(Reg d, SignExtendRotation rotate, Reg m); bool thumb32_SXTAH(Reg n, Reg d, SignExtendRotation rotate, Reg m);