thumb32: Implement QSUB
This commit is contained in:
parent
65365ad2a3
commit
cd6e4c7afd
4 changed files with 23 additions and 1 deletions
|
@ -277,7 +277,7 @@ std::optional<std::reference_wrapper<const Thumb32Matcher<V>>> DecodeThumb32(u32
|
|||
// Miscellaneous Operations
|
||||
//INST(&V::thumb32_QADD, "QADD", "111110101000----1111----1000----"),
|
||||
INST(&V::thumb32_QDADD, "QDADD", "111110101000nnnn1111dddd1001mmmm"),
|
||||
//INST(&V::thumb32_QSUB, "QSUB", "111110101000----1111----1010----"),
|
||||
INST(&V::thumb32_QSUB, "QSUB", "111110101000nnnn1111dddd1010mmmm"),
|
||||
INST(&V::thumb32_QDSUB, "QDSUB", "111110101000nnnn1111dddd1011mmmm"),
|
||||
INST(&V::thumb32_REV, "REV", "111110101001nnnn1111dddd1000mmmm"),
|
||||
INST(&V::thumb32_REV16, "REV16", "111110101001nnnn1111dddd1001mmmm"),
|
||||
|
|
|
@ -51,6 +51,20 @@ bool ThumbTranslatorVisitor::thumb32_QDSUB(Reg n, Reg d, Reg m) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ThumbTranslatorVisitor::thumb32_QSUB(Reg n, Reg d, Reg m) {
|
||||
if (d == Reg::PC || n == Reg::PC || m == Reg::PC) {
|
||||
return UnpredictableInstruction();
|
||||
}
|
||||
|
||||
const auto reg_m = ir.GetRegister(m);
|
||||
const auto reg_n = ir.GetRegister(n);
|
||||
const auto result = ir.SignedSaturatedSub(reg_m, reg_n);
|
||||
|
||||
ir.SetRegister(d, result.result);
|
||||
ir.OrQFlag(result.overflow);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ThumbTranslatorVisitor::thumb32_RBIT(Reg n, Reg d, Reg m) {
|
||||
if (m != n || d == Reg::PC || m == Reg::PC) {
|
||||
return UnpredictableInstruction();
|
||||
|
|
|
@ -120,6 +120,7 @@ struct ThumbTranslatorVisitor final {
|
|||
bool thumb32_CLZ(Reg n, Reg d, Reg m);
|
||||
bool thumb32_QDADD(Reg n, Reg d, Reg m);
|
||||
bool thumb32_QDSUB(Reg n, Reg d, Reg m);
|
||||
bool thumb32_QSUB(Reg n, Reg d, Reg m);
|
||||
bool thumb32_RBIT(Reg n, Reg d, Reg m);
|
||||
bool thumb32_REV(Reg n, Reg d, Reg m);
|
||||
bool thumb32_REV16(Reg n, Reg d, Reg m);
|
||||
|
|
|
@ -383,6 +383,13 @@ TEST_CASE("Fuzz Thumb32 instructions set", "[JitX64][Thumb][Thumb32]") {
|
|||
const auto n = Common::Bits<16, 19>(inst);
|
||||
return d != 15 && m != 15 && n != 15;
|
||||
}),
|
||||
ThumbInstGen("111110101000nnnn1111dddd1010mmmm", // QSUB
|
||||
[](u32 inst) {
|
||||
const auto d = Common::Bits<8, 11>(inst);
|
||||
const auto m = Common::Bits<0, 3>(inst);
|
||||
const auto n = Common::Bits<16, 19>(inst);
|
||||
return d != 15 && m != 15 && n != 15;
|
||||
}),
|
||||
ThumbInstGen("111110101001nnnn1111dddd1010mmmm", // RBIT
|
||||
[](u32 inst) {
|
||||
const auto d = Common::Bits<8, 11>(inst);
|
||||
|
|
Loading…
Reference in a new issue