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

Merged
tedin7 merged 1 commit from upstream-pr/117 into main 2026-11-24 07:51:06 +00:00
tedin7 commented 2026-11-24 00:39:48 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by tedin7 on 2026-11-24T00:39:48Z.


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.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6571922122 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/117). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T00:39:48Z. --- 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.
lordon1a commented 2026-11-24 06:54:45 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by lordon1a on 2026-11-24T00:51:46Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7118512702 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/117#issuecomment-7118512702). Originally posted by [lordon1a](https://github.com/lordon1a) on 2026-11-24T00:51:46Z. --- 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.
DaviTostes commented 2026-11-24 06:54:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DaviTostes on 2026-11-24T01:10:02Z.


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.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7118824298 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/117#issuecomment-7118824298). Originally posted by [DaviTostes](https://github.com/DaviTostes) on 2026-11-24T01:10:02Z. --- 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.
upstream-sync closed this pull request 2026-11-24 08:01:48 +00:00
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
Marvisak/VIctory!117
No description provided.