feat(shader): implement the missing non-f64 VOPC compares #259
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/259"
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:17:45Z.
What
50 VOPC opcodes threw "VOPC opcode is not implemented" (and the same in their VOP3 encodings):
v_cmpx_f/o/u/tru_f32v_cmpx_f/t_i32,v_cmpx_f/t_u32v_cmp_*/v_cmpx_*(f, lt, eq, le, gt, ne, ge, t) except the seven already therev_cmp_f/o/u/nge/nlg/ngt/nle/nlt/tru_f16,v_cmpx_f/lg/o/u/nge/nlg/nle/tru_f16The IR only has
SLessThan64/ULessThan64for 64-bit ordering, soemitInteger64Orderbuilds gt/le/ge by swapping the operands and/or negating.emitFloatOrderedComparegetshalfandcmpxparameters (the two existing callers passfalse, false). The 64-bit entries are not DPP-capable, like the existing ones.Not included: f64 compares (with the rest of f64),
v_cmp_class_f16(converting to f32 turns f16 denormals into normals, so the class bits need a bit-level classifier: separate PR).Found with an ISA sweep (every gfx1013 opcode from
llvm-mcthroughDecodeRdnaInstruction+TranslateInstruction).Test
agc_driver_vopc_compare: generated wave32 shader (words fromllvm-mc -mcpu=gfx1013): 54 compares, each turned into one bit per lane (v_cndmaskof VCC, orv_movunder the EXEC acmpxleaves, then EXEC restored), packed withv_lshl_or_b32. Inputs: f32/f16 NaN, ±inf, ±0, equal pairs, denormals; 64-bit values whose signed and unsigned order differ, equal pairs, high-word-only differences; plus pseudo-random. A C++ model checks every bit. Four of the compares use the VOP3 encoding (withabs).Found while testing (not fixed here)
neg("VOP3 source modifiers are not implemented"), also for existing ones likev_cmp_lt_f32_e64 vcc_lo, -v14, v15: compares have a scalar destination, socheckNativeVop3Modifierstakes thecarryInOut || scalarDstbranch, which rejectsneg.absworks.exec_loto an SGPR, runs acmpxand restores it gives wrong results in the second wave (lanes 32-63); lavapipe is fine. So this test dispatches a single wave. I have not looked at the cause yet.Tested
Linux: passes on RADV (Radeon 660M) and lavapipe; without the change it fails with "VOPC opcode is 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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-01T20:18:07Z.
Progress report (
709d7fe→b637673)📈 GPU shader instructions: 56.95% (+4.29%, +50 implemented instructions)
✅ 50 implemented
V_CMPX_EQ_I64V_CMPX_EQ_U64V_CMPX_F_F16V_CMPX_F_F32V_CMPX_F_I32V_CMPX_F_I64V_CMPX_F_U32V_CMPX_F_U64V_CMPX_GE_I64V_CMPX_GE_U64V_CMPX_GT_I64V_CMPX_GT_U64V_CMPX_LE_I64V_CMPX_LE_U64V_CMPX_LG_F16V_CMPX_LT_I64V_CMPX_LT_U64V_CMPX_NGE_F16V_CMPX_NLE_F16V_CMPX_NLG_F16V_CMPX_O_F16V_CMPX_O_F32V_CMPX_TRU_F16V_CMPX_TRU_F32V_CMPX_T_I32V_CMPX_T_I64V_CMPX_T_U32V_CMPX_T_U64V_CMPX_U_F16V_CMPX_U_F32V_CMP_F_F16V_CMP_F_I64V_CMP_F_U64V_CMP_GE_I64V_CMP_GE_U64V_CMP_GT_I64V_CMP_LE_I64V_CMP_LE_U64V_CMP_LT_I64V_CMP_NE_I64V_CMP_NGE_F16V_CMP_NGT_F16V_CMP_NLE_F16V_CMP_NLG_F16V_CMP_NLT_F16V_CMP_O_F16V_CMP_TRU_F16V_CMP_T_I64V_CMP_T_U64V_CMP_U_F16Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-01T20:22:02Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/shader/recompiler/RdnaDecoder/src/RdnaOpcode.cppL452-453core/shader/recompiler/RdnaDecoder/src/RdnaVectorOpDecoder.cppL321, L1161-1162core/shader/recompiler/Translation/include/Translation/TranslationContext.hppL120core/shader/recompiler/Translation/src/CompareInstructions.cppL57-59, L64core/shader/recompiler/RdnaDecoder/src/RdnaOpcode.cppL452-453core/shader/recompiler/RdnaDecoder/src/RdnaVectorOpDecoder.cppL321, L1161-1162core/shader/recompiler/Translation/include/Translation/TranslationContext.hppL119-121core/shader/recompiler/Translation/src/VectorInstructions.cppL147