Implement thumb1_CMP_reg
This commit is contained in:
parent
46408267c3
commit
641dbf8eb4
3 changed files with 15 additions and 2 deletions
|
@ -56,7 +56,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename V>
|
template <typename V>
|
||||||
static const std::array<Thumb1Matcher<V>, 23> g_thumb1_instruction_table {{
|
static const std::array<Thumb1Matcher<V>, 24> 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)
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ static const std::array<Thumb1Matcher<V>, 23> g_thumb1_instruction_table {{
|
||||||
{ INST(&V::thumb1_ROR_reg, "ROR (reg)", "0100000111sssddd") },
|
{ INST(&V::thumb1_ROR_reg, "ROR (reg)", "0100000111sssddd") },
|
||||||
{ INST(&V::thumb1_TST_reg, "TST (reg)", "0100001000mmmnnn") },
|
{ INST(&V::thumb1_TST_reg, "TST (reg)", "0100001000mmmnnn") },
|
||||||
{ INST(&V::thumb1_RSB_imm, "RSB (imm)", "0100001001nnnddd") },
|
{ INST(&V::thumb1_RSB_imm, "RSB (imm)", "0100001001nnnddd") },
|
||||||
//{ INST(&V::thumb1_CMP_rr, "CMP (rr)", "0100001010mmmnnn") },
|
{ INST(&V::thumb1_CMP_reg, "CMP (reg)", "0100001010mmmnnn") },
|
||||||
//{ INST(&V::thumb1_CMN_rr, "CMN (rr)", "0100001011mmmnnn") },
|
//{ INST(&V::thumb1_CMN_rr, "CMN (rr)", "0100001011mmmnnn") },
|
||||||
//{ INST(&V::thumb1_ORRS_rr, "ORRS (rr)", "0100001100mmmddd") },
|
//{ INST(&V::thumb1_ORRS_rr, "ORRS (rr)", "0100001100mmmddd") },
|
||||||
//{ INST(&V::thumb1_MULS_rr, "MULS (rr)", "0100001101mmmddd") },
|
//{ INST(&V::thumb1_MULS_rr, "MULS (rr)", "0100001101mmmddd") },
|
||||||
|
|
|
@ -187,6 +187,10 @@ public:
|
||||||
return Common::StringFromFormat("rsbs %s, %s, #0", RegStr(d), RegStr(n));
|
return Common::StringFromFormat("rsbs %s, %s, #0", RegStr(d), RegStr(n));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string thumb1_CMP_reg(Reg m, Reg n) {
|
||||||
|
return Common::StringFromFormat("cmp %s, %s", RegStr(n), 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));
|
||||||
|
|
|
@ -269,6 +269,15 @@ struct TranslatorVisitor final {
|
||||||
ir.SetVFlag(result.overflow);
|
ir.SetVFlag(result.overflow);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
bool thumb1_CMP_reg(Reg m, Reg n) {
|
||||||
|
// CMP <Rn>, <Rm>
|
||||||
|
auto result = ir.SubWithCarry(ir.GetRegister(n), ir.GetRegister(m), ir.Imm1(1));
|
||||||
|
ir.SetNFlag(ir.MostSignificantBit(result.result));
|
||||||
|
ir.SetZFlag(ir.IsZero(result.result));
|
||||||
|
ir.SetCFlag(result.carry);
|
||||||
|
ir.SetVFlag(result.overflow);
|
||||||
|
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;
|
||||||
|
|
Loading…
Reference in a new issue