shader: lower 8 ternary integer ALU instructions in pixel_aot (VOP3) #760

Merged
MrSkelee merged 2 commits from upstream-pr/766 into main 2026-11-23 03:11:30 +00:00
MrSkelee commented 2026-11-23 01:48:10 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by MrSkelee on 2026-11-23T01:48:10Z.


Lowers 8 ternary 32-bit integer and bitwise vector ALU instructions in tools/pixel_aot.py (VOP3):

  • v_add3_u32: (src0 + src1 + src2)
  • v_or3_b32: (src0 | src1 | src2)
  • v_xor3_b32: (src0 ^ src1 ^ src2)
  • v_and_or_b32: ((src0 & src1) | src2)
  • v_xad_u32: ((src0 ^ src1) + src2)
  • v_lshl_or_b32: ((src0 << (src1 & 31)) | src2)
  • v_lshl_add_u32: ((src0 << (src1 & 31)) + src2)
  • v_add_lshl_u32: ((src0 + src1) << (src2 & 31))

Highlights

  • Operand Validation & Rejection Controls: Enforces arity 3, rejects invalid _e32 encodings, out-of-range registers (> v255), and float modifiers (abs, -, clamp).
  • Binary Roundtrip: Added both groups to check_binary() for LLVM 15 assembly and disassembly validation.
  • Offscreen Readback (WARP & Hardware): Added dedicated check_vop3_ternary_int_draws testing 60 parameter cases across two groups with aliased destination/source registers, 1-bit mutation detection, and negative control verification.

Verification

ctest --preset dev -R "pixel_aot_vop3_ternary_int_warp" -V
ctest --preset release -R "pixel_aot_vop3_ternary_int_warp" -V
python -B tests/rdna2_tools_check.py
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6550604271 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/766). Originally posted by [MrSkelee](https://github.com/MrSkelee) on 2026-11-23T01:48:10Z. --- Lowers 8 ternary 32-bit integer and bitwise vector ALU instructions in `tools/pixel_aot.py` (VOP3): - `v_add3_u32`: `(src0 + src1 + src2)` - `v_or3_b32`: `(src0 | src1 | src2)` - `v_xor3_b32`: `(src0 ^ src1 ^ src2)` - `v_and_or_b32`: `((src0 & src1) | src2)` - `v_xad_u32`: `((src0 ^ src1) + src2)` - `v_lshl_or_b32`: `((src0 << (src1 & 31)) | src2)` - `v_lshl_add_u32`: `((src0 << (src1 & 31)) + src2)` - `v_add_lshl_u32`: `((src0 + src1) << (src2 & 31))` ### Highlights - **Operand Validation & Rejection Controls**: Enforces arity 3, rejects invalid `_e32` encodings, out-of-range registers (> v255), and float modifiers (`abs`, `-`, `clamp`). - **Binary Roundtrip**: Added both groups to `check_binary()` for LLVM 15 assembly and disassembly validation. - **Offscreen Readback (WARP & Hardware)**: Added dedicated `check_vop3_ternary_int_draws` testing 60 parameter cases across two groups with aliased destination/source registers, 1-bit mutation detection, and negative control verification. ### Verification ```powershell ctest --preset dev -R "pixel_aot_vop3_ternary_int_warp" -V ctest --preset release -R "pixel_aot_vop3_ternary_int_warp" -V python -B tests/rdna2_tools_check.py ```
upstream-sync closed this pull request 2026-11-24 06:44:41 +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!760
No description provided.