Recompiler: far jumps ignore incoming branches into the address calculation #857

Closed
opened 2026-11-24 06:59:38 +00:00 by nova-aryan · 0 comments
nova-aryan commented 2026-11-24 06:59:38 +00:00 (Migrated from github.com)
Contributor

Imported from ivall/xcl. Originally posted by nova-aryan on 2026-11-24T06:59:38Z.


The far-jump recognizer assumes that a four-instruction GETPC/add/addc/SETPC sequence always starts at GETPC. A direct branch into its low add, high add or SETPC can bypass that initialization, so the resulting SETPC target depends on the incoming SGPR state. Current main nevertheless annotates it with a fixed target.

I reproduced this with synthetic decoder tests on beaa245. An ordinary uninterrupted add/subtract sequence passes, while a conditional branch into the sequence and a resolved far jump into a later sequence both fail the new assertions.

Plan: collect direct and prospective far targets before publishing annotations, and leave a sequence indirect if any target enters after GETPC. Add regression coverage for both add/subtract and far-to-far edges.

Tested so far with a standalone harness importing the repository's unchanged decoder/spec modules under Rust 1.100.0 on WSL Linux. This is not a Windows crate build or GPU/retail run. Windows MSVC tools and a retail smoke-test title are unavailable in this checkout.

AI use: Codex, GPT-6.1-sol, reproduced the issue and drafted the proposed tests and fix.

<!-- greyfinch-sync:ivall/xcl:issue:6576452079 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/issues/863). Originally posted by [nova-aryan](https://github.com/nova-aryan) on 2026-11-24T06:59:38Z. --- The far-jump recognizer assumes that a four-instruction GETPC/add/addc/SETPC sequence always starts at GETPC. A direct branch into its low add, high add or SETPC can bypass that initialization, so the resulting SETPC target depends on the incoming SGPR state. Current main nevertheless annotates it with a fixed target. I reproduced this with synthetic decoder tests on beaa245. An ordinary uninterrupted add/subtract sequence passes, while a conditional branch into the sequence and a resolved far jump into a later sequence both fail the new assertions. Plan: collect direct and prospective far targets before publishing annotations, and leave a sequence indirect if any target enters after GETPC. Add regression coverage for both add/subtract and far-to-far edges. Tested so far with a standalone harness importing the repository's unchanged decoder/spec modules under Rust 1.100.0 on WSL Linux. This is not a Windows crate build or GPU/retail run. Windows MSVC tools and a retail smoke-test title are unavailable in this checkout. AI use: Codex, GPT-6.1-sol, reproduced the issue and drafted the proposed tests and fix.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl#857
No description provided.