mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-25 05:10:15 +00:00
tests/JitX64: Fix thumb tests
This commit is contained in:
parent
20d87c315a
commit
8bd590ed99
@ -412,6 +412,7 @@ static const std::array<Instruction, 27> thumb_instruction_table = { {
|
||||
// B<cond> <PC + #offset*2>
|
||||
Cond cond = bits<8, 11>(instruction);
|
||||
s32 offset = bits<0, 7>(instruction);
|
||||
ASSERT_MSG(cond != 0b1110, "UNDEFINED");
|
||||
v->thumb_B(cond, offset);
|
||||
})},
|
||||
{ "SWI", MakeMatcher("11011111xxxxxxxx", [](Visitor* v, u32 instruction) {
|
||||
|
@ -56,6 +56,7 @@ void JitX64::thumb_BLX_prefix(ArmImm11 imm11) {
|
||||
current.arm_pc += GetInstSize();
|
||||
|
||||
// Compile the suffix, and make sure that it's compiled.
|
||||
instructions_compiled++; // Has to be done to pass unit tests (same method of counting as interpreter).
|
||||
CompileSingleThumbInstruction();
|
||||
ASSERT_MSG(thumb_BLX_suffix_executed, "thumb BLX suffix did not come after thumb BLX prefix, pc = %u", current.arm_pc);
|
||||
|
||||
@ -81,15 +82,14 @@ void JitX64::thumb_BLX_suffix(bool X, ArmImm11 imm11) {
|
||||
reg_alloc.UnlockArm(14);
|
||||
|
||||
if (X) {
|
||||
new_pc &= 0xFFFFFFFC;
|
||||
} else {
|
||||
current.TFlag = false;
|
||||
code->MOV(32, MJitStateTFlag(), Imm32(0));
|
||||
new_pc &= 0xFFFFFFFC;
|
||||
}
|
||||
|
||||
reg_alloc.FlushEverything();
|
||||
current.arm_pc += GetInstSize();
|
||||
CompileUpdateCycles(false);
|
||||
CompileUpdateCycles();
|
||||
CompileJumpToBB(new_pc);
|
||||
|
||||
stop_compilation = true;
|
||||
|
@ -134,11 +134,11 @@ void FuzzJitThumb(const int instruction_count, const int instructions_to_execute
|
||||
test_mem->code_mem[2 + instruction_count] = 0xE7FE; // b +#0 // busy wait loop
|
||||
|
||||
test_mem->recording.clear();
|
||||
interp.ExecuteInstructions(instructions_to_execute_count);
|
||||
interp.ExecuteInstructions(instructions_to_execute_count + 1);
|
||||
auto interp_mem_recording = test_mem->recording;
|
||||
|
||||
test_mem->recording.clear();
|
||||
jit.ExecuteInstructions(instructions_to_execute_count);
|
||||
jit.ExecuteInstructions(instructions_to_execute_count + 1);
|
||||
auto jit_mem_recording = test_mem->recording;
|
||||
|
||||
bool pass = true;
|
||||
@ -279,6 +279,7 @@ TEST_CASE("Fuzz Thumb instructions set 2 (affects PC)", "[JitX64][Thumb]") {
|
||||
FromBitString16("11100xxxxxxxxxxx"), // B
|
||||
FromBitString16("01000100h0xxxxxx"), // ADD (high registers)
|
||||
FromBitString16("01000110h0xxxxxx"), // MOV (high registers)
|
||||
FromBitString16("11010000xxxxxxxx"), // B<cond>
|
||||
FromBitString16("11010001xxxxxxxx"), // B<cond>
|
||||
FromBitString16("11010010xxxxxxxx"), // B<cond>
|
||||
FromBitString16("11010011xxxxxxxx"), // B<cond>
|
||||
@ -291,7 +292,6 @@ TEST_CASE("Fuzz Thumb instructions set 2 (affects PC)", "[JitX64][Thumb]") {
|
||||
FromBitString16("11011010xxxxxxxx"), // B<cond>
|
||||
FromBitString16("11011011xxxxxxxx"), // B<cond>
|
||||
FromBitString16("11011100xxxxxxxx"), // B<cond>
|
||||
FromBitString16("11011110xxxxxxxx"), // B<cond>
|
||||
}};
|
||||
|
||||
auto instruction_select = [&](int) -> u16 {
|
||||
@ -321,5 +321,5 @@ TEST_CASE("Fuzz Thumb instructions set 3 (32-bit BL/BLX)", "[JitX64][Thumb]") {
|
||||
return inst_info.first | (random &~ inst_info.second);
|
||||
};
|
||||
|
||||
FuzzJitThumb(2, 1, 1000, instruction_select);
|
||||
FuzzJitThumb(2, 2, 1000, instruction_select);
|
||||
}
|
Loading…
Reference in New Issue
Block a user