Implemented the PKHTB and PKHBT instructions with tests. (#40)

This commit is contained in:
Sebastian Valle 2016-11-23 16:45:18 -05:00 committed by Merry
parent 780ff8e00e
commit 32615d0eff
4 changed files with 65 additions and 3 deletions

View file

@ -929,4 +929,24 @@ TEST_CASE("Test ARM SEL instruction", "[JitX64]") {
return sel_instr.Generate(false);
});
}
}
}
TEST_CASE("Fuzz ARM packing instructions", "[JitX64]") {
auto is_pkh_valid = [](u32 inst) -> bool {
// R15 as Rd, Rn, or Rm is UNPREDICTABLE
return Bits<16, 19>(inst) != 0b1111 &&
Bits<12, 15>(inst) != 0b1111 &&
Bits<0, 3>(inst) != 0b1111;
};
const std::array<InstructionGenerator, 2> instructions = {{
InstructionGenerator("cccc01101000nnnnddddvvvvv001mmmm", is_pkh_valid), // PKHBT
InstructionGenerator("cccc01101000nnnnddddvvvvv101mmmm", is_pkh_valid), // PKHTB
}};
SECTION("Packing") {
FuzzJitArm(1, 1, 10000, [&instructions]() -> u32 {
return instructions[RandInt<size_t>(0, instructions.size() - 1)].Generate();
});
}
}