thumb32: Implement SXTAH
This commit is contained in:
parent
273125e0b1
commit
c0871d4c18
3 changed files with 35 additions and 2 deletions
|
@ -195,8 +195,8 @@
|
||||||
//INST(thumb32_LSR_reg, "LSR (reg)", "11111010001-----1111----0000----")
|
//INST(thumb32_LSR_reg, "LSR (reg)", "11111010001-----1111----0000----")
|
||||||
//INST(thumb32_ASR_reg, "ASR (reg)", "11111010010-----1111----0000----")
|
//INST(thumb32_ASR_reg, "ASR (reg)", "11111010010-----1111----0000----")
|
||||||
//INST(thumb32_ROR_reg, "ROR (reg)", "11111010011-----1111----0000----")
|
//INST(thumb32_ROR_reg, "ROR (reg)", "11111010011-----1111----0000----")
|
||||||
//INST(thumb32_SXTH, "SXTH", "11111010000011111111----1-------")
|
INST(thumb32_SXTH, "SXTH", "11111010000011111111dddd10rrmmmm")
|
||||||
//INST(thumb32_SXTAH, "SXTAH", "111110100000----1111----1-------")
|
INST(thumb32_SXTAH, "SXTAH", "111110100000nnnn1111dddd10rrmmmm")
|
||||||
//INST(thumb32_UXTH, "UXTH", "11111010000111111111----1-------")
|
//INST(thumb32_UXTH, "UXTH", "11111010000111111111----1-------")
|
||||||
//INST(thumb32_UXTAH, "UXTAH", "111110100001----1111----1-------")
|
//INST(thumb32_UXTAH, "UXTAH", "111110100001----1111----1-------")
|
||||||
//INST(thumb32_SXTB16, "SXTB16", "11111010001011111111----1-------")
|
//INST(thumb32_SXTB16, "SXTB16", "11111010001011111111----1-------")
|
||||||
|
|
|
@ -6,5 +6,34 @@
|
||||||
#include "frontend/A32/translate/impl/translate_thumb.h"
|
#include "frontend/A32/translate/impl/translate_thumb.h"
|
||||||
|
|
||||||
namespace Dynarmic::A32 {
|
namespace Dynarmic::A32 {
|
||||||
|
static IR::U32 Rotate(A32::IREmitter& ir, Reg m, SignExtendRotation rotate) {
|
||||||
|
const u8 rotate_by = static_cast<u8>(static_cast<size_t>(rotate) * 8);
|
||||||
|
return ir.RotateRight(ir.GetRegister(m), ir.Imm8(rotate_by), ir.Imm1(0)).result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ThumbTranslatorVisitor::thumb32_SXTH(Reg d, SignExtendRotation rotate, Reg m) {
|
||||||
|
if (d == Reg::PC || m == Reg::PC) {
|
||||||
|
return UnpredictableInstruction();
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto rotated = Rotate(ir, m, rotate);
|
||||||
|
const auto result = ir.SignExtendHalfToWord(ir.LeastSignificantHalf(rotated));
|
||||||
|
|
||||||
|
ir.SetRegister(d, result);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ThumbTranslatorVisitor::thumb32_SXTAH(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.SignExtendHalfToWord(ir.LeastSignificantHalf(rotated)));
|
||||||
|
|
||||||
|
ir.SetRegister(d, result);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Dynarmic::A32
|
} // namespace Dynarmic::A32
|
||||||
|
|
|
@ -121,6 +121,10 @@ struct ThumbTranslatorVisitor final {
|
||||||
bool thumb32_BLX_imm(Imm<11> hi, Imm<11> lo);
|
bool thumb32_BLX_imm(Imm<11> hi, Imm<11> lo);
|
||||||
bool thumb32_UDF();
|
bool thumb32_UDF();
|
||||||
|
|
||||||
|
// thumb32 data processing (register) instructions
|
||||||
|
bool thumb32_SXTH(Reg d, SignExtendRotation rotate, Reg m);
|
||||||
|
bool thumb32_SXTAH(Reg n, Reg d, SignExtendRotation rotate, Reg m);
|
||||||
|
|
||||||
// thumb32 long multiply, long multiply accumulate, and divide instructions
|
// thumb32 long multiply, long multiply accumulate, and divide instructions
|
||||||
bool thumb32_SDIV(Reg n, Reg d, Reg m);
|
bool thumb32_SDIV(Reg n, Reg d, Reg m);
|
||||||
bool thumb32_SMLAL(Reg n, Reg dLo, Reg dHi, Reg m);
|
bool thumb32_SMLAL(Reg n, Reg dLo, Reg dHi, Reg m);
|
||||||
|
|
Loading…
Reference in a new issue