[llvm] X86: Do not return invalid cost for fp16 conversion (PR #114128)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 29 14:44:19 PDT 2024


================
@@ -3068,6 +3068,13 @@ InstructionCost X86TTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst,
         if (auto KindCost = Entry->Cost[CostKind])
           return *KindCost;
     }
+
+    if ((ISD == ISD::FP_ROUND && SimpleDstTy == MVT::f16) ||
+        (ISD == ISD::FP_EXTEND && SimpleSrcTy == MVT::f16)) {
+      // fp16 conversions not covered by any table entries require a libcall,
+      // return a large (arbitrary) number.
----------------
JoelWee wrote:

nit: "return a large (arbitrary) number to model this."

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


More information about the llvm-commits mailing list