cpp-migration: lower v_ashrrev_i64 and v_mad_i32_i24 in the direct C++ compute path #2991

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

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


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 lowers the unsigned or logical forms but refuses their signed counterparts. Both fail with direct DXIL lowering for <name> in the same per-opcode VOP3 probe as #2985 (cpp-migration 05438d65):

  • v_ashrrev_i64, next to the v_lshrrev_b64 / v_lshlrev_b64 lowering from #2952.
  • v_mad_i32_i24, next to v_mad_u32_u24.

gfx2hlsl.py lowers both: op_v_ashrrev_i64 through shift64 with i64_words(..., signed=True), and 'v_mad_i32_i24' in its VOP3 table.

Plan:

  • v_ashrrev_i64: the shifted-value rules of the logical shifts, with the gfx2hlsl.py source rule for the signed form. A 32-bit literal is sign-extended to 64 bits instead of zero-extended. Then an arithmetic ashr i64 by S0[5:0].
  • v_mad_i32_i24: sext(S0[23:0]) * sext(S1[23:0]) + S2, modulo 2^32.
  • Fixture: a source-built dispatch against a CPU reference, with a negative SGPR pair, a negative literal, inline -1 and shift amounts 0, 1, 31, 32, 63. Zero-extended and logical-shift references must differ. For the multiply-add, the operands have bit 23 set and nonzero bits above it, and an unsigned reference must differ.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6639351629 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2991). Originally posted by [legacy-code-archaeologist](https://github.com/legacy-code-archaeologist) on 2026-11-27T03:29:52Z. --- 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 lowers the unsigned or logical forms but refuses their signed counterparts. Both fail with `direct DXIL lowering for <name>` in the same per-opcode VOP3 probe as #2985 (`cpp-migration` `05438d65`): - `v_ashrrev_i64`, next to the `v_lshrrev_b64` / `v_lshlrev_b64` lowering from #2952. - `v_mad_i32_i24`, next to `v_mad_u32_u24`. `gfx2hlsl.py` lowers both: `op_v_ashrrev_i64` through `shift64` with `i64_words(..., signed=True)`, and `'v_mad_i32_i24'` in its VOP3 table. **Plan:** - `v_ashrrev_i64`: the shifted-value rules of the logical shifts, with the `gfx2hlsl.py` source rule for the signed form. A 32-bit literal is sign-extended to 64 bits instead of zero-extended. Then an arithmetic `ashr i64` by S0[5:0]. - `v_mad_i32_i24`: sext(S0[23:0]) * sext(S1[23:0]) + S2, modulo 2^32. - Fixture: a source-built dispatch against a CPU reference, with a negative SGPR pair, a negative literal, inline -1 and shift amounts 0, 1, 31, 32, 63. Zero-extended and logical-shift references must differ. For the multiply-add, the operands have bit 23 set and nonzero bits above it, and an unsigned reference must differ. AI-assisted.
MasterDomino commented 2026-11-27 03:47:23 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-27T03:47:23Z.


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

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7209272969 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/2991#issuecomment-7209272969). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-27T03:47:23Z. --- Completed by #2994, merged into `cpp-migration` as c6908cce. 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#2991
No description provided.