SuperH: Delay slot fix for bf/s and and bt/s

Code now caches the value of the $(T_FLAG) before executing the delay slot. Previously the instruction executed in delay slot could potentially change the value of $(T_FLAG) and thereby resulting in incorrect behavior. Credit to Slinga and Waterfuell from SegaXtreme for reporting the issue.
This commit is contained in:
VGKintsugi 2021-03-25 02:08:22 -04:00 committed by GitHub
parent b9e67994b1
commit f1fc3a29ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1653,8 +1653,9 @@ MovMUReg2: MovMUReg2_15 is MovMUReg2_15 {
@if (SH_VERSION == "2") || (SH_VERSION == "2A")
:bf"/s" target00_07 is opcode_08_15=0b10001111 & target00_07
{
local cond = $(T_FLAG);
delayslot(1);
if ($(T_FLAG)==0) goto target00_07;
if (cond==0) goto target00_07;
}
@endif
@ -1666,8 +1667,9 @@ MovMUReg2: MovMUReg2_15 is MovMUReg2_15 {
@if (SH_VERSION == "2") || (SH_VERSION == "2A")
:bt"/s" target00_07 is opcode_08_15=0b10001101 & target00_07
{
local cond = $(T_FLAG);
delayslot(1);
if ($(T_FLAG)==1) goto target00_07;
if (cond==1) goto target00_07;
}
@endif