cpp-migration: lower v_cvt_pk_u16_u32 and v_cvt_pk_i16_i32 in the direct C++ compute path #2995

Closed
opened 2026-11-27 03:37:23 +00:00 by legacy-code-archaeologist · 1 comment
legacy-code-archaeologist commented 2026-11-27 03:37:23 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by legacy-code-archaeologist on 2026-11-27T03:37:23Z.


Target branch cpp-migration. Part of #2935 (instruction coverage: integer ALU). I am taking this; please say if you already have it locally and I will drop it.

Gap: the direct compute path refuses v_cvt_pk_u16_u32 and v_cvt_pk_i16_i32 with direct DXIL lowering for <name>. I found this with the same per-opcode VOP3 probe as #2985, on cpp-migration 05438d65. gfx2hlsl.py lowers both in its VOP3 table:

  • v_cvt_pk_u16_u32: min(S0, 0xffff) | min(S1, 0xffff) << 16.
  • v_cvt_pk_i16_i32: each source clamped to [-32768, 32767] as a signed value, then packed as 16 bits.

It refuses a nonzero unused SRC2 field.

Plan:

  • The same expressions, with unsigned and signed compares.
  • Modifiers stay refused, as for the other integer VOP3 forms.
  • A nonzero SRC2 field is refused, as in gfx2hlsl.py.
  • Fixture: a source-built dispatch whose per-lane operands cross both bounds (0, 0xffff, 0x10000, 0xffffffff, -32768, -32769, 32767, 32768) against a CPU reference. References that truncate instead of saturating, or that use the unsigned bound for the signed form, must differ. A SRC2-field control is refused.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6639428437 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2995). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-27T03:37:23Z. --- Target branch `cpp-migration`. Part of #2935 (instruction coverage: integer ALU). I am taking this; please say if you already have it locally and I will drop it. **Gap:** the direct compute path refuses `v_cvt_pk_u16_u32` and `v_cvt_pk_i16_i32` with `direct DXIL lowering for <name>`. I found this with the same per-opcode VOP3 probe as #2985, on `cpp-migration` `05438d65`. `gfx2hlsl.py` lowers both in its VOP3 table: - `v_cvt_pk_u16_u32`: `min(S0, 0xffff) | min(S1, 0xffff) << 16`. - `v_cvt_pk_i16_i32`: each source clamped to [-32768, 32767] as a signed value, then packed as 16 bits. It refuses a nonzero unused SRC2 field. **Plan:** - The same expressions, with unsigned and signed compares. - Modifiers stay refused, as for the other integer VOP3 forms. - A nonzero SRC2 field is refused, as in `gfx2hlsl.py`. - Fixture: a source-built dispatch whose per-lane operands cross both bounds (0, 0xffff, 0x10000, 0xffffffff, -32768, -32769, 32767, 32768) against a CPU reference. References that truncate instead of saturating, or that use the unsigned bound for the signed form, must differ. A SRC2-field control is refused. AI-assisted.
MasterDomino commented 2026-11-27 04:35:57 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-27T04:35:57Z.


Completed by #2996, merged into cpp-migration as 4701650d. Merges into a non-default branch do not close issues automatically.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7209929468 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2995#issuecomment-7209929468). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-27T04:35:57Z. --- Completed by #2996, merged into `cpp-migration` as 4701650d. Merges into a non-default branch do not close issues automatically.
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#2995
No description provided.