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

Ivan Kosarev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 7 09:19:50 PDT 2023


kosarev 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();
----------------
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.


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