Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle branches in VFPU delay slots better #3175

Merged
merged 2 commits into from
Aug 15, 2013

Conversation

unknownbrackets
Copy link
Collaborator

The interpreter seems to already have the correct behavior and match the PSP. From my tests, although I'm not 100% confident for all cases it's true, the logic is as follows:

  • If a branch test passes, and its delay slot also passes, take the delay slot target.
  • If a branch test passes, but its delay slot does not pass, take the branch target.
  • If a branch test fails, then evaluate the delay slot as the branch per the above rules.

That is, if 4 in a row pass and each has a different target, take target 2. If only 2 and 3 pass, take 3. If only 1 and 3 pass, take 1.

However, we've only seen 3 games do this, and they're all by the same developer, I'm assuming the important thing is to handle their case: multiple tests with the same target. This is relatively easy.

Fixes #1926.

-[Unknown]

Based on tests on a PSP, all branches are attempted.  The behavior is
technically undefined.

It seems to take the delay slot's target if they differ and both pass.
This is the behavior the interpreter has, but it's more work in jit.

Since only a couple games seem to do this, and clearly expect this
behavior, this fixes all known cases of hrydgard#1926.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vfpu branch in delay slot
2 participants