fix(shader): accept neg on VOP3-encoded float compares #260
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/260"
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 boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-01T20:21:02Z.
What
negon a VOP3-encoded float compare threw "VOP3 source modifiers are not implemented", e.g.v_cmp_lt_f32_e64 vcc_lo, -v14, v15orv_cmpx_le_f32_e64 -v4, v5. Compares have a scalar destination, socheckNativeVop3Modifierssends them through thecarryInOut || scalarDstbranch, which rejectsneg(it is meant for the carry ops).absalready passed, and the VOPC branch ofDecodeRdnaVop3already applies both throughapplyNativeVop3SourceModifiers, so only the check was in the way. Float compares (isVopcFloatCompareOpcode) now acceptnegthere; integer compares and the carry ops still reject it.Compilers emit these for things like
-x < yor-|x| > y, so this throws on ordinary shaders.Found while writing the VOPC test in #259.
Test
agc_driver_vop3_compare_modifiers: wave32 shader (words fromllvm-mc -mcpu=gfx1013) with 9 VOP3 compares using-x,-|x|: f32 and f16, VCC and SGPR destinations, twocmpx. One bit per lane each, checked against a C++ model. Inputs: NaN, ±inf, ±0, ±1, the smallest normal, f16 denormals, with flipped signs. f32 denormals are left out because the shader flushes them, which is not what this test is about.Tested
Linux: passes on RADV (Radeon 660M) and lavapipe; without the fix it fails with "VOP3 source modifiers are not implemented". Full ctest (99) passes.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)