shader: cover six scalar carry, borrow and 64-bit select lowerings #689

Merged
Leyukaka merged 1 commit from upstream-pr/695 into main 2026-11-23 00:37:16 +00:00
Leyukaka commented 2026-11-22 20:46:14 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-22T20:46:14Z.


Change

This closes six coverage gaps in the scalar carry, borrow and 64-bit select lowerings of tools/pixel_aot.py. Each was a one-line mutation that passed every WARP test on main. Only tests/pixel_aot_check.py changes (32 added lines); the translator does not.

New case Mutations it covers
s_sub_u32/s_subb_u32 on (0x0002000000000000, 0x0001000000000001): the high words differ only above bit 15 borrow computed from the source or the partial difference truncated to 16 bits
s_addc_u32 s45, s45, 0xffffffff with carry in set: once where the first addition wraps (high_a = 1), once where only the incoming carry does (high_a = 0) carry from the final result instead of the partial sum; second wrap compared with the original operand; immediate truncated to 16 bits
SCC read with s_cselect_b32 after s_cselect_b64 s[48:49], 0, -1 selects the zero pair s_cselect_b64 with an immediate source rewriting SCC from the selected value

s_cselect_b64 does not write SCC, so SCC must still be the result of the earlier compare.

Not covered: s_cselect_b64 with a 32-bit hex literal source. The translator zero-extends it. I have not checked that against hardware, so this PR does not fix that behavior in a test (as in #683 and #687).

Verification

On 2b03359 (branch on 3b9bb1a), Windows 11 build 26300.9974, MSVC 14.44.35207, Python 3.14, WARP:

ctest --preset dev --no-tests=error -j 4

All 297 tests pass.

Each mutation was applied to tools/pixel_aot.py one at a time, and all WARP tests were run. On main, all of them passed for each mutation. A control that dropped the second wrap from the s_addc_u32 carry was caught by pixel_aot_predicate_rounding_warp, so the run does detect a broken translator. On this branch, five mutations fail pixel_aot_predicate_rounding_warp and the select one fails pixel_aot_blend_scalar_warp.

#688 also edits the s_cselect_b64 match, so one of the two may need a rebase.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed. (No capability changed.)
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6547571015 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/695). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-22T20:46:14Z. --- ## Change This closes six coverage gaps in the scalar carry, borrow and 64-bit select lowerings of `tools/pixel_aot.py`. Each was a one-line mutation that passed every WARP test on `main`. Only `tests/pixel_aot_check.py` changes (32 added lines); the translator does not. | New case | Mutations it covers | |---|---| | `s_sub_u32`/`s_subb_u32` on `(0x0002000000000000, 0x0001000000000001)`: the high words differ only above bit 15 | borrow computed from the source or the partial difference truncated to 16 bits | | `s_addc_u32 s45, s45, 0xffffffff` with carry in set: once where the first addition wraps (`high_a = 1`), once where only the incoming carry does (`high_a = 0`) | carry from the final result instead of the partial sum; second wrap compared with the original operand; immediate truncated to 16 bits | | SCC read with `s_cselect_b32` after `s_cselect_b64 s[48:49], 0, -1` selects the zero pair | `s_cselect_b64` with an immediate source rewriting SCC from the selected value | `s_cselect_b64` does not write SCC, so SCC must still be the result of the earlier compare. Not covered: `s_cselect_b64` with a 32-bit hex literal source. The translator zero-extends it. I have not checked that against hardware, so this PR does not fix that behavior in a test (as in #683 and #687). ## Verification On `2b03359` (branch on `3b9bb1a`), Windows 11 build 26300.9974, MSVC 14.44.35207, Python 3.14, WARP: ```text ctest --preset dev --no-tests=error -j 4 ``` All 297 tests pass. Each mutation was applied to `tools/pixel_aot.py` one at a time, and all WARP tests were run. On `main`, all of them passed for each mutation. A control that dropped the second wrap from the `s_addc_u32` carry was caught by `pixel_aot_predicate_rounding_warp`, so the run does detect a broken translator. On this branch, five mutations fail `pixel_aot_predicate_rounding_warp` and the select one fails `pixel_aot_blend_scalar_warp`. #688 also edits the `s_cselect_b64` match, so one of the two may need a rebase. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [ ] I updated README/docs when a capability or build requirement changed. (No capability changed.) - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted.
upstream-sync closed this pull request 2026-11-24 06:44:22 +00:00
Sign in to join this conversation.
No reviewers
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
R0Y00/Xbox2Windows!689
No description provided.