[llvm] [AMDGPU][GFX11] Do not rewrite V_FMA/FMAC_* to V_FMAAK_F16_t16 on operand legalization. (PR #66202)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 13 06:47:04 PDT 2023


jayfoad wrote:

> > Oh I see, it's because we are folding a VOP3 instruction (V_FMAC_F16_t16_e64) to V_FMAAK_F16_t16 which is VOP2 only.
> 
> Yes. Which I understand makes the shrinking pass the right place to rewrite to V_FMAAK_F16_t16, should we want that.

Unfortunately it is not that simple. It would be nice if folding immediates and shrinking VOP3 to VOP2 were orthogonal and could be implemented in separate passes, but this is one of the awkward cases where there is some interaction - you can only fold if you also shrink.

In our compiler we do folding first and then shrinking. So the options are:
1. When folding, be prepared to shrink the instruction to enable that (which is what we do here).
2. When shrinking, see if it enables any extra folding.

https://github.com/llvm/llvm-project/pull/66202


More information about the llvm-commits mailing list