[llvm] [RISCV][TTI] Implement vector costs for `llvm.fpto{u|s}i.sat()`. (PR #143655)

Shih-Po Hung via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 11 02:03:30 PDT 2025


================
@@ -1497,6 +1497,33 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
                           cast<VectorType>(ICA.getArgTypes()[0]), {}, CostKind,
                           0, cast<VectorType>(ICA.getReturnType()));
   }
+  case Intrinsic::fptoui_sat:
+  case Intrinsic::fptosi_sat: {
+    InstructionCost Cost = 0;
+    bool IsSigned = ICA.getID() == Intrinsic::fptosi_sat;
+    Type *SrcTy = ICA.getArgTypes()[0];
+
+    auto SrcLT = getTypeLegalizationCost(SrcTy);
+    auto DstLT = getTypeLegalizationCost(RetTy);
+    if (!SrcLT.first.isValid() || !DstLT.first.isValid())
----------------
arcbbb wrote:

Do we need to skip scalar type here as well?

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


More information about the llvm-commits mailing list