thumb32: Implement UXTAB16

This commit is contained in:
Lioncash 2021-02-10 16:16:34 -05:00
parent eec16eea45
commit 3cefdc3ab9
3 changed files with 16 additions and 1 deletions

View file

@ -202,7 +202,7 @@ INST(thumb32_UXTAH, "UXTAH", "111110100001nnnn1111dd
INST(thumb32_SXTB16, "SXTB16", "11111010001011111111dddd10rrmmmm") INST(thumb32_SXTB16, "SXTB16", "11111010001011111111dddd10rrmmmm")
INST(thumb32_SXTAB16, "SXTAB16", "111110100010nnnn1111dddd10rrmmmm") INST(thumb32_SXTAB16, "SXTAB16", "111110100010nnnn1111dddd10rrmmmm")
INST(thumb32_UXTB16, "UXTB16", "11111010001111111111dddd10rrmmmm") INST(thumb32_UXTB16, "UXTB16", "11111010001111111111dddd10rrmmmm")
//INST(thumb32_UXTAB16, "UXTAB16", "111110100011----1111----1-------") INST(thumb32_UXTAB16, "UXTAB16", "111110100011nnnn1111dddd10rrmmmm")
//INST(thumb32_SXTB, "SXTB", "11111010010011111111----1-------") //INST(thumb32_SXTB, "SXTB", "11111010010011111111----1-------")
//INST(thumb32_SXTAB, "SXTAB", "111110100100----1111----1-------") //INST(thumb32_SXTAB, "SXTAB", "111110100100----1111----1-------")
//INST(thumb32_UXTB, "UXTB", "11111010010111111111----1-------") //INST(thumb32_UXTB, "UXTB", "11111010010111111111----1-------")

View file

@ -77,6 +77,20 @@ bool ThumbTranslatorVisitor::thumb32_UXTB16(Reg d, SignExtendRotation rotate, Re
return true; return true;
} }
bool ThumbTranslatorVisitor::thumb32_UXTAB16(Reg n, Reg d, SignExtendRotation rotate, Reg m) {
if (d == Reg::PC || m == Reg::PC) {
return UnpredictableInstruction();
}
const auto rotated = Rotate(ir, m, rotate);
auto result = ir.And(rotated, ir.Imm32(0x00FF00FF));
const auto reg_n = ir.GetRegister(n);
result = ir.PackedAddU16(reg_n, result).result;
ir.SetRegister(d, result);
return true;
}
bool ThumbTranslatorVisitor::thumb32_UXTH(Reg d, SignExtendRotation rotate, Reg m) { bool ThumbTranslatorVisitor::thumb32_UXTH(Reg d, SignExtendRotation rotate, Reg m) {
if (d == Reg::PC || m == Reg::PC) { if (d == Reg::PC || m == Reg::PC) {
return UnpredictableInstruction(); return UnpredictableInstruction();

View file

@ -127,6 +127,7 @@ struct ThumbTranslatorVisitor final {
bool thumb32_SXTH(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); bool thumb32_SXTAH(Reg n, Reg d, SignExtendRotation rotate, Reg m);
bool thumb32_UXTB16(Reg d, SignExtendRotation rotate, Reg m); bool thumb32_UXTB16(Reg d, SignExtendRotation rotate, Reg m);
bool thumb32_UXTAB16(Reg n, Reg d, SignExtendRotation rotate, Reg m);
bool thumb32_UXTH(Reg d, SignExtendRotation rotate, Reg m); bool thumb32_UXTH(Reg d, SignExtendRotation rotate, Reg m);
bool thumb32_UXTAH(Reg n, Reg d, SignExtendRotation rotate, Reg m); bool thumb32_UXTAH(Reg n, Reg d, SignExtendRotation rotate, Reg m);