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

Closed
opened 2026-11-27 03:34:03 +00:00 by github-bot · 1 comment
Owner

@⁠legacy-code-archaeologist on GitHub · 2026-11-27 03:29 UTC · original

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.

**@⁠legacy-code-archaeologist** on GitHub · 2026-11-27 03:29 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/2991) 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 03:34:03 +00:00
Author
Owner

@⁠MasterDomino on GitHub · 2026-11-27 03:47 UTC · original

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

**@⁠MasterDomino** on GitHub · 2026-11-27 03:47 UTC · [original](https://github.com/R0Y00/Xbox2Windows/issues/2991#issuecomment-7209272969) Completed by #2994, merged into `cpp-migration` as c6908cce. Merges into a non-default branch do not close issues automatically.
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#2991
No description provided.