tests/Thumb: Add revsh (thumb) test

This commit is contained in:
MerryMage 2016-07-16 19:22:57 +01:00
parent 22b1bd7cc7
commit 866dce0f23
3 changed files with 20 additions and 0 deletions

View file

@ -219,6 +219,7 @@ void FuzzJitArm(const size_t instruction_count, const size_t instructions_to_exe
} }
printf("\nFinal Register Listing: \n"); printf("\nFinal Register Listing: \n");
printf(" interp jit\n");
for (int i = 0; i <= 15; i++) { 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] ? "*" : ""); printf("%4i: %08x %08x %s\n", i, interp.Reg[i], jit.Regs()[i], interp.Reg[i] != jit.Regs()[i] ? "*" : "");
} }

View file

@ -217,6 +217,7 @@ void FuzzJitThumb(const size_t instruction_count, const size_t instructions_to_e
} }
printf("\nFinal Register Listing: \n"); printf("\nFinal Register Listing: \n");
printf(" interp jit\n");
for (int i = 0; i <= 15; i++) { 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] ? "*" : ""); printf("%4i: %08x %08x %s\n", i, interp.Reg[i], jit.Regs()[i], interp.Reg[i] != jit.Regs()[i] ? "*" : "");
} }

View file

@ -85,3 +85,21 @@ TEST_CASE( "thumb: lsls r0, r1, #31", "[thumb]" ) {
REQUIRE( jit.Regs()[15] == 2 ); REQUIRE( jit.Regs()[15] == 2 );
REQUIRE( jit.Cpsr() == 0xA0000030 ); // N, C flags, Thumb, User-mode 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
}