shader: lower neg(N) operand modifier in gfx2hlsl (Part of #1723) #2037

Manually merged
github merged 1 commit from gh-pr/2037/head into gh-pr/2037/base 2026-11-26 23:51:22 +00:00
Owner

@⁠tedin7 on GitHub · 2026-11-24 23:32 UTC · original
tedin7:x2w-r20-neg-operand → main · +113 −8 · 3 files · 1 commits · merged 2026-11-25 01:28 UTC

Part of #1723

What this unblocks: Run 20 census #14 (43 pairs) refused with operand 'neg(...)'.

LLVM prints a lone negation of a numeric operand as neg(x), so that -1 is not read as the integer. gfx2hlsl only knew the -x spelling. A shared helper now reads both: neg(x) is the sign bit flipped (^ 0x80000000u on integer selects, a float negation on float ops and compares). -1 stays the integer. Integer ops that do not model a negation still refuse it. New test startup_gfx2hlsl_neg_operand (registered in CMakeLists.txt).

Verification:

  • python3 -B tests/startup_gfx2hlsl_neg_operand_check.py -> PASS (on origin/main the same test fails with Unsupported: operand 'neg(v30)')
  • All 25 tests/startup_gfx2hlsl*_check.py scripts run with python3 -B -> exit 0
  • Not run: a Win2025 build; the change is Python only.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-24 23:32 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2037) `tedin7:x2w-r20-neg-operand` → `main` · +113 −8 · 3 files · 1 commits · merged 2026-11-25 01:28 UTC Part of #1723 What this unblocks: Run 20 census #14 (43 pairs) refused with `operand 'neg(...)'`. LLVM prints a lone negation of a numeric operand as `neg(x)`, so that `-1` is not read as the integer. gfx2hlsl only knew the `-x` spelling. A shared helper now reads both: `neg(x)` is the sign bit flipped (`^ 0x80000000u` on integer selects, a float negation on float ops and compares). `-1` stays the integer. Integer ops that do not model a negation still refuse it. New test `startup_gfx2hlsl_neg_operand` (registered in CMakeLists.txt). Verification: - `python3 -B tests/startup_gfx2hlsl_neg_operand_check.py` -> PASS (on origin/main the same test fails with `Unsupported: operand 'neg(v30)'`) - All 25 `tests/startup_gfx2hlsl*_check.py` scripts run with `python3 -B` -> exit 0 - Not run: a Win2025 build; the change is Python only. AI-assisted; commands listed were executed locally.
Part of #1723. neg(x) is the sign bit flipped, like -x, and was refused as an unknown operand.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:51:20 +00:00
github manually merged commit 439c720125 into gh-pr/2037/base 2026-11-26 23:51:22 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 23:32 UTC · original · edited 2026-11-24 23:35 UTC

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:35:47.173621Z 8a290f6 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.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 23:32 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2037#issuecomment-7147512359) · edited 2026-11-24 23:35 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"8a290f6cec4dfd8a1d845db1af1ec7f461cc4085","has_any_findings":false,"has_unresolved_findings":false,"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:35:47.173621Z">2026-11-24T23:35:47.173621Z</relative-time> | `8a290f6` | 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>
This discussion has been locked. Commenting is limited to contributors.
No description provided.