shader: lower s_bitset0_b32 and s_ff0_i32_b32 in gfx2hlsl (Part of #1723) #2033

Closed
tedin7 wants to merge 5 commits from upstream-pr/2040 into main
tedin7 commented 2026-11-24 23:32:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T23:32:21Z.


Part of #1723

What this unblocks: startup shaders that use the RDNA2 scalar address/bit helpers s_lshl2_add_u32, s_lshl3_add_u32, s_bitset0_b32 and s_ff0_i32_b32 now translate instead of stopping at "Unsupported".

Change

  • tools/startup/gfx2hlsl.py: lowering for the four scalar ops.
    • s_lshl2_add_u32 / s_lshl3_add_u32: D = (S0 << n) + S1; SCC is the carry out of the 64-bit sum (bits shifted out of S0 or a wrapped add). SCC is computed before the destination write, so a destination aliasing a source is correct.
    • s_bitset0_b32: clears bit S0[4:0] of the destination (read-modify-write); SCC unchanged.
    • s_ff0_i32_b32: uint(firstbitlow(~S0)), which is 0xffffffff (-1) when no bit is zero; SCC unchanged.
    • Lane-mask sources, descriptor data and destinations outside s0..s105/m0 are refused.
  • tests/startup_gfx2hlsl_scalar_twins_check.py, registered in CMakeLists.txt as startup_gfx2hlsl_scalar_twins: builds instruction words from the decoder layouts, translates, runs the emitted lines on an integer evaluator over edge values and compares with an integer reference (including destination aliasing and SCC).

Verification

Run on the Linux worker (Python only, no GPU):

  • python3 -B tests/startup_gfx2hlsl_scalar_twins_check.py on origin/main: fails (Unsupported: s_lshl2_add_u32).
  • Same command with this change: startup_gfx2hlsl_scalar_twins_check: ok.
  • python3 -B tests/startup_gfx2hlsl_sop2_complement_check.py: PASS.
  • python3 -B tests/startup_gfx2hlsl_scalar_m0_check.py: controls passed.
  • python3 -B tests/startup_gfx2hlsl_bit_alu_check.py: ok.

Win2025 commands: not run (no Windows host in this worker).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6593565402 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2040). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T23:32:21Z. --- Part of #1723 What this unblocks: startup shaders that use the RDNA2 scalar address/bit helpers `s_lshl2_add_u32`, `s_lshl3_add_u32`, `s_bitset0_b32` and `s_ff0_i32_b32` now translate instead of stopping at "Unsupported". ## Change - `tools/startup/gfx2hlsl.py`: lowering for the four scalar ops. - `s_lshl2_add_u32` / `s_lshl3_add_u32`: `D = (S0 << n) + S1`; SCC is the carry out of the 64-bit sum (bits shifted out of S0 or a wrapped add). SCC is computed before the destination write, so a destination aliasing a source is correct. - `s_bitset0_b32`: clears bit `S0[4:0]` of the destination (read-modify-write); SCC unchanged. - `s_ff0_i32_b32`: `uint(firstbitlow(~S0))`, which is `0xffffffff` (-1) when no bit is zero; SCC unchanged. - Lane-mask sources, descriptor data and destinations outside s0..s105/m0 are refused. - `tests/startup_gfx2hlsl_scalar_twins_check.py`, registered in `CMakeLists.txt` as `startup_gfx2hlsl_scalar_twins`: builds instruction words from the decoder layouts, translates, runs the emitted lines on an integer evaluator over edge values and compares with an integer reference (including destination aliasing and SCC). ## Verification Run on the Linux worker (Python only, no GPU): - `python3 -B tests/startup_gfx2hlsl_scalar_twins_check.py` on `origin/main`: fails (`Unsupported: s_lshl2_add_u32`). - Same command with this change: `startup_gfx2hlsl_scalar_twins_check: ok`. - `python3 -B tests/startup_gfx2hlsl_sop2_complement_check.py`: PASS. - `python3 -B tests/startup_gfx2hlsl_scalar_m0_check.py`: controls passed. - `python3 -B tests/startup_gfx2hlsl_bit_alu_check.py`: ok. Win2025 commands: not run (no Windows host in this worker). AI-assisted; commands listed were executed locally.
chatgpt-codex-connector[bot commented 2026-11-25 00:05:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T23:36:34Z.

Review: COMMENTED


💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e9e35fc438

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6049149118 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2040#pullrequestreview-6049149118). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T23:36:34Z. **Review:** COMMENTED --- <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `e9e35fc438` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
upstream-sync changed title from [PR #2040] shader: lower s_lshl2/3_add_u32, s_bitset0_b32 and s_ff0_i32_b32 in gfx2hlsl (Part of #1723) to [PR #2040] shader: lower s_bitset0_b32 and s_ff0_i32_b32 in gfx2hlsl (Part of #1723) 2026-11-25 01:01:14 +00:00
tedin7 commented 2026-11-25 01:01:15 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T00:57:41Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6049914340 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2040#pullrequestreview-6049914340). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T00:57:41Z. **Review:** COMMENTED --- _No description provided._
tedin7 commented 2026-11-25 01:01:15 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T00:57:43Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6049914608 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2040#pullrequestreview-6049914608). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T00:57:43Z. **Review:** COMMENTED --- _No description provided._
chatgpt-codex-connector[bot commented 2026-11-25 01:01:56 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T23:32:33Z.


Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T23:36:37.626305Z e9e35fc PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147517535 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2040#issuecomment-7147517535). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T23:32:33Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"e9e35fc4382cf8c0e8b46636a1c0c773220d9cdc","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T23:36:37.626305Z">2026-11-24T23:36:37.626305Z</relative-time> | `e9e35fc` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
R0Y00 commented 2026-11-25 01:02:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T00:15:11Z.


#2027 is now on main and supplies the s_lshl2_add_u32 and s_lshl3_add_u32 handlers, including the SCC proof and discard-destination control. Please keep those definitions from main when updating this branch and limit its remaining diff to s_bitset0_b32 and s_ff0_i32_b32. That leaves the two operations independently reviewable and keeps the existing lane-mask and numeric-symbol findings applicable to this smaller slice.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7148313520 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2040#issuecomment-7148313520). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T00:15:11Z. --- #2027 is now on main and supplies the `s_lshl2_add_u32` and `s_lshl3_add_u32` handlers, including the SCC proof and discard-destination control. Please keep those definitions from main when updating this branch and limit its remaining diff to `s_bitset0_b32` and `s_ff0_i32_b32`. That leaves the two operations independently reviewable and keeps the existing lane-mask and numeric-symbol findings applicable to this smaller slice.
tedin7 commented 2026-11-25 01:02:07 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T00:38:24Z.


Updated in 90959dc6: removed the duplicate s_lshl2_add_u32 / s_lshl3_add_u32 handlers and kept main's SCC uniformity and discard-destination control; this PR now covers s_bitset0_b32 and s_ff0_i32_b32 only.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7148722621 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2040#issuecomment-7148722621). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T00:38:24Z. --- Updated in 90959dc6: removed the duplicate s_lshl2_add_u32 / s_lshl3_add_u32 handlers and kept main's SCC uniformity and discard-destination control; this PR now covers s_bitset0_b32 and s_ff0_i32_b32 only.
chatgpt-codex-connector[bot commented 2026-11-25 01:02:11 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T23:36:35Z.

Code review location: tools/startup/gfx2hlsl.py; line 1822

@@ -1758,6 +1818,8 @@ def declarations(self):
     's_min_i32': ('uint(min(int({0}), int({1})))', None), 's_max_i32': ('uint(max(int({0}), int({1})))', None),
     's_bfe_u32': ('({0} >> ({1} & 31)) & ((1u << (({1} >> 16) & 127)) - 1)', '$ != 0'),
     's_brev_b32': ('reversebits({0})', None),
+    # s_ff0_i32_b32: index of the lowest zero bit, -1 when every bit is set; SCC unchanged.
+    's_ff0_i32_b32': ('uint(firstbitlow(~{0}))', None),

P2 Badge Reject lane-mask inputs before lowering s_ff0_i32_b32

When this instruction reads exec_lo, vcc_lo, or an SGPR tracked in self.masks, dispatch through SCA bypasses the whole-word guards used by the other new lowerings. These masks contain only the current lane's bit in the translated shader. For example, when the guest's EXEC_LO is 0xffffffff, the emitted uint(firstbitlow(~exec)) evaluates to 1 because translated exec is 1, rather than the required 0xffffffff. This silently mistranslates valid shaders; reject lane-mask sources, including copied masks, unless a full-wave representation is available.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4688048696 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2040#discussion_r4688048696). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T23:36:35Z. **Code review location:** `tools/startup/gfx2hlsl.py`; line 1822 ~~~~diff @@ -1758,6 +1818,8 @@ def declarations(self): 's_min_i32': ('uint(min(int({0}), int({1})))', None), 's_max_i32': ('uint(max(int({0}), int({1})))', None), 's_bfe_u32': ('({0} >> ({1} & 31)) & ((1u << (({1} >> 16) & 127)) - 1)', '$ != 0'), 's_brev_b32': ('reversebits({0})', None), + # s_ff0_i32_b32: index of the lowest zero bit, -1 when every bit is set; SCC unchanged. + 's_ff0_i32_b32': ('uint(firstbitlow(~{0}))', None), ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Reject lane-mask inputs before lowering s_ff0_i32_b32** When this instruction reads `exec_lo`, `vcc_lo`, or an SGPR tracked in `self.masks`, dispatch through `SCA` bypasses the whole-word guards used by the other new lowerings. These masks contain only the current lane's bit in the translated shader. For example, when the guest's `EXEC_LO` is `0xffffffff`, the emitted `uint(firstbitlow(~exec))` evaluates to `1` because translated `exec` is `1`, rather than the required `0xffffffff`. This silently mistranslates valid shaders; reject lane-mask sources, including copied masks, unless a full-wave representation is available. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
chatgpt-codex-connector[bot commented 2026-11-25 01:02:11 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T23:36:35Z.

Code review location: tools/startup/gfx2hlsl.py; line 953

@@ -932,6 +932,66 @@ def op_s_bfm_b32(self, ops, mods):
         self.set_s(d, '(((1u << (%s & 31)) - 1) << (%s & 31))' % (self.u(ops[1]), self.u(ops[2])))
         return None
 
+    def scalar_word_dest(self, base, tok):
+        """Destination of a whole-word scalar op that reads and writes a full 32-bit value: an SGPR or m0."""
+        if tok == 'm0':
+            return 'm0'
+        r = reg_range(tok)
+        if not r or r[0] != 's' or r[1] != r[2] or r[1] > 105:
+            raise Unsupported('%s destination %s' % (base, tok))
+        return r[1]
+
+    def scalar_word_sources(self, base, toks):
+        """uint expressions for whole-word sources: lane masks and descriptor data have no full word to read."""
+        out = []
+        for t in toks:
+            r = reg_range(t)
+            if t in ('exec', 'exec_lo', 'exec_hi', 'vcc', 'vcc_lo', 'vcc_hi') or (r and r[0] == 's' and r[1] in self.masks):
+                raise Unsupported('%s on a lane mask' % base)
+            sym = self.sym.get(r[1]) if r and r[0] == 's' else None
+            if sym and sym[0] != 'const':
+                raise Unsupported('%s on descriptor data' % base)

P2 Badge Allow numeric symbolic values through the source validator

When an operand is a root constant or a value read by a literal-offset s_buffer_load_dword*, its symbolic tag is ud or fixed_buffer_word; both already represent complete numeric values supported by Stage.S(). This check incorrectly classifies them as descriptor data. For example, s_lshl2_add_u32 s4, s8, s3 raises Unsupported when s8 holds a root constant, and s_bitset0_b32 similarly rejects a numeric root-constant destination. The new operations therefore reject ordinary scalar inputs even though moving the same value through a temporary makes them work. Allow these numeric tags while retaining the descriptor and pointer refusals.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4688048703 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2040#discussion_r4688048703). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T23:36:35Z. **Code review location:** `tools/startup/gfx2hlsl.py`; line 953 ~~~~diff @@ -932,6 +932,66 @@ def op_s_bfm_b32(self, ops, mods): self.set_s(d, '(((1u << (%s & 31)) - 1) << (%s & 31))' % (self.u(ops[1]), self.u(ops[2]))) return None + def scalar_word_dest(self, base, tok): + """Destination of a whole-word scalar op that reads and writes a full 32-bit value: an SGPR or m0.""" + if tok == 'm0': + return 'm0' + r = reg_range(tok) + if not r or r[0] != 's' or r[1] != r[2] or r[1] > 105: + raise Unsupported('%s destination %s' % (base, tok)) + return r[1] + + def scalar_word_sources(self, base, toks): + """uint expressions for whole-word sources: lane masks and descriptor data have no full word to read.""" + out = [] + for t in toks: + r = reg_range(t) + if t in ('exec', 'exec_lo', 'exec_hi', 'vcc', 'vcc_lo', 'vcc_hi') or (r and r[0] == 's' and r[1] in self.masks): + raise Unsupported('%s on a lane mask' % base) + sym = self.sym.get(r[1]) if r and r[0] == 's' else None + if sym and sym[0] != 'const': + raise Unsupported('%s on descriptor data' % base) ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Allow numeric symbolic values through the source validator** When an operand is a root constant or a value read by a literal-offset `s_buffer_load_dword*`, its symbolic tag is `ud` or `fixed_buffer_word`; both already represent complete numeric values supported by `Stage.S()`. This check incorrectly classifies them as descriptor data. For example, `s_lshl2_add_u32 s4, s8, s3` raises `Unsupported` when `s8` holds a root constant, and `s_bitset0_b32` similarly rejects a numeric root-constant destination. The new operations therefore reject ordinary scalar inputs even though moving the same value through a temporary makes them work. Allow these numeric tags while retaining the descriptor and pointer refusals. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
tedin7 commented 2026-11-25 01:02:19 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T00:57:41Z.

Code review location: tools/startup/gfx2hlsl.py; line 1822

@@ -1758,6 +1818,8 @@ def declarations(self):
     's_min_i32': ('uint(min(int({0}), int({1})))', None), 's_max_i32': ('uint(max(int({0}), int({1})))', None),
     's_bfe_u32': ('({0} >> ({1} & 31)) & ((1u << (({1} >> 16) & 127)) - 1)', '$ != 0'),
     's_brev_b32': ('reversebits({0})', None),
+    # s_ff0_i32_b32: index of the lowest zero bit, -1 when every bit is set; SCC unchanged.
+    's_ff0_i32_b32': ('uint(firstbitlow(~{0}))', None),

Fixed in 10ec331e (rebased on main, push pending): s_ff0_i32_b32 now refuses lane-mask sources (exec/vcc/copied masks); test added.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4688732542 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2040#discussion_r4688732542). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T00:57:41Z. **Code review location:** `tools/startup/gfx2hlsl.py`; line 1822 ~~~~diff @@ -1758,6 +1818,8 @@ def declarations(self): 's_min_i32': ('uint(min(int({0}), int({1})))', None), 's_max_i32': ('uint(max(int({0}), int({1})))', None), 's_bfe_u32': ('({0} >> ({1} & 31)) & ((1u << (({1} >> 16) & 127)) - 1)', '$ != 0'), 's_brev_b32': ('reversebits({0})', None), + # s_ff0_i32_b32: index of the lowest zero bit, -1 when every bit is set; SCC unchanged. + 's_ff0_i32_b32': ('uint(firstbitlow(~{0}))', None), ~~~~ --- Fixed in 10ec331e (rebased on main, push pending): s_ff0_i32_b32 now refuses lane-mask sources (exec/vcc/copied masks); test added.
tedin7 commented 2026-11-25 01:02:19 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T00:57:43Z.

Code review location: tools/startup/gfx2hlsl.py; line 953

@@ -932,6 +932,66 @@ def op_s_bfm_b32(self, ops, mods):
         self.set_s(d, '(((1u << (%s & 31)) - 1) << (%s & 31))' % (self.u(ops[1]), self.u(ops[2])))
         return None
 
+    def scalar_word_dest(self, base, tok):
+        """Destination of a whole-word scalar op that reads and writes a full 32-bit value: an SGPR or m0."""
+        if tok == 'm0':
+            return 'm0'
+        r = reg_range(tok)
+        if not r or r[0] != 's' or r[1] != r[2] or r[1] > 105:
+            raise Unsupported('%s destination %s' % (base, tok))
+        return r[1]
+
+    def scalar_word_sources(self, base, toks):
+        """uint expressions for whole-word sources: lane masks and descriptor data have no full word to read."""
+        out = []
+        for t in toks:
+            r = reg_range(t)
+            if t in ('exec', 'exec_lo', 'exec_hi', 'vcc', 'vcc_lo', 'vcc_hi') or (r and r[0] == 's' and r[1] in self.masks):
+                raise Unsupported('%s on a lane mask' % base)
+            sym = self.sym.get(r[1]) if r and r[0] == 's' else None
+            if sym and sym[0] != 'const':
+                raise Unsupported('%s on descriptor data' % base)

Fixed in 10ec331e (rebased on main, push pending): ud and fixed_buffer_word symbols are now accepted as numeric sources; test added.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4688732733 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2040#discussion_r4688732733). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T00:57:43Z. **Code review location:** `tools/startup/gfx2hlsl.py`; line 953 ~~~~diff @@ -932,6 +932,66 @@ def op_s_bfm_b32(self, ops, mods): self.set_s(d, '(((1u << (%s & 31)) - 1) << (%s & 31))' % (self.u(ops[1]), self.u(ops[2]))) return None + def scalar_word_dest(self, base, tok): + """Destination of a whole-word scalar op that reads and writes a full 32-bit value: an SGPR or m0.""" + if tok == 'm0': + return 'm0' + r = reg_range(tok) + if not r or r[0] != 's' or r[1] != r[2] or r[1] > 105: + raise Unsupported('%s destination %s' % (base, tok)) + return r[1] + + def scalar_word_sources(self, base, toks): + """uint expressions for whole-word sources: lane masks and descriptor data have no full word to read.""" + out = [] + for t in toks: + r = reg_range(t) + if t in ('exec', 'exec_lo', 'exec_hi', 'vcc', 'vcc_lo', 'vcc_hi') or (r and r[0] == 's' and r[1] in self.masks): + raise Unsupported('%s on a lane mask' % base) + sym = self.sym.get(r[1]) if r and r[0] == 's' else None + if sym and sym[0] != 'const': + raise Unsupported('%s on descriptor data' % base) ~~~~ --- Fixed in 10ec331e (rebased on main, push pending): ud and fixed_buffer_word symbols are now accepted as numeric sources; test added.
upstream-sync closed this pull request 2026-11-25 14:04:31 +00:00
tedin7 commented 2026-11-25 14:05:14 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T13:51:52Z.


Closing this PR for now to keep the Windows test queue short. Nothing is wrong with it and the branch stays as it is.

We will reopen it once the queue is clear, re-run the Win2025 WARP checks at its head, and post the result here.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7164401022 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2040#issuecomment-7164401022). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T13:51:52Z. --- Closing this PR for now to keep the Windows test queue short. Nothing is wrong with it and the branch stays as it is. We will reopen it once the queue is clear, re-run the Win2025 WARP checks at its head, and post the result here. AI-assisted; commands listed were executed locally.

Pull request closed

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!2033
No description provided.