[llvm] [RISCV][TTI] Add cost of typebased cast VPIntrinsics with functionalOPC. (PR #97797)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 28 22:18:08 PDT 2024


================
@@ -1006,6 +1006,24 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
       return getArithmeticInstrCost(*FOp, ICA.getReturnType(), CostKind);
     break;
   }
+  // vp int cast ops.
+  case Intrinsic::vp_trunc:
+  case Intrinsic::vp_zext:
+  case Intrinsic::vp_sext:
+  // vp float cast ops.
+  case Intrinsic::vp_fptoui:
+  case Intrinsic::vp_fptosi:
+  case Intrinsic::vp_uitofp:
+  case Intrinsic::vp_sitofp:
+  case Intrinsic::vp_fptrunc:
+  case Intrinsic::vp_fpext: {
+    std::optional<unsigned> FOp =
+        VPIntrinsic::getFunctionalOpcodeForVP(ICA.getID());
----------------
lukel97 wrote:

Something that can be cleaned up after this patch but I think we should just `assert(FOp.has_value())` here (and in the vp arithmetic ops above)

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


More information about the llvm-commits mailing list