cpp-migration: lower v_add_nc_i32, v_sub_nc_i32 and clamped 32-bit add/sub in the direct compute path #3009

Closed
opened 2026-11-27 04:40:57 +00:00 by legacy-code-archaeologist · 0 comments
legacy-code-archaeologist commented 2026-11-27 04:40:57 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-27T04:40:57Z.


Part of the instruction-coverage item of #2935, found with the same per-opcode VOP3 probe as #2985.

The direct C++ compute path refuses:

  • v_add_nc_i32 and v_sub_nc_i32 (VOP3 only), with direct DXIL lowering for <name>;
  • the clamp forms of v_add_nc_u32, v_sub_nc_u32 and v_subrev_nc_u32, with direct ALU operand modifiers.

LLVM 15 emits these forms for saturating arithmetic. llvm.sadd.sat.i32, llvm.ssub.sat.i32, llvm.uadd.sat.i32 and llvm.usub.sat.i32 select v_add_nc_i32 … clamp, v_sub_nc_i32 … clamp, v_add_nc_u32_e64 … clamp and v_sub_nc_u32_e64 … clamp for gfx1013.

Proposed:

  • Wrap without clamp.
  • With clamp, saturate: signed for _i32, unsigned for _u32.
  • Refuse neg/abs, omod, op_sel, SDWA and DPP forms.
  • Add a controls/hardware fixture at the i32/u32 edges with mutant references.

I am taking it. AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6640099225 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3009). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-27T04:40:57Z. --- Part of the instruction-coverage item of #2935, found with the same per-opcode VOP3 probe as #2985. The direct C++ compute path refuses: - `v_add_nc_i32` and `v_sub_nc_i32` (VOP3 only), with `direct DXIL lowering for <name>`; - the `clamp` forms of `v_add_nc_u32`, `v_sub_nc_u32` and `v_subrev_nc_u32`, with `direct ALU operand modifiers`. LLVM 15 emits these forms for saturating arithmetic. `llvm.sadd.sat.i32`, `llvm.ssub.sat.i32`, `llvm.uadd.sat.i32` and `llvm.usub.sat.i32` select `v_add_nc_i32 … clamp`, `v_sub_nc_i32 … clamp`, `v_add_nc_u32_e64 … clamp` and `v_sub_nc_u32_e64 … clamp` for gfx1013. Proposed: - Wrap without clamp. - With clamp, saturate: signed for `_i32`, unsigned for `_u32`. - Refuse neg/abs, omod, op_sel, SDWA and DPP forms. - Add a controls/hardware fixture at the i32/u32 edges with mutant references. I am taking it. AI-assisted.
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#3009
No description provided.