[PATCH] D73749: [LegalizeTypes][X86] Add a new strategy for type legalizing f16 type that softens it to i16, but promotes to f32 around arithmetic ops.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 30 16:23:26 PST 2020


efriedma added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp:2685
+  // Convert back to FP16 as an integer.
+  EVT IVT = EVT::getIntegerVT(*DAG.getContext(), VT.getSizeInBits());
+  return DAG.getNode(ISD::FP_TO_FP16, dl, IVT, Res);
----------------
efriedma wrote:
> Using getIntegerVT like this is suspicious; if the original node is a vector, the promoted node should also be a vector, no?
Wait, nevermind; the original node can't be a vector.  We would split/scalarize the vector first.

In that case, you might as well just write MVT::i16 explicitly, though.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp:2766
+
+SDValue DAGTypeLegalizer::SoftPromoteHalfOp_INSERT_VECTOR_ELT(SDNode *N,
+                                                              unsigned OpNo) {
----------------
Is SoftPromoteHalfOp_INSERT_VECTOR_ELT actually reachable?  If the operand is a half-float, the result would have to be a half vector, and we would split that, I think?


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

https://reviews.llvm.org/D73749





More information about the llvm-commits mailing list