fuzz_arm: Add test for edge-case of UASX instruction

This commit is contained in:
MerryMage 2016-12-20 20:04:38 +00:00
parent 821b26e9d2
commit 975987f38e

View file

@ -411,6 +411,30 @@ TEST_CASE( "arm: shsax r11, sp, r9 (Edge-case)", "[arm]" ) {
REQUIRE( jit.Cpsr() == 0x000001d0 ); REQUIRE( jit.Cpsr() == 0x000001d0 );
} }
TEST_CASE( "arm: uasx (Edge-case)", "[arm]" ) {
// UASX's Rm<31:16> == 0x0000.
// An implementation that depends on addition overflow to detect
// if diff >= 0 will fail this testcase.
Dynarmic::Jit jit{GetUserCallbacks()};
code_mem.fill({});
code_mem[0] = 0xe6549f35; // uasx r9, r4, r5
code_mem[1] = 0xeafffffe; // b +#0
jit.Regs()[4] = 0x8ed38f4c;
jit.Regs()[5] = 0x0000261d;
jit.Regs()[15] = 0x00000000;
jit.Cpsr() = 0x000001d0; // User-mode
jit.Run(2);
REQUIRE( jit.Regs()[4] == 0x8ed38f4c );
REQUIRE( jit.Regs()[5] == 0x0000261d );
REQUIRE( jit.Regs()[9] == 0xb4f08f4c );
REQUIRE( jit.Regs()[15] == 0x00000004 );
REQUIRE( jit.Cpsr() == 0x000301d0 );
}
struct VfpTest { struct VfpTest {
u32 initial_fpscr; u32 initial_fpscr;
u32 a; u32 a;