diff --git a/tests/A32/fuzz_arm.cpp b/tests/A32/fuzz_arm.cpp index c36e99c9..ccc3d46b 100644 --- a/tests/A32/fuzz_arm.cpp +++ b/tests/A32/fuzz_arm.cpp @@ -535,6 +535,37 @@ TEST_CASE("A32: Single random thumb instruction", "[thumb]") { } } +TEST_CASE("A32: Single random thumb instruction (offset)", "[thumb]") { + ThumbTestEnv jit_env{}; + ThumbTestEnv uni_env{}; + + Dynarmic::A32::Jit jit{GetUserConfig(jit_env)}; + A32Unicorn uni{uni_env}; + + A32Unicorn::RegisterArray regs; + A32Unicorn::ExtRegArray ext_reg; + std::vector instructions; + + for (size_t iteration = 0; iteration < 100000; ++iteration) { + std::generate(regs.begin(), regs.end(), [] { return RandInt(0, ~u32(0)); }); + std::generate(ext_reg.begin(), ext_reg.end(), [] { return RandInt(0, ~u32(0)); }); + + instructions.clear(); + instructions.push_back(0xbf00); // NOP + const std::vector inst = GenRandomThumbInst(0, true); + instructions.insert(instructions.end(), inst.begin(), inst.end()); + + const u32 start_address = 100; + const u32 cpsr = (RandInt(0, 0xF) << 28) | 0x1F0; + const u32 fpcr = RandomFpcr(); + + INFO("Instruction: 0x" << std::hex << inst[0]); + + regs[15] = start_address; + RunTestInstance(jit, uni, jit_env, uni_env, regs, ext_reg, instructions, cpsr, fpcr, 2); + } +} + TEST_CASE("A32: Small random thumb block", "[thumb]") { ThumbTestEnv jit_env{}; ThumbTestEnv uni_env{};