shader: SCC after s_min/s_max is the comparison, after s_lshlN_add_u32 the carry (stacked on #62) #88

Open
github-bot wants to merge 6 commits from github-bot/gh-88 into main AGit
Owner

@⁠lcg007xd-c on GitHub · 2026-11-25 22:19 UTC · original
lcg007xd-c:shader-salu-scc → main · +1137 −3 · 4 files · 6 commits · open

Stacked on #62 (the CPU harness), whose two commits are the first two here. The fix is the last commit. Merge #62 first, and this one then shows only its own change.

What is broken

The scalar lowering (sop in emit/lower.rs) sets SCC to result != 0 for every SCC-writing operation it does not name. AMD's RDNA2 ISA gives two families a different SCC:

  • s_min_i32/s_min_u32/s_max_i32/s_max_u32 (SOP2 6–9): SCC = (S0 < S1) for min, SCC = (S0 > S1) for max.
  • s_lshl1_add_u32 … s_lshl4_add_u32 (SOP2 46–49): SCC = ((S0 << N) + S1) >= 2^32, "unsigned overflow". That is the carry out of the add, like s_add_u32's. Mesa's ACO confirms the reading: it fuses s_add_u32(a, s_lshl_b32(b, n)) into s_lshlN_add_u32 even when s_add_u32's carry is used (aco_optimizer.cpp), but s_add_i32 only when its SCC is unused.

So s_min_u32 s12, 5, 3 followed by s_cselect_b32 or s_cbranch_scc1 took the wrong side.

Found with the CPU harness (#62): I ran op s12, s0, s1; s_cselect_b32 s13, 1, 0; v_mov_b32 v0, s13 for each op on main.

  • min/max: 16 of 24 cases gave the wrong SCC, for example s_min_i32 case 0 [5, 3]: got 1, want 0.
  • lshl-add: s_lshl1_add_u32 gave SCC = 1 for 1 << 1 + 1, where nothing overflows.

The change (emit/lower.rs, in sop)

  • s_min/s_max: the comparison that already picks the result is now also SCC.
  • s_lshlN_add_u32: SCC is the carry of the 32-bit add, r < (a << N). Bits shifted out of the 32-bit shift do not count, which matches ACO's fusion.

Tests

  • emit::cpu_tests::scalar_min_max_set_scc_to_the_comparison and scalar_shift_adds_set_scc_to_the_carry (Linux, through #62's harness):

    • six input pairs per min/max op (both orders, zero, u32::MAX vs 1 signed and unsigned, equal);
    • five pairs for s_lshl1/s_lshl4_add_u32, including a shifted-out bit with no carry and a real carry.

    Both fail without the fix (s_min_i32 case 0 [5, 3]: got 0x00000001, want 0x00000000, s_lshl1_add_u32 case 0 [1, 1]: got 0x00000001, want 0x00000000) and pass with it.

  • valu_tests::scalar_min_max_and_shift_add_set_scc_like_rdna2 (Windows/GPU): the same program shape and checks on the GPU.

Run here (Linux, Rust 1.98.1, LLVM 23):

  • cargo test -p victory-shader --lib --locked: 200 passed, 0 failed, 2 ignored.
  • Portable clippy and CARGO_FEATURE_PURE=1 cargo clippy -p victory-shader --all-targets --target x86_64-pc-windows-msvc -- -D warnings: clean.

Not run here: the GPU case, since I have no Windows machine.

🤖 Generated with Claude Code

**@⁠lcg007xd-c** on GitHub · 2026-11-25 22:19 UTC · [original](https://github.com/uiliannn/VItoriaBr/pull/88) `lcg007xd-c:shader-salu-scc` → `main` · +1137 −3 · 4 files · 6 commits · open > **Stacked on #62** (the CPU harness), whose two commits are the first two here. The fix is the last commit. Merge #62 first, and this one then shows only its own change. ## What is broken The scalar lowering (`sop` in `emit/lower.rs`) sets SCC to `result != 0` for every SCC-writing operation it does not name. AMD's RDNA2 ISA gives two families a different SCC: - **`s_min_i32`/`s_min_u32`/`s_max_i32`/`s_max_u32`** (SOP2 6–9): `SCC = (S0 < S1)` for min, `SCC = (S0 > S1)` for max. - **`s_lshl1_add_u32` … `s_lshl4_add_u32`** (SOP2 46–49): `SCC = ((S0 << N) + S1) >= 2^32`, "unsigned overflow". That is the carry out of the add, like `s_add_u32`'s. Mesa's ACO confirms the reading: it fuses `s_add_u32(a, s_lshl_b32(b, n))` into `s_lshlN_add_u32` even when `s_add_u32`'s carry is used (`aco_optimizer.cpp`), but `s_add_i32` only when its SCC is unused. So `s_min_u32 s12, 5, 3` followed by `s_cselect_b32` or `s_cbranch_scc1` took the wrong side. **Found with the CPU harness (#62):** I ran `op s12, s0, s1; s_cselect_b32 s13, 1, 0; v_mov_b32 v0, s13` for each op on main. - **min/max:** 16 of 24 cases gave the wrong SCC, for example `s_min_i32 case 0 [5, 3]: got 1, want 0`. - **lshl-add:** `s_lshl1_add_u32` gave SCC = 1 for `1 << 1 + 1`, where nothing overflows. ## The change (`emit/lower.rs`, in `sop`) - **`s_min`/`s_max`:** the comparison that already picks the result is now also SCC. - **`s_lshlN_add_u32`:** SCC is the carry of the 32-bit add, `r < (a << N)`. Bits shifted out of the 32-bit shift do not count, which matches ACO's fusion. ## Tests - **`emit::cpu_tests::scalar_min_max_set_scc_to_the_comparison`** and **`scalar_shift_adds_set_scc_to_the_carry`** (Linux, through #62's harness): - six input pairs per min/max op (both orders, zero, `u32::MAX` vs 1 signed and unsigned, equal); - five pairs for `s_lshl1`/`s_lshl4_add_u32`, including a shifted-out bit with no carry and a real carry. Both **fail without the fix** (`s_min_i32 case 0 [5, 3]: got 0x00000001, want 0x00000000`, `s_lshl1_add_u32 case 0 [1, 1]: got 0x00000001, want 0x00000000`) and pass with it. - **`valu_tests::scalar_min_max_and_shift_add_set_scc_like_rdna2`** (Windows/GPU): the same program shape and checks on the GPU. **Run here** (Linux, Rust 1.98.1, LLVM 23): - `cargo test -p victory-shader --lib --locked`: 200 passed, 0 failed, 2 ignored. - Portable clippy and `CARGO_FEATURE_PURE=1 cargo clippy -p victory-shader --all-targets --target x86_64-pc-windows-msvc -- -D warnings`: clean. **Not run here:** the GPU case, since I have no Windows machine. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The DXIL a translation emits is LLVM bitcode, so LLVM's own tools can
run it: `opt` gives it the host's data layout (DXIL's pointers are 32
bits), `llvm-link` adds a small runtime standing in for the dx.op
intrinsics, and `lli` runs it. emit/cpu_tests.rs does that for programs
of valu_tests.rs' shape (root constants in s0..s3, result stored from
v0), so what a lowered instruction computes can be checked on Linux,
without a GPU or dxil.dll.

Float-to-integer conversions are made saturating before the run: an
out-of-range fptosi is poison in LLVM IR, but in DXIL it has D3D's
meaning (saturate, NaN gives 0), which the translation relies on.

The tools come from VICTORY_LLVM_BIN, PATH or /usr/lib/llvm-N/bin;
without them, or off x86-64 Linux, the tests say they were skipped.
test_skip is now built on every host for that.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The repository policy (xtask) admits only listed text extensions, and
.ll is not one; the runtime is now a raw string next to its tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The scalar lowering set SCC to "result != 0" for every operation it did
not name. AMD's RDNA2 ISA gives s_min_*/s_max_* SCC = (S0 < S1) and
(S0 > S1), and s_lshl1..4_add_u32 the carry out of the add ("unsigned
overflow", as s_add_u32's; Mesa's ACO fuses s_lshl_b32 + s_add_u32 into
them even where the carry is read). So s_min_u32 s0, 5, 3 followed by
s_cselect took the wrong side.

Found with the CPU harness: s_min/s_max gave the wrong SCC in 16 of 24
cases, s_lshl1_add_u32 gave 1 for 1 << 1 + 1. Both now pass, and a GPU
case in valu_tests checks the same on Windows.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
So translations that compute in doubles run on the CPU too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
So the module list's line next to `mod container;` stays free for the
other test modules open PRs add there (#81).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:43:38 +00:00
Author
Owner

@⁠lmouz823-lang on GitHub · 2026-11-27 15:14 UTC · original

I can take the Windows/NVIDIA validation of this PR at exact head 3be32b40c29e22d188386b1af8f44c90cdb1ce6c. I will run scalar_min_max_and_shift_add_set_scc_like_rdna2 on an RTX 4060 Laptop with strict device checks and the SDK DXIL validator, verify actual hardware and WARP execution, and check the SCC boundary coverage. In particular, the current shift-add inputs appear to exercise only lshl1 with carry=0; I plan a small synthetic test addition for shifts 1–4, addition carry=1, and shifted-out bits without addition carry. I'll report exact results and any test-only diff here.

AI-assisted with Codex.

**@⁠lmouz823-lang** on GitHub · 2026-11-27 15:14 UTC · [original](https://github.com/uiliannn/VItoriaBr/pull/88#issuecomment-7221804032) I can take the Windows/NVIDIA validation of this PR at exact head `3be32b40c29e22d188386b1af8f44c90cdb1ce6c`. I will run `scalar_min_max_and_shift_add_set_scc_like_rdna2` on an RTX 4060 Laptop with strict device checks and the SDK DXIL validator, verify actual hardware and WARP execution, and check the SCC boundary coverage. In particular, the current shift-add inputs appear to exercise only lshl1 with carry=0; I plan a small synthetic test addition for shifts 1–4, addition carry=1, and shifted-out bits without addition carry. I'll report exact results and any test-only diff here. AI-assisted with Codex.
Author
Owner

@⁠lmouz823-lang on GitHub · 2026-11-27 15:25 UTC · original

Windows validation on exact head 3be32b40c29e22d188386b1af8f44c90cdb1ce6c: the existing scalar_min_max_and_shift_add_set_scc_like_rdna2 test passes on both RTX 4060 Laptop and WARP, with VICTORY_STRICT_TESTS=1, exactly one selected test and no GPU-test skips.

The five shift-add inputs all produce carry 0, so I added a test-only follow-up covering shifts 1–4 with 40 fixed result/SCC vectors. It checks carry 1, shifted-out bits without addition carry, and values just below/at/above the carry boundary. Each vector is tested with incoming SCC 0 and 1; result and SCC are read separately: 160 dispatches per backend, 320 total. The new test passes on both backends. Expected values are fixed tables checked against AMD RDNA2 ISA, §12.1.

Negative control: temporarily forcing shift-add SCC to 0 still lets the original test pass, but the new test fails on hardware at (0x7fffffff, 2), got SCC 0 / expected 1. After restoring the implementation, both tests pass again. The patch also corrects the CPU test's comment about (0x80000000 << 1) + 0xffffffff, whose carry is 0.

Environment: Windows 11 Pro 26200, i9-14900HX, NVIDIA 610.88, Rust 1.98.1 MSVC, release. Explicit Windows SDK dxil.dll 1.8.2502.11 was verified to create IDxcValidator; all generated modules passed validation/hash checks. Temporary diagnostics and the mutation were removed. Strict skip-policy test and git diff --check also pass.

Command for each exact filter:

cargo test --release --locked -p victory-shader --lib <filter> -- --exact --nocapture --test-threads=1

Not tested: native AMD/console execution, game/FPS, the Linux CPU harness, full workspace suite, or a merge onto current main.

AI assistance: Codex implemented the test, ran the checks and drafted this report.

Test-only patch against the PR head
diff --git a/crates/victory-shader/src/emit/cpu_tests.rs b/crates/victory-shader/src/emit/cpu_tests.rs
index b777b3d..a9b8d73 100644
--- a/crates/victory-shader/src/emit/cpu_tests.rs
+++ b/crates/victory-shader/src/emit/cpu_tests.rs
@@ -674,8 +674,9 @@ fn scalar_min_max_set_scc_to_the_comparison() {
 #[test]
 fn scalar_shift_adds_set_scc_to_the_carry() {
     // s_lshl1_add_u32 / s_lshl4_add_u32 s12, s0, s1, then SCC as above: the
-    // carry out of the 32-bit add (0 for 1 << 1 + 1, 1 for 0x8000_0000 << 1
-    // + 0xFFFF_FFFF: the shifted-out bit alone is no carry).
+    // carry out of the 32-bit add (0 for (1 << 1) + 1, 1 for (3 << 1)
+    // + 0xFFFF_FFFF). The shifted-out bit alone is no carry:
+    // (0x8000_0000 << 1) + 0xFFFF_FFFF has SCC = 0.
     let cselect = 0x8000_0000 | 0x0A << 23 | 13 << 16 | 0x80 << 8 | 0x81;
     for (op, n) in [(0x2Eu32, 1u32), (0x31, 4)] {
         let body = [0x8000_0000 | op << 23 | 12 << 16 | 1 << 8, cselect, vop1(0x001, 0, 13)];
diff --git a/crates/victory-shader/src/emit/valu_tests.rs b/crates/victory-shader/src/emit/valu_tests.rs
index 3733b7e..d670194 100644
--- a/crates/victory-shader/src/emit/valu_tests.rs
+++ b/crates/victory-shader/src/emit/valu_tests.rs
@@ -519,6 +519,104 @@ fn scalar_min_max_and_shift_add_set_scc_like_rdna2() {
     }
 }
 
+#[test]
+fn scalar_shift_add_results_and_carry_cover_boundaries() {
+    // AMD RDNA2 ISA, section 12.1, SOP2 opcodes 46..49: the shift is
+    // 32-bit; SCC is the carry out of the following addition. Fixed
+    // (S0, S1, result, SCC) tables keep the oracle independent of lowering.
+    // Check no carry, shifted-out bits without carry, and the values just
+    // below, at and above the carry boundary for every shift amount.
+    let ops = [
+        (
+            0x2E,
+            "s_lshl1_add_u32",
+            [
+                [0, 0, 0, 0],
+                [1, 1, 3, 0],
+                [0x8000_0000, 0, 0, 0],
+                [0x8000_0000, 1, 1, 0],
+                [0x8000_0000, u32::MAX, u32::MAX, 0],
+                [0x7FFF_FFFF, 1, u32::MAX, 0],
+                [0x7FFF_FFFF, 2, 0, 1],
+                [0x7FFF_FFFF, 3, 1, 1],
+                [1, u32::MAX, 1, 1],
+                [u32::MAX, 2, 0, 1],
+            ],
+        ),
+        (
+            0x2F,
+            "s_lshl2_add_u32",
+            [
+                [0, 0, 0, 0],
+                [1, 1, 5, 0],
+                [0x8000_0000, 0, 0, 0],
+                [0x8000_0000, 1, 1, 0],
+                [0x8000_0000, u32::MAX, u32::MAX, 0],
+                [0x3FFF_FFFF, 3, u32::MAX, 0],
+                [0x3FFF_FFFF, 4, 0, 1],
+                [0x3FFF_FFFF, 5, 1, 1],
+                [1, u32::MAX, 3, 1],
+                [u32::MAX, 4, 0, 1],
+            ],
+        ),
+        (
+            0x30,
+            "s_lshl3_add_u32",
+            [
+                [0, 0, 0, 0],
+                [1, 1, 9, 0],
+                [0x8000_0000, 0, 0, 0],
+                [0x8000_0000, 1, 1, 0],
+                [0x8000_0000, u32::MAX, u32::MAX, 0],
+                [0x1FFF_FFFF, 7, u32::MAX, 0],
+                [0x1FFF_FFFF, 8, 0, 1],
+                [0x1FFF_FFFF, 9, 1, 1],
+                [1, u32::MAX, 7, 1],
+                [u32::MAX, 8, 0, 1],
+            ],
+        ),
+        (
+            0x31,
+            "s_lshl4_add_u32",
+            [
+                [0, 0, 0, 0],
+                [1, 1, 17, 0],
+                [0x8000_0000, 0, 0, 0],
+                [0x8000_0000, 1, 1, 0],
+                [0x8000_0000, u32::MAX, u32::MAX, 0],
+                [0x0FFF_FFFF, 15, u32::MAX, 0],
+                [0x0FFF_FFFF, 16, 0, 1],
+                [0x0FFF_FFFF, 17, 1, 1],
+                [1, u32::MAX, 15, 1],
+                [u32::MAX, 16, 0, 1],
+            ],
+        ),
+    ];
+    for (op, name, expected) in ops {
+        // s_add_u32 s14, s2, 1 sets the incoming SCC to 0 or 1, so the
+        // instruction must overwrite either prior flag correctly.
+        let cases: Vec<_> = [0, u32::MAX]
+            .into_iter()
+            .flat_map(|seed| expected.map(|[a, b, _, _]| [a, b, seed, 0]))
+            .collect();
+        for (reg, field, label) in [(12, 2, "result"), (13, 3, "SCC")] {
+            let shader = build_valu_cs(&[
+                sop2(0x00, 14, 2, 0x81),
+                sop2(op, 12, 0, 1),
+                sop2(0x0A, 13, 0x81, 0x80),
+                vop1(0x001, 0, sgpr(reg)),
+            ]);
+            run_cases(&shader, &cases, |backend, i, inp, got| {
+                let want = expected[i % expected.len()][field];
+                assert_eq!(
+                    got, want,
+                    "{backend}: {name} {label}, input {inp:x?}: got {got:#x}, want {want:#x}"
+                );
+            });
+        }
+    }
+}
+
 #[test]
 fn v_med3_f16_matches_rdna2_with_nan() {
     // v_med3_f16 v0, v1, v2, v3 (VOP3 opcode 0x357)

**@⁠lmouz823-lang** on GitHub · 2026-11-27 15:25 UTC · [original](https://github.com/uiliannn/VItoriaBr/pull/88#issuecomment-7222037078) Windows validation on exact head `3be32b40c29e22d188386b1af8f44c90cdb1ce6c`: the existing `scalar_min_max_and_shift_add_set_scc_like_rdna2` test passes on both **RTX 4060 Laptop** and **WARP**, with `VICTORY_STRICT_TESTS=1`, exactly one selected test and no GPU-test skips. The five shift-add inputs all produce carry 0, so I added a test-only follow-up covering shifts 1–4 with 40 fixed result/SCC vectors. It checks carry 1, shifted-out bits without addition carry, and values just below/at/above the carry boundary. Each vector is tested with incoming SCC 0 and 1; result and SCC are read separately: **160 dispatches per backend, 320 total**. The new test passes on both backends. Expected values are fixed tables checked against [AMD RDNA2 ISA, §12.1](https://docs.amd.com/v/u/en-US/rdna2-shader-instruction-set-architecture). Negative control: temporarily forcing shift-add SCC to 0 still lets the original test pass, but the new test fails on hardware at `(0x7fffffff, 2)`, got SCC 0 / expected 1. After restoring the implementation, both tests pass again. The patch also corrects the CPU test's comment about `(0x80000000 << 1) + 0xffffffff`, whose carry is 0. Environment: Windows 11 Pro 26200, i9-14900HX, NVIDIA 610.88, Rust 1.98.1 MSVC, release. Explicit Windows SDK `dxil.dll` 1.8.2502.11 was verified to create `IDxcValidator`; all generated modules passed validation/hash checks. Temporary diagnostics and the mutation were removed. Strict skip-policy test and `git diff --check` also pass. Command for each exact filter: ```text cargo test --release --locked -p victory-shader --lib <filter> -- --exact --nocapture --test-threads=1 ``` Not tested: native AMD/console execution, game/FPS, the Linux CPU harness, full workspace suite, or a merge onto current main. AI assistance: Codex implemented the test, ran the checks and drafted this report. <details> <summary>Test-only patch against the PR head</summary> ```diff diff --git a/crates/victory-shader/src/emit/cpu_tests.rs b/crates/victory-shader/src/emit/cpu_tests.rs index b777b3d..a9b8d73 100644 --- a/crates/victory-shader/src/emit/cpu_tests.rs +++ b/crates/victory-shader/src/emit/cpu_tests.rs @@ -674,8 +674,9 @@ fn scalar_min_max_set_scc_to_the_comparison() { #[test] fn scalar_shift_adds_set_scc_to_the_carry() { // s_lshl1_add_u32 / s_lshl4_add_u32 s12, s0, s1, then SCC as above: the - // carry out of the 32-bit add (0 for 1 << 1 + 1, 1 for 0x8000_0000 << 1 - // + 0xFFFF_FFFF: the shifted-out bit alone is no carry). + // carry out of the 32-bit add (0 for (1 << 1) + 1, 1 for (3 << 1) + // + 0xFFFF_FFFF). The shifted-out bit alone is no carry: + // (0x8000_0000 << 1) + 0xFFFF_FFFF has SCC = 0. let cselect = 0x8000_0000 | 0x0A << 23 | 13 << 16 | 0x80 << 8 | 0x81; for (op, n) in [(0x2Eu32, 1u32), (0x31, 4)] { let body = [0x8000_0000 | op << 23 | 12 << 16 | 1 << 8, cselect, vop1(0x001, 0, 13)]; diff --git a/crates/victory-shader/src/emit/valu_tests.rs b/crates/victory-shader/src/emit/valu_tests.rs index 3733b7e..d670194 100644 --- a/crates/victory-shader/src/emit/valu_tests.rs +++ b/crates/victory-shader/src/emit/valu_tests.rs @@ -519,6 +519,104 @@ fn scalar_min_max_and_shift_add_set_scc_like_rdna2() { } } +#[test] +fn scalar_shift_add_results_and_carry_cover_boundaries() { + // AMD RDNA2 ISA, section 12.1, SOP2 opcodes 46..49: the shift is + // 32-bit; SCC is the carry out of the following addition. Fixed + // (S0, S1, result, SCC) tables keep the oracle independent of lowering. + // Check no carry, shifted-out bits without carry, and the values just + // below, at and above the carry boundary for every shift amount. + let ops = [ + ( + 0x2E, + "s_lshl1_add_u32", + [ + [0, 0, 0, 0], + [1, 1, 3, 0], + [0x8000_0000, 0, 0, 0], + [0x8000_0000, 1, 1, 0], + [0x8000_0000, u32::MAX, u32::MAX, 0], + [0x7FFF_FFFF, 1, u32::MAX, 0], + [0x7FFF_FFFF, 2, 0, 1], + [0x7FFF_FFFF, 3, 1, 1], + [1, u32::MAX, 1, 1], + [u32::MAX, 2, 0, 1], + ], + ), + ( + 0x2F, + "s_lshl2_add_u32", + [ + [0, 0, 0, 0], + [1, 1, 5, 0], + [0x8000_0000, 0, 0, 0], + [0x8000_0000, 1, 1, 0], + [0x8000_0000, u32::MAX, u32::MAX, 0], + [0x3FFF_FFFF, 3, u32::MAX, 0], + [0x3FFF_FFFF, 4, 0, 1], + [0x3FFF_FFFF, 5, 1, 1], + [1, u32::MAX, 3, 1], + [u32::MAX, 4, 0, 1], + ], + ), + ( + 0x30, + "s_lshl3_add_u32", + [ + [0, 0, 0, 0], + [1, 1, 9, 0], + [0x8000_0000, 0, 0, 0], + [0x8000_0000, 1, 1, 0], + [0x8000_0000, u32::MAX, u32::MAX, 0], + [0x1FFF_FFFF, 7, u32::MAX, 0], + [0x1FFF_FFFF, 8, 0, 1], + [0x1FFF_FFFF, 9, 1, 1], + [1, u32::MAX, 7, 1], + [u32::MAX, 8, 0, 1], + ], + ), + ( + 0x31, + "s_lshl4_add_u32", + [ + [0, 0, 0, 0], + [1, 1, 17, 0], + [0x8000_0000, 0, 0, 0], + [0x8000_0000, 1, 1, 0], + [0x8000_0000, u32::MAX, u32::MAX, 0], + [0x0FFF_FFFF, 15, u32::MAX, 0], + [0x0FFF_FFFF, 16, 0, 1], + [0x0FFF_FFFF, 17, 1, 1], + [1, u32::MAX, 15, 1], + [u32::MAX, 16, 0, 1], + ], + ), + ]; + for (op, name, expected) in ops { + // s_add_u32 s14, s2, 1 sets the incoming SCC to 0 or 1, so the + // instruction must overwrite either prior flag correctly. + let cases: Vec<_> = [0, u32::MAX] + .into_iter() + .flat_map(|seed| expected.map(|[a, b, _, _]| [a, b, seed, 0])) + .collect(); + for (reg, field, label) in [(12, 2, "result"), (13, 3, "SCC")] { + let shader = build_valu_cs(&[ + sop2(0x00, 14, 2, 0x81), + sop2(op, 12, 0, 1), + sop2(0x0A, 13, 0x81, 0x80), + vop1(0x001, 0, sgpr(reg)), + ]); + run_cases(&shader, &cases, |backend, i, inp, got| { + let want = expected[i % expected.len()][field]; + assert_eq!( + got, want, + "{backend}: {name} {label}, input {inp:x?}: got {got:#x}, want {want:#x}" + ); + }); + } + } +} + #[test] fn v_med3_f16_matches_rdna2_with_nan() { // v_med3_f16 v0, v1, v2, v3 (VOP3 opcode 0x357) ``` </details>
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/88/head:github-bot/gh-88'
git switch 'github-bot/gh-88'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-88'
git switch 'github-bot/gh-88'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-88'
git switch 'github-bot/gh-88'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-88'
git switch 'main'
git merge --squash 'github-bot/gh-88'
git switch 'main'
git merge --ff-only 'github-bot/gh-88'
git switch 'main'
git merge 'github-bot/gh-88'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.