Shaders: s_min and s_max set SCC to their comparison #1891
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1891"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Melow-code on 2026-11-29T01:46:43Z.
Fixes the flag left by the scalar minimum and maximum.
What it changes
s_min_i32,s_min_u32,s_max_i32ands_max_u32set SCC to the comparison of their operands (RDNA 2 ISA:SCC = (S0 < S1),SCC = (S0 > S1)). The lowering set it to "the result is not zero", so ans_cselector a branch behind one could take the wrong side:s_min_u32 s0, 5, 3gave 1.Two lines in
lower.rs, and a test of the four opcodes: zero results, equal operands, signed and unsigned orders.Credit: the fix and the test table are from TaynanGT/Vice-Tay 3c83a339 (reported in Belobug/VIctory-Belobug-AMD#634 and avatarmanz/VIctory-7900XTX#404). The same defect was in #71, reviewed and then closed by its author.
How it was tested
scalar_min_max_pass_the_comparison_to_conditional_selectfails on the card (hardware, opcode 0x6, case 0: 0 instead of 1).cargo test -p victory-shader --libon Linux, on main0338ec6c: 268 passed, 0 failed. The card test was run onf9dfb76fwith the same change (the test above is Windows only). The test programs were cross-built with Rust 1.99.1 GNU, not the pinned 1.98.1 MSVC. The whole Windows suite was not completed on this branch.Checked for overlap
🤖 Generated with Claude Code