Shaders: lower v_mul_hi_u32_u24 and v_mul_hi_i32_i24 (port of VIctory#156) #56

Closed
lcg007xd-c wants to merge 0 commits from upstream-pr/56 into main
lcg007xd-c commented 2026-11-25 20:57:26 +00:00 (Migrated from github.com)

Imported from uiliannn/VItoriaBr. Originally posted by lcg007xd-c on 2026-11-25T20:57:26Z.


What

v_mul_hi_u32_u24 and v_mul_hi_i32_i24 (VOP2 0x0C / 0x0A) had no lowering, so any shader that used them failed to translate. Their low-dword partners v_mul_u32_u24 / v_mul_i32_i24 were already lowered.

They now give the high dword of the same 48-bit product. Each operand's low 24 bits are zero- or sign-extended, then go through the existing mul_hi.

Port

Cherry-pick (-x) of github.com/Marvisak/VIctory@344704e from upstream. Rareuncommon is still the commit author. It applied cleanly. It also adds a small lowers_valu test helper: a one-thread compute program that stores v0, so a VALU instruction can be checked for lowering without a GPU.

Test

the_24_bit_multiplies_lower_both_halves lowers all four 24-bit multiplies. With the new match arm reverted it fails (v_mul_hi_* is unsupported). With it, it passes.

How this was checked (Linux, no Windows PC or game files)

  • The portable CI commands pass locally on this branch: cargo clippy -p victory-core -p victory-pe -p victory-pipeline -p victory-shader -p victory-formats -p victory-game -p xtask --all-targets --locked -- -D warnings, then cargo test on the same crates (rebased on current main).
  • cargo clippy with the same crates and --target x86_64-pc-windows-msvc (check only, no link) is clean.
  • lower.rs has the same number of rustfmt differences before and after this change, so the added code is rustfmt-clean.

Not tested: Windows runtime, GPU, and the game itself. In particular, the numeric results were not run on a GPU here. The new test only proves the instructions now lower, and Windows CI validates the module where dxil.dll is available.

🤖 Generated with Claude Code

<!-- greyfinch-sync:uiliannn/VItoriaBr:issue:5499054064 --> Imported from [uiliannn/VItoriaBr](https://github.com/uiliannn/VitoriaBr2.0/pull/56). Originally posted by [lcg007xd-c](https://github.com/lcg007xd-c) on 2026-11-25T20:57:26Z. --- ## What `v_mul_hi_u32_u24` and `v_mul_hi_i32_i24` (VOP2 0x0C / 0x0A) had no lowering, so any shader that used them failed to translate. Their low-dword partners `v_mul_u32_u24` / `v_mul_i32_i24` were already lowered. They now give the high dword of the same 48-bit product. Each operand's low 24 bits are zero- or sign-extended, then go through the existing `mul_hi`. ## Port Cherry-pick (`-x`) of https://github.com/Marvisak/VIctory/commit/344704e from upstream. Rareuncommon is still the commit author. It applied cleanly. It also adds a small `lowers_valu` test helper: a one-thread compute program that stores `v0`, so a VALU instruction can be checked for lowering without a GPU. ## Test `the_24_bit_multiplies_lower_both_halves` lowers all four 24-bit multiplies. With the new match arm reverted it fails (`v_mul_hi_*` is unsupported). With it, it passes. ## How this was checked (Linux, no Windows PC or game files) - The portable CI commands pass locally on this branch: `cargo clippy -p victory-core -p victory-pe -p victory-pipeline -p victory-shader -p victory-formats -p victory-game -p xtask --all-targets --locked -- -D warnings`, then `cargo test` on the same crates (rebased on current `main`). - `cargo clippy` with the same crates and `--target x86_64-pc-windows-msvc` (check only, no link) is clean. - `lower.rs` has the same number of `rustfmt` differences before and after this change, so the added code is rustfmt-clean. Not tested: Windows runtime, GPU, and the game itself. In particular, the numeric results were not run on a GPU here. The new test only proves the instructions now lower, and Windows CI validates the module where `dxil.dll` is available. 🤖 Generated with [Claude Code](https://claude.com/claude-code)

Pull request closed

Sign in to join this conversation.
No reviewers
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
uiliannn/VItoriaBr!56
No description provided.