Skip to content

Commit

Permalink
recompiler: fix instructionEpilogue() test
Browse files Browse the repository at this point in the history
instructionEpilogue() returns a bool, but all recompilers were
performing a 64-bit test on the return value. If sizeof(bool) == 1, only
the bottom 8 bits are guaranteed to be valid.
  • Loading branch information
invertego authored and LukeUsher committed Sep 27, 2021
1 parent bfca0dc commit 67db434
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ares/component/processor/sh2/cached.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ auto SH2::Recompiler::emit(u32 address) -> Block* {
address += 2;
if(hasBranched || (address & 0xfe) == 0) break; //block boundary
hasBranched = branched;
test(rax, rax);
test(al, al);
jz(imm8(1));
ret();
}
Expand Down
2 changes: 1 addition & 1 deletion ares/component/processor/sh2/recompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ auto SH2::Recompiler::emit(u32 address) -> Block* {
address += 2;
if(hasBranched || (address & 0xfe) == 0) break; //block boundary
hasBranched = branched;
test(rax, rax);
test(al, al);
jnz(epilogue);
}
jmp(epilogue);
Expand Down
2 changes: 1 addition & 1 deletion ares/n64/cpu/recompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ auto CPU::Recompiler::emit(u32 address) -> Block* {
address += 4;
if(hasBranched || (address & 0xfc) == 0) break; //block boundary
hasBranched = branched;
test(rax, rax);
test(al, al);
jnz(epilogue);
}
jmp(epilogue);
Expand Down
2 changes: 1 addition & 1 deletion ares/n64/rsp/recompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ auto RSP::Recompiler::emit(u32 address) -> Block* {
address += 4;
if(hasBranched || (address & 0xffc) == 0) break; //IMEM boundary
hasBranched = branched;
test(rax, rax);
test(al, al);
jnz(epilogue);
}
jmp(epilogue);
Expand Down
2 changes: 1 addition & 1 deletion ares/ps1/cpu/recompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ auto CPU::Recompiler::emit(u32 address) -> Block* {
address += 4;
if(hasBranched || (address & 0xfc) == 0) break; //block boundary
hasBranched = branched;
test(rax, rax);
test(al, al);
jnz(epilogue);
}
jmp(epilogue);
Expand Down

0 comments on commit 67db434

Please sign in to comment.