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:45:49 +00:00 by github-bot · 0 comments
Owner

@⁠legacy-code-archaeologist on GitHub · 2026-11-27 04:40 UTC · original

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.

**@⁠legacy-code-archaeologist** on GitHub · 2026-11-27 04:40 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/3009) 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 04:45:49 +00:00
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/R0Y00--Xbox2Windows#3009
No description provided.