xshader: decode seven missing scalar SAVEEXEC variants #317

Closed
github-bot wants to merge 2 commits from gh-pr/317/head into gh-pr/317/base
Owner

@⁠bambermf on GitHub · 2026-11-23 18:08 UTC · original
bambermf:port/shader-scalar-bits → main · +31 −17 · 3 files · 2 commits · closed without merging

Library / area — tombox-xshader scalar SOP1 decoding. No DLL exports changed.

Source of the behaviour — the checked-in gfx1013 ISA table and the existing SAVEEXEC lane-model lowering.

What was wrong

The decoder omitted SOP1 0x2a–0x2b and 0x41–0x45, so their instructions could never reach the existing HLSL for saving EXEC and updating EXEC and SCC.

Change

Decode 64-bit NOR and XNOR and 32-bit NAND, NOR, XNOR, ANDN1 and ORN1. Extend the existing executable lane-model test and list these mnemonics alongside the other SAVEEXEC variants in the ISA sweep.

Measurements and tests

On f89e410 these seven encodings have no mnemonic. On this branch the release scalar_saveexec_lane_model test verified 18 mnemonics across 144 cases with immediate inputs and the same 144 with runtime inputs, covering both initial EXEC states. Zero failures. The test checks the saved mask, resulting EXEC and SCC, including the upper destination word for wide forms. The PR gate passed. The execution results cover the emulator lane model.

**@⁠bambermf** on GitHub · 2026-11-23 18:08 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/317) `bambermf:port/shader-scalar-bits` → `main` · +31 −17 · 3 files · 2 commits · closed without merging **Library / area** — tombox-xshader scalar SOP1 decoding. No DLL exports changed. **Source of the behaviour** — the checked-in gfx1013 ISA table and the existing SAVEEXEC lane-model lowering. ### What was wrong The decoder omitted SOP1 0x2a–0x2b and 0x41–0x45, so their instructions could never reach the existing HLSL for saving EXEC and updating EXEC and SCC. ### Change Decode 64-bit NOR and XNOR and 32-bit NAND, NOR, XNOR, ANDN1 and ORN1. Extend the existing executable lane-model test and list these mnemonics alongside the other SAVEEXEC variants in the ISA sweep. ### Measurements and tests On f89e410 these seven encodings have no mnemonic. On this branch the release scalar_saveexec_lane_model test verified 18 mnemonics across 144 cases with immediate inputs and the same 144 with runtime inputs, covering both initial EXEC states. Zero failures. The test checks the saved mask, resulting EXEC and SCC, including the upper destination word for wide forms. The PR gate passed. The execution results cover the emulator lane model.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:18:32 +00:00
github-bot closed this pull request 2026-11-26 06:18:32 +00:00
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-25 13:51 UTC · original

Thanks. Main already decodes these SAVEEXEC variants and tests them in scalar_saveexec_lane_model. If you want the exec0 = 0 case covered, a small follow-up extending saveexec() in tests/exec.rs would be welcome.

**@⁠omonkeyz** on GitHub · 2026-11-25 13:51 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/317#issuecomment-7164390676) Thanks. Main already decodes these SAVEEXEC variants and tests them in scalar_saveexec_lane_model. If you want the exec0 = 0 case covered, a small follow-up extending saveexec() in tests/exec.rs would be welcome.
Author
Owner

@⁠SchmashinPrunes on GitHub · 2026-11-24 14:34 UTC · original · approved these changes

Scope: semantics only, not a merge recommendation. #242, which omonkeyz has already applied locally (0447a97), names the same seven opcodes. This PR would duplicate them and would likely conflict once that release is pushed. The only extra here is the EXEC = 0 variant in saveexec(), which could go on top of #242 if it's wanted. GitHub doesn't let a reviewer without write access withdraw an approval, so please read this one as a comment.

The original check follows.

I checked this on RDNA2 silicon: a gfx1036 iGPU (Ryzen 5 9600X), ROCm/HIP 5.7.1, raw wave32 kernels, so RDNA2, not gfx1013. Each kernel ran twice with identical results, and I compared against the semantics this PR implements (my own port; I didn't run the PR's code).

The seven ops added here match the hardware on 4,096 random EXEC / S0 pairs each: D = the old EXEC, EXEC = op(S0, EXEC), SCC = (EXEC != 0). The ops are s_nor_saveexec_b64, s_xnor_saveexec_b64, s_nand_saveexec_b32, s_nor_saveexec_b32, s_xnor_saveexec_b32, s_andn1_saveexec_b32 and s_orn1_saveexec_b32. The other 13 saveexec forms in your table match as well.

This overlaps with #242, which names the same opcodes.

(Measured with an AI assistant, Claude.)

**@⁠SchmashinPrunes** on GitHub · 2026-11-24 14:34 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/317#pullrequestreview-6041176087) · **approved these changes** **Scope: semantics only, not a merge recommendation.** #242, which omonkeyz has already applied locally (0447a97), names the same seven opcodes. This PR would duplicate them and would likely conflict once that release is pushed. The only extra here is the EXEC = 0 variant in `saveexec()`, which could go on top of #242 if it's wanted. GitHub doesn't let a reviewer without write access withdraw an approval, so please read this one as a comment. The original check follows. I checked this on RDNA2 silicon: a gfx1036 iGPU (Ryzen 5 9600X), ROCm/HIP 5.7.1, raw wave32 kernels, so RDNA2, not gfx1013. Each kernel ran twice with identical results, and I compared against the semantics this PR implements (my own port; I didn't run the PR's code). The seven ops added here match the hardware on 4,096 random EXEC / S0 pairs each: D = the old EXEC, EXEC = op(S0, EXEC), SCC = (EXEC != 0). The ops are `s_nor_saveexec_b64`, `s_xnor_saveexec_b64`, `s_nand_saveexec_b32`, `s_nor_saveexec_b32`, `s_xnor_saveexec_b32`, `s_andn1_saveexec_b32` and `s_orn1_saveexec_b32`. The other 13 saveexec forms in your table match as well. This overlaps with #242, which names the same opcodes. (Measured with an AI assistant, Claude.)

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.