Shaders: lower s_bitcmp0/1_b32 and s_bitcmp0/1_b64 #117

Manually merged
github merged 1 commit from gh-pr/117/head into gh-pr/117/base 2026-11-26 03:50:55 +00:00
Owner

@⁠tedin7 on GitHub · 2026-11-24 00:39 UTC · original
tedin7:vic-s-bitcmp-2 → main · +52 −0 · 1 files · 1 commits · merged 2026-11-24 07:51 UTC

What

  • Lowers s_bitcmp0_b32, s_bitcmp1_b32, s_bitcmp0_b64 and s_bitcmp1_b64. SCC becomes whether bit src1 (mod 32, mod 64 for the 64-bit forms) of src0 is clear (bitcmp0) or set (bitcmp1).

Why

  • The instructions decode and ir.rs already tracks them as SCC writers, but sop() had no case for them. Any shader using one failed to translate with Unsupported.

Tested

  • Linux x86_64 only. Commands run:
    • cargo test -j4 -p victory-shader scalar_bit_tests_lower with the lowering disabled (test only): fails with Unsupported { offset: 8, what: "s_bitcmp0_b32" }.
    • cargo test -j4 -p victory-shader after the change: 56 passed (origin/main 237f2e8), 0 failed (the new test included).
    • cargo clippy -j4 -p victory-shader --tests: no new warnings (existing: dead_code constant_color in emit/mod.rs, a boolean-simplification note in resource.rs).
    • rustfmt --edition 2024 --check on lower.rs: clean.
  • The test uses synthetic machine code (no game data) and checks that lowering succeeds, not the emitted DXIL values.
  • NOT run: Windows runtime, GPU, or a real console shader.
  • The test reuses the existing lowers() helper in the tests module.
**@⁠tedin7** on GitHub · 2026-11-24 00:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/117) `tedin7:vic-s-bitcmp-2` → `main` · +52 −0 · 1 files · 1 commits · merged 2026-11-24 07:51 UTC What - Lowers `s_bitcmp0_b32`, `s_bitcmp1_b32`, `s_bitcmp0_b64` and `s_bitcmp1_b64`. SCC becomes whether bit `src1` (mod 32, mod 64 for the 64-bit forms) of `src0` is clear (bitcmp0) or set (bitcmp1). Why - The instructions decode and ir.rs already tracks them as SCC writers, but `sop()` had no case for them. Any shader using one failed to translate with `Unsupported`. Tested - Linux x86_64 only. Commands run: - `cargo test -j4 -p victory-shader scalar_bit_tests_lower` with the lowering disabled (test only): fails with `Unsupported { offset: 8, what: "s_bitcmp0_b32" }`. - `cargo test -j4 -p victory-shader` after the change: 56 passed (origin/main 237f2e8), 0 failed (the new test included). - `cargo clippy -j4 -p victory-shader --tests`: no new warnings (existing: dead_code `constant_color` in emit/mod.rs, a boolean-simplification note in resource.rs). - `rustfmt --edition 2024 --check` on lower.rs: clean. - The test uses synthetic machine code (no game data) and checks that lowering succeeds, not the emitted DXIL values. - NOT run: Windows runtime, GPU, or a real console shader. - The test reuses the existing `lowers()` helper in the tests module.
The scalar bit tests decode and are tracked in ir.rs (they write SCC) but the lowering had no case for them, so any shader using one failed to translate with Unsupported.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:50:54 +00:00
github manually merged commit 3c860538e1 into gh-pr/117/base 2026-11-26 03:50:55 +00:00
Author
Owner

@⁠lordon1a on GitHub · 2026-11-24 00:51 UTC · original

Verified 3c860538e on Windows 11 (x86_64-pc-windows-gnullvm, rustc 1.100.0, applied cleanly to main@4c0bb89): pass.

  • cargo xtask policy: 151 files ok
  • cargo test -p victory-shader -- --skip v_med3_f32_matches_rdna2_with_nan: 69 passed, 0 failed.

AI-assisted.

**@⁠lordon1a** on GitHub · 2026-11-24 00:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/117#issuecomment-7118512702) Verified `3c860538e` on Windows 11 (`x86_64-pc-windows-gnullvm`, `rustc 1.100.0`, applied cleanly to `main@4c0bb89`): **pass**. - `cargo xtask policy`: 151 files ok - `cargo test -p victory-shader -- --skip v_med3_f32_matches_rdna2_with_nan`: **69 passed, 0 failed**. AI-assisted.
Author
Owner

@⁠DaviTostes on GitHub · 2026-11-24 01:10 UTC · original

Tested 3c86053 on Arch Linux x86_64, rustc 1.98.1: pass.

  • cargo test -p victory-shader: 56 passed, 0 failed (2 test binaries), including the 1 test this PR adds.
  • Scope note: #142 also lowers s_bitcmp0/1_b32/s_bitcmp0/1_b64 (and s_sext), and is open; one of the two should be closed.
  • The full workspace still needs #112 for the victory-gpu E0425.
**@⁠DaviTostes** on GitHub · 2026-11-24 01:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/117#issuecomment-7118824298) Tested `3c86053` on **Arch Linux x86_64, rustc 1.98.1**: **pass**. - `cargo test -p victory-shader`: **56 passed, 0 failed** (2 test binaries), including the 1 test this PR adds. - Scope note: #142 also lowers `s_bitcmp0/1_b32`/`s_bitcmp0/1_b64` (and `s_sext`), and is open; one of the two should be closed. - The full workspace still needs #112 for the `victory-gpu` E0425.
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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/Marvisak--VIctory!117
No description provided.