[PATCH] D134354: [AMDGPU][GlobalISel] Support mad/fma_mix selection

Pierre van Houtryve via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 19 02:31:21 PDT 2022


Pierre-vh marked 2 inline comments as done.
Pierre-vh added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUGISel.td:156
 
+def gi_vop3_mad_mix_mods :
+    GIComplexOperandMatcher<s64, "selectVOP3PMadMixMods">,
----------------
foad wrote:
> Pierre-vh wrote:
> > foad wrote:
> > > Pierre-vh wrote:
> > > > foad wrote:
> > > > > Is this required? I am confused about whether you are now matching VOP3PMadMixMods in TableGen patterns, or only doing it from the C++ code in selectG_FMA.
> > > > I'm doing it exclusively in C++.
> > > > This is needed to tell the GlobalISelEmitter that, when it sees "VOP3PMadMixMods" it needs to use the "selectVOP3PMadMixMods" function from AMDGPUInstructionSelector.
> > > > Without that, it wouldn't import patterns that use it.
> > > I'm still confused. If we are now importing patterns that use VOP3PMadMixMods, why do you need to do the selection in C++ code?
> > It's a ComplexPattern
> > ```
> > def VOP3PMadMixMods  : ComplexPattern<untyped, 2, "SelectVOP3PMadMixMods">;
> > ```
> > Those functions work with DAG nodes and must be rewritten for GISel so the patterns can be imported
> > https://llvm.org/docs/GlobalISel/InstructionSelect.html#complexpatterns
> Right, but why do you need to write code in selectG_FMA_FMAD to manually select MAD_MIX/FMA_MIX? Why can't the imported patterns do this automatically?
Because there are no patterns for MIX, only for MIXHI/MIXLO. MIX selection is still manual in the DAG as well (see SelectFMAD_FMA)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134354/new/

https://reviews.llvm.org/D134354



More information about the llvm-commits mailing list