Implement thumb1_MVN_reg

This commit is contained in:
MerryMage 2016-07-10 10:49:01 +08:00
parent d11df9067d
commit ac2fb6b925
3 changed files with 15 additions and 2 deletions

View file

@ -56,7 +56,7 @@ private:
}; };
template <typename V> template <typename V>
static const std::array<Thumb1Matcher<V>, 27> g_thumb1_instruction_table {{ static const std::array<Thumb1Matcher<V>, 28> g_thumb1_instruction_table {{
#define INST(fn, name, bitstring) detail::detail<Thumb1Matcher, u16, 16>::GetMatcher<decltype(fn), fn>(name, bitstring) #define INST(fn, name, bitstring) detail::detail<Thumb1Matcher, u16, 16>::GetMatcher<decltype(fn), fn>(name, bitstring)
@ -89,7 +89,7 @@ static const std::array<Thumb1Matcher<V>, 27> g_thumb1_instruction_table {{
{ INST(&V::thumb1_ORR_reg, "ORR (reg)", "0100001100mmmddd") }, { INST(&V::thumb1_ORR_reg, "ORR (reg)", "0100001100mmmddd") },
//{ INST(&V::thumb1_MULS_rr, "MULS (rr)", "0100001101mmmddd") }, //{ INST(&V::thumb1_MULS_rr, "MULS (rr)", "0100001101mmmddd") },
{ INST(&V::thumb1_BIC_reg, "BIC (reg)", "0100001110mmmddd") }, { INST(&V::thumb1_BIC_reg, "BIC (reg)", "0100001110mmmddd") },
//{ INST(&V::thumb1_MVNS_rr, "MVNS (rr)", "0100001111mmmddd") }, { INST(&V::thumb1_MVN_reg, "MVN (reg)", "0100001111mmmddd") },
// Special data instructions // Special data instructions
{ INST(&V::thumb1_ADD_reg_t2, "ADD (reg, T2)", "01000100Dmmmmddd") }, // v4T, Low regs: v6T2 { INST(&V::thumb1_ADD_reg_t2, "ADD (reg, T2)", "01000100Dmmmmddd") }, // v4T, Low regs: v6T2

View file

@ -203,6 +203,10 @@ public:
return Common::StringFromFormat("bics %s, %s", RegStr(d_n), RegStr(m)); return Common::StringFromFormat("bics %s, %s", RegStr(d_n), RegStr(m));
} }
std::string thumb1_MVN_reg(Reg m, Reg d) {
return Common::StringFromFormat("mvns %s, %s", RegStr(d), RegStr(m));
}
std::string thumb1_ADD_reg_t2(bool d_n_hi, Reg m, Reg d_n_lo) { std::string thumb1_ADD_reg_t2(bool d_n_hi, Reg m, Reg d_n_lo) {
Reg d_n = d_n_hi ? (d_n_lo + 8) : d_n_lo; Reg d_n = d_n_hi ? (d_n_lo + 8) : d_n_lo;
return Common::StringFromFormat("add %s, %s", RegStr(d_n), RegStr(m)); return Common::StringFromFormat("add %s, %s", RegStr(d_n), RegStr(m));

View file

@ -307,6 +307,15 @@ struct TranslatorVisitor final {
ir.SetZFlag(ir.IsZero(result)); ir.SetZFlag(ir.IsZero(result));
return true; return true;
} }
bool thumb1_MVN_reg(Reg m, Reg d) {
// MVNS <Rd>, <Rm>
// Rd cannot encode R15.
auto result = ir.Not(ir.GetRegister(m));
ir.SetRegister(d, result);
ir.SetNFlag(ir.MostSignificantBit(result));
ir.SetZFlag(ir.IsZero(result));
return true;
}
bool thumb1_ADD_reg_t2(bool d_n_hi, Reg m, Reg d_n_lo) { bool thumb1_ADD_reg_t2(bool d_n_hi, Reg m, Reg d_n_lo) {
Reg d_n = d_n_hi ? (d_n_lo + 8) : d_n_lo; Reg d_n = d_n_hi ? (d_n_lo + 8) : d_n_lo;