[PATCH] D154528: [AMDGPU][GlobalISel] Generate fast fp64-to-fp16 conversions in unsafe mode.

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 11 01:44:46 PDT 2023


foad added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:17037-17040
+    // Avoid folding legal fp_rounds into non-legal ones.
+    if (LegalDAG &&
+        TLI.getOperationAction(ISD::FP_ROUND, VT) != TargetLowering::Legal)
+      return SDValue();
----------------
kosarev wrote:
> arsenm wrote:
> > kosarev wrote:
> > > This doesn't seem to cause any test failures here upstream and eliminates the need for the True16 f16 = fp_round f64 pattern downstream.
> > > 
> > > Not sure if we want that in a separate patch or better keep here to provide some context. It looks problematic to give it a real test without having some True16 support.
> > > 
> > I think you're supposed to be checking LegalOperations, not LegalDAG. Use the hasOperation helper?
> For some reason that I don't quite understand `LegalOperations` gets raised as soon as vector operations are legalised:
> 
> ```
>   LegalOperations = Level >= AfterLegalizeVectorOps;
> ```
> 
> So relying on that flag would mean we forbid the fold during the `AfterLegalizeVectorOps` combine.
"So relying on that flag would mean we forbid the fold during the AfterLegalizeVectorOps combine." - why is that a problem?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154528



More information about the llvm-commits mailing list