Commit Graph

2 Commits

Author SHA1 Message Date
738249fd93 rdna2spirv: translate v_cmp_nlg and v_cmpx_nlg for f32 and f16
Add nlg -> OpFUnordEqual (x == y or either source is NaN) to Gen.compare(), completing all 16 IEEE-754 RDNA2 VOPC float predicates (confirmed against LLVM gfx10_asm_vopc.s and RDNA2 ISA VOPC).

Verified on CPU with tests/semantic/test_float_compares.py (e32/e64 f32, f16 and v_cmpx_nlg) and tests/semantic/test_vopc_const_ordered.py.
2026-11-22 01:09:53 -04:00
f2fead895a tests/semantic: run unordered float compares in the interpreter, and test v_cmp_*_f32/f16
spirv_mini_interp.py had the ordered float compares and OpFUnordNotEqual only,
so v_cmp_lg/nlt/ngt/nle/nge could not run, and neither could the
OpIsNan/OpIsInf checks in v_cvt_pkrtz. It now has OpFOrdNotEqual, every
OpFUnord* compare, OpIsNan and OpIsInf: an ordered compare is false and an
unordered one true when either operand is NaN.

test_float_compares.py checks v_cmp_{lt,le,gt,ge,eq,lg,neq,nlt,ngt,nle,nge} for
f32 (e32 and e64) and f16 (with high-half noise) on 0, -0, +-1, 2.5, +-inf and
NaN against Python's own comparison, plus e64 neg/abs source modifiers.
test_interp.py tests the new ops directly.
2026-11-21 19:08:00 -03:00