thumb32: Implement EOR (immediate)

This commit is contained in:
MerryMage 2021-02-18 20:51:13 +00:00
parent 8fd7ec3989
commit f568687bd9
3 changed files with 20 additions and 1 deletions

View file

@ -61,7 +61,7 @@ INST(thumb32_ORR_imm, "ORR (imm)", "11110v00010Snnnn0vvvdd
INST(thumb32_MVN_imm, "MVN (imm)", "11110v00011S11110vvvddddvvvvvvvv") INST(thumb32_MVN_imm, "MVN (imm)", "11110v00011S11110vvvddddvvvvvvvv")
INST(thumb32_ORN_imm, "ORN (imm)", "11110v00011Snnnn0vvvddddvvvvvvvv") INST(thumb32_ORN_imm, "ORN (imm)", "11110v00011Snnnn0vvvddddvvvvvvvv")
INST(thumb32_TEQ_imm, "TEQ (imm)", "11110v001001nnnn0vvv1111vvvvvvvv") INST(thumb32_TEQ_imm, "TEQ (imm)", "11110v001001nnnn0vvv1111vvvvvvvv")
//INST(thumb32_EOR_imm, "EOR (imm)", "11110-00100-----0---------------") INST(thumb32_EOR_imm, "EOR (imm)", "11110v00100Snnnn0vvvddddvvvvvvvv")
//INST(thumb32_CMN_imm, "CMN (imm)", "11110-010001----0---1111--------") //INST(thumb32_CMN_imm, "CMN (imm)", "11110-010001----0---1111--------")
//INST(thumb32_ADD_imm_1, "ADD (imm)", "11110-01000-----0---------------") //INST(thumb32_ADD_imm_1, "ADD (imm)", "11110-01000-----0---------------")
//INST(thumb32_ADC_imm, "ADC (imm)", "11110-01010-----0---------------") //INST(thumb32_ADC_imm, "ADC (imm)", "11110-01010-----0---------------")

View file

@ -140,4 +140,22 @@ bool ThumbTranslatorVisitor::thumb32_TEQ_imm(Imm<1> i, Reg n, Imm<3> imm3, Imm<8
return true; return true;
} }
bool ThumbTranslatorVisitor::thumb32_EOR_imm(Imm<1> i, bool S, Reg n, Imm<3> imm3, Reg d, Imm<8> imm8) {
ASSERT_MSG(!(d == Reg::PC && S), "Decode error");
if ((d == Reg::PC && !S) || n == Reg::PC) {
return UnpredictableInstruction();
}
const auto imm_carry = ThumbExpandImm_C(i, imm3, imm8, ir.GetCFlag());
const auto result = ir.Eor(ir.GetRegister(n), ir.Imm32(imm_carry.imm32));
ir.SetRegister(d, result);
if (S) {
ir.SetNFlag(ir.MostSignificantBit(result));
ir.SetZFlag(ir.IsZero(result));
ir.SetCFlag(imm_carry.carry);
}
return true;
}
} // namespace Dynarmic::A32 } // namespace Dynarmic::A32

View file

@ -157,6 +157,7 @@ struct ThumbTranslatorVisitor final {
bool thumb32_MVN_imm(Imm<1> i, bool S, Imm<3> imm3, Reg d, Imm<8> imm8); bool thumb32_MVN_imm(Imm<1> i, bool S, Imm<3> imm3, Reg d, Imm<8> imm8);
bool thumb32_ORN_imm(Imm<1> i, bool S, Reg n, Imm<3> imm3, Reg d, Imm<8> imm8); bool thumb32_ORN_imm(Imm<1> i, bool S, Reg n, Imm<3> imm3, Reg d, Imm<8> imm8);
bool thumb32_TEQ_imm(Imm<1> i, Reg n, Imm<3> imm3, Imm<8> imm8); bool thumb32_TEQ_imm(Imm<1> i, Reg n, Imm<3> imm3, Imm<8> imm8);
bool thumb32_EOR_imm(Imm<1> i, bool S, Reg n, Imm<3> imm3, Reg d, Imm<8> imm8);
// thumb32 miscellaneous control instructions // thumb32 miscellaneous control instructions
bool thumb32_UDF(); bool thumb32_UDF();