[llvm] [TTI][RISCV] Add cost modelling for intrinsic vp.load.ff (PR #169890)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 28 08:15:23 PST 2025


================
@@ -1007,6 +1007,24 @@ InstructionCost RISCVTTIImpl::getScalarizationOverhead(
   return Cost;
 }
 
+InstructionCost
+RISCVTTIImpl::getMemIntrinsicInstrCost(const MemIntrinsicCostAttributes &MICA,
+                                       TTI::TargetCostKind CostKind) const {
+  Type *DataTy = MICA.getDataType();
+  Align Alignment = MICA.getAlignment();
+  switch (MICA.getID()) {
+  case Intrinsic::vp_load_ff: {
+    EVT DataTypeVT = TLI->getValueType(DL, DataTy);
+    if (!TLI->isLegalFirstFaultLoad(DataTypeVT, Alignment))
+      return BaseT::getMemIntrinsicInstrCost(MICA, CostKind);
+
+    return getMemoryOpCost(Instruction::Load, DataTy, Alignment, 0, CostKind,
----------------
lukel97 wrote:

Nit, I guess it'll always be 0 on RISC-V but should we plumb through the address space anyway?

```suggestion
    return getMemoryOpCost(Instruction::Load, DataTy, Alignment, MCIA.AddressSpace, CostKind,
```

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


More information about the llvm-commits mailing list