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

interp: Handle jumps in branch delay slots better #15952

Merged
merged 1 commit into from
Sep 3, 2022

Conversation

unknownbrackets
Copy link
Collaborator

@unknownbrackets unknownbrackets commented Sep 3, 2022

This matches tests from a PSP-2000. Seems to consistently run the instruction even if likely, which writes rd. Interestingly, compare to the rules in #3175 (which are different)... in this case of beq/bne/beql/bnel + jalr/jr/j:

  • If a branch test passes, take the branch (but also link), whether likely or not.
  • If a branch test fails, take the jump in the delay slot. Link only when not likely (i.e. the link gets canceled, but not the jump.)

The link only when not likely is not implemented here (probably a real edge case, too.)

This is only the interpreter so far because I want to see if it helps #7223.

-[Unknown]

This matches tests from a PSP-2000.  Seems to consistently run the
instruction even if likely, which writes rd.

If the likely branch is not taken, the jump in the delay slot is taken.
However, it should cancel the rd write (not implemented here.)
@hrydgard hrydgard enabled auto-merge September 3, 2022 20:34
@hrydgard hrydgard added IRInterpreter Occurs with IR Interpreter but not with another CPU backend. CPU emulation and removed IRInterpreter Occurs with IR Interpreter but not with another CPU backend. labels Sep 3, 2022
@hrydgard hrydgard added this to the v1.14.0 milestone Sep 3, 2022
@hrydgard hrydgard merged commit 6783ecd into hrydgard:master Sep 3, 2022
@unknownbrackets unknownbrackets deleted the branch-delayslot branch September 3, 2022 20:42
unknownbrackets added a commit to unknownbrackets/ppsspp that referenced this pull request Sep 4, 2022
unknownbrackets referenced this pull request in jpcsp/jpcsp Sep 18, 2022
(beql/bnel). Found in Brooktown High USA -ULUS10257:

0x088D2A44: [0x55E0FFE5] - bnel       $t7, $zr, 0x088D29DC
0x088D2A48: [0x03E00008] - jr         $ra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants