[llvm] [AMDGPU] Use V_FMAC_F64 in "if (cond) a -= c" (PR #168710)
Valery Pykhtin via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 9 04:10:15 PST 2026
vpykhtin wrote:
> > Only work on pre-gfx12 as gfx12+ has dual-issued `v_cndmask`.
> I don't understand this part. You mean VOPD? Firstly that only works in wave32 and secondly, surely it is still better to remove one cndmask, so then the other one can be dual-issued with some other (unrelated) instruction?
Good point!
> > Since the resulting pattern has one more instruction and requires 7 VGPRs instead of 6
> But it's not really 7 VGPRs because vNegOneHi and vMul.hi don't overlap, right?
Right, when I calculated the number of VGPRs I probably thought that vNegOneHi stays alive as shared cosntant or hoisted out of a loop.
> Anyway on GFX10+ those problems go away because v_cndmask can take a literal:
> ```
> v_mov_b32_e32 vMul.lo, 0
> v_cndmask_b32_e64 vMul.hi, 0, 0xbff00000, vCondReg
> v_fmac_f64_e32 vDst[0:1], vMul[0:1], vValue[0:1], vAccum[0:1] ; vAccum is tied-to vDst
> ```
Thanks Jay, with this reasoning the role of reverting pass becomes very subtle: we only needed on pre GFX10 - I would avoid it at all costs :). BTW I need to check if 0xbff00000 got 'literalized' into the v_cndmask.
https://github.com/llvm/llvm-project/pull/168710
More information about the llvm-commits
mailing list