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

Merged
tedin7 merged 1 commit from upstream-pr/2037 into main 2026-11-25 01:28:58 +00:00
tedin7 commented 2026-11-24 23:32:07 +00:00 (Migrated from github.com)

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


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6593562134 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2037). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T23:32:07Z. --- 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.
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:17Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147512359 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2037#issuecomment-7147512359). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T23:32:17Z. --- <!-- 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>
upstream-sync closed this pull request 2026-11-25 02:01:29 +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!2030
No description provided.