feat(shader): implement v_mad_i64_i32 #435
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/435"
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-03T06:46:00Z.
What
v_mad_i64_i32(VOP3b 0x177) threw "VOP3 opcode is not implemented". Found by the ISA coverage sweep.v_mad_u64_u32(same VOP3b layout: 64-bitvdst,sdstcarry-out, 64-bitsrc2).v_mad_u64_u32code (vMad64x32(inst, sign)): the high half of the product usesSMulHiinstead of
UMulHi; the low 64 bits of the sum are the same arithmetic.bit 64 of
sext(S0*S1) + sext(S2). Translated assign(product) xor sign(addend) xor unsigned carry. Out of 1000measured vectors, signed overflow mismatched 483 and the unsigned carry 484; this model matched all of them.
clampis still rejected for both VOP3b mads, like onmain. On hardware it saturates the 64-bit result to thesigned range and leaves the carry unchanged; that is a follow-up.
Tested
Vop3MadI64(32 lanes, expected values captured on an RDNA2 GPU, Radeon 660M):v_mad_i64_i32with an SGPR carry-out, with
vcc_loand an inline-1multiplier, and with an inline 64-bit-1addend, plusv_mad_u64_u32on the same inputs since its code moved. Inputs cover INT_MIN products, signed and unsignedwrap-around, and both carry values.
main("VOP3 opcode is not implemented"); passes on Linux with RADV and lavapipe.UMulHifails("i64 neg1 hi").
ctest: 126/126.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-03T06:46:23Z.
Progress report (
8a64778→e1b7ecc)📈 GPU shader instructions: 73.58% (+0.08%, +1 implemented instructions)
✅ 1 implemented
V_MAD_I64_I32Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-04T07:18:14Z.
Rebased onto main after #437:
v_mad_i64_i32now sits next tov_mad_u64_u32in the 2-register case ofembeddedFetchDstSize, which #437 turned into a switch.agc_driver_vop3_mad_i64passes on RADV and lavapipe.