Shaders: v_cmp_lg is ordered on AMD hosts too (olt | ogt, not fcmp one)

v_cmp_lg_{f32,f16} ("less or greater") is ordered and not equal: false
when either operand is a NaN, on RDNA2 hardware as in the ISA. It was
lowered to `fcmp one`, which says the same, but the AMD D3D12 driver runs
`fcmp one` as unordered and returns true for a NaN. NVIDIA and WARP get it
right. It now lowers as `olt | ogt`, which all three run alike.

New GPU test v_cmp_lg_is_false_for_nan covers both widths: NaN on either
side, both NaN, a signalling NaN, +0 against -0, inf against inf and
against -inf, and junk in the unread high halves for f16.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
LyrncandClaude Opus 5.5 committed 2026-11-24 10:07:26 +03:00
1 parent d2a4bae1f4
commit 51f1627d88
3 files changed
+84 -20

No files matched your search

@@ -103,6 +103,9 @@ pub(crate) mod pred {
pub const OGE: u8 = 3;
pub const OLT: u8 = 4;
pub const OLE: u8 = 5;
// Not emitted: the AMD D3D12 driver treats it as UNE, so `v_cmp_lg`
// lowers as OLT | OGT instead.
#[allow(dead_code)]
pub const ONE: u8 = 6;
pub const ORD: u8 = 7;
pub const UNO: u8 = 8;