startup: the vector select refuses a negated source operand (2 of 29 loading-screen shader refusals) #1702

Closed
opened 2026-11-24 17:34:03 +00:00 by triggered02 · 0 comments
triggered02 commented 2026-11-24 17:34:03 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T17:34:03Z.


Found while triaging the refusals in the first main-game loading-screen shader cache (#870). 2 of 29 refused shaders.

Problem

A VOP3 v_cndmask_b32 can carry the - source modifier. In an integer instruction that modifier is the source's sign bit flipped — the same bit pattern a float negation produces. The select handler passed the printed operand straight to the uint helper:

v_cndmask_b32_e64 v31, v30, -v30
-> REFUSED: operand '-v30'

Fix

The select reads both sources through a small helper that flips the sign bit for a - operand ((v30 ^ 0x80000000u)) and returns the plain register otherwise, so the no-modifier output is unchanged. The helper is used only where the translation models the modifier: another integer instruction carrying the same - operand still refuses rather than silently flipping a bit.

Measured

VOP2-as-VOP3 encodings built in the test (0b110101 prefix, opcode 0x100 + 0x01, neg bits w1[31:29]), main at 68969ed8:

form before after
v_cndmask_b32_e64 v31, v30, v30 (s0 & 1) ? v30 : v30 unchanged
v_cndmask_b32_e64 v31, v30, -v30 refused (s0 & 1) ? (v30 ^ 0x80000000u) : v30
v_cndmask_b32_e64 v31, -v30, v30 refused negation on the other source
both sources negated refused two sign-bit flips
v_and_b32_e64 v1, v30, -v30 refused stays refused

Census A/B over the local cache (aggregates only): refusals grouped as operand '-v…' go 2 → 0, and those shaders progress to the next form (v_cvt_pknorm_u16_f32, v_cmp_class_f32).

Done when

  • The vector select accepts a negated source on either or both sources, with the sign bit flipped.
  • A select without a negation emits byte-identical text to before.
  • Other integer instructions carrying the same modifier still refuse.
  • A ctest starts from synthetic encoded instructions, decodes, then translates, and fails if the helper call is reverted.
  • docs/experiments.md records the accepted form.

Not in this slice: |vN| (absolute) on an integer source, negations on other integer instructions, and proving the loading screen gets further (counts are aggregates only).

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6587713355 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1709). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T17:34:03Z. --- Found while triaging the refusals in the first main-game loading-screen shader cache (#870). **2 of 29** refused shaders. ## Problem A VOP3 `v_cndmask_b32` can carry the `-` source modifier. In an integer instruction that modifier is the source's sign bit flipped — the same bit pattern a float negation produces. The select handler passed the printed operand straight to the uint helper: ``` v_cndmask_b32_e64 v31, v30, -v30 -> REFUSED: operand '-v30' ``` ## Fix The select reads both sources through a small helper that flips the sign bit for a `-` operand (`(v30 ^ 0x80000000u)`) and returns the plain register otherwise, so the no-modifier output is unchanged. The helper is used **only** where the translation models the modifier: another integer instruction carrying the same `-` operand still refuses rather than silently flipping a bit. ## Measured VOP2-as-VOP3 encodings built in the test (`0b110101` prefix, opcode `0x100 + 0x01`, neg bits `w1[31:29]`), `main` at `68969ed8`: | form | before | after | |---|---|---| | `v_cndmask_b32_e64 v31, v30, v30` | `(s0 & 1) ? v30 : v30` | unchanged | | `v_cndmask_b32_e64 v31, v30, -v30` | refused | `(s0 & 1) ? (v30 ^ 0x80000000u) : v30` | | `v_cndmask_b32_e64 v31, -v30, v30` | refused | negation on the other source | | both sources negated | refused | two sign-bit flips | | `v_and_b32_e64 v1, v30, -v30` | refused | stays refused | Census A/B over the local cache (aggregates only): refusals grouped as `operand '-v…'` go **2 → 0**, and those shaders progress to the next form (`v_cvt_pknorm_u16_f32`, `v_cmp_class_f32`). ## Done when - The vector select accepts a negated source on either or both sources, with the sign bit flipped. - A select without a negation emits byte-identical text to before. - Other integer instructions carrying the same modifier still refuse. - A ctest starts from **synthetic** encoded instructions, decodes, then translates, and fails if the helper call is reverted. - `docs/experiments.md` records the accepted form. Not in this slice: `|vN|` (absolute) on an integer source, negations on other integer instructions, and proving the loading screen gets further (counts are aggregates only). AI-assisted (Claude Code).
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
R0Y00/Xbox2Windows#1702
No description provided.