From 866dce0f233f399a162c76f4c9859b87120bb9dc Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sat, 16 Jul 2016 19:22:57 +0100 Subject: [PATCH] tests/Thumb: Add revsh (thumb) test --- tests/arm/fuzz_arm.cpp | 1 + tests/arm/fuzz_thumb.cpp | 1 + tests/arm/test_thumb_instructions.cpp | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+) diff --git a/tests/arm/fuzz_arm.cpp b/tests/arm/fuzz_arm.cpp index f21108da..798f81ee 100644 --- a/tests/arm/fuzz_arm.cpp +++ b/tests/arm/fuzz_arm.cpp @@ -219,6 +219,7 @@ void FuzzJitArm(const size_t instruction_count, const size_t instructions_to_exe } printf("\nFinal Register Listing: \n"); + printf(" interp jit\n"); for (int i = 0; i <= 15; i++) { printf("%4i: %08x %08x %s\n", i, interp.Reg[i], jit.Regs()[i], interp.Reg[i] != jit.Regs()[i] ? "*" : ""); } diff --git a/tests/arm/fuzz_thumb.cpp b/tests/arm/fuzz_thumb.cpp index 092234eb..90d0d41c 100644 --- a/tests/arm/fuzz_thumb.cpp +++ b/tests/arm/fuzz_thumb.cpp @@ -217,6 +217,7 @@ void FuzzJitThumb(const size_t instruction_count, const size_t instructions_to_e } printf("\nFinal Register Listing: \n"); + printf(" interp jit\n"); for (int i = 0; i <= 15; i++) { printf("%4i: %08x %08x %s\n", i, interp.Reg[i], jit.Regs()[i], interp.Reg[i] != jit.Regs()[i] ? "*" : ""); } diff --git a/tests/arm/test_thumb_instructions.cpp b/tests/arm/test_thumb_instructions.cpp index 27982537..f425b103 100644 --- a/tests/arm/test_thumb_instructions.cpp +++ b/tests/arm/test_thumb_instructions.cpp @@ -85,3 +85,21 @@ TEST_CASE( "thumb: lsls r0, r1, #31", "[thumb]" ) { REQUIRE( jit.Regs()[15] == 2 ); REQUIRE( jit.Cpsr() == 0xA0000030 ); // N, C flags, Thumb, User-mode } + +TEST_CASE( "thumb: revsh r4, r3", "[thumb]" ) { + Dynarmic::Jit jit{GetUserCallbacks()}; + code_mem.fill({}); + code_mem[0] = 0xBADC; // revsh r4, r3 + code_mem[1] = 0xE7FE; // b +#0 + + jit.Regs()[3] = 0x12345678; + jit.Regs()[15] = 0; // PC = 0 + jit.Cpsr() = 0x00000030; // Thumb, User-mode + + jit.Run(1); + + REQUIRE( jit.Regs()[3] == 0x12345678 ); + REQUIRE( jit.Regs()[4] == 0x00007856 ); + REQUIRE( jit.Regs()[15] == 2 ); + REQUIRE( jit.Cpsr() == 0x00000030 ); // Thumb, User-mode +}