From 473bbd422e8452827a66d8a75c0bae71e5c59a3b Mon Sep 17 00:00:00 2001 From: merry Date: Sat, 12 Feb 2022 21:42:58 +0000 Subject: [PATCH] test_arm_instructions: Add vmsr/vcmp/vmrs test --- tests/A32/test_arm_instructions.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/A32/test_arm_instructions.cpp b/tests/A32/test_arm_instructions.cpp index 123283a5..5976b6af 100644 --- a/tests/A32/test_arm_instructions.cpp +++ b/tests/A32/test_arm_instructions.cpp @@ -559,3 +559,25 @@ TEST_CASE("arm: Memory access (fastmem)", "[arm][A32]") { jit.Run(); REQUIRE(strncmp(backing_memory + 0x100, backing_memory + 0x1F0, 4) == 0); } + +TEST_CASE("arm: vmsr, vcmp, vmrs", "[arm][A32]") { + ArmTestEnv test_env; + A32::Jit jit{GetUserConfig(&test_env)}; + test_env.code_mem = { + 0xeee10a10, // vmsr fpscr, r0 + 0xeeb48a4a, // vcmp.f32 s16, s20 + 0xeef1fa10, // vmrs apsr_nzcv, fpscr + 0xe12fff1e, // bx lr + }; + + jit.ExtRegs()[16] = 0xFF7FFFFF; + jit.ExtRegs()[20] = 0xFF7FFFFF; + + jit.Regs()[0] = 0x60000000; + + jit.SetFpscr(0x3ee22ac0); + jit.SetCpsr(0x60000000); // User-mode + + test_env.ticks_left = 4; + jit.Run(); +}