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

Closed
opened 2026-11-26 04:34:52 +00:00 by github-bot · 0 comments
Owner

@⁠nova-aryan on GitHub · 2026-11-24 06:59 UTC · original

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.

**@⁠nova-aryan** on GitHub · 2026-11-24 06:59 UTC · [original](https://github.com/xcl-dev/xcl/issues/863) 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:34:52 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.