[llvm] [RISCV][TTI] Implement cost of llvm.experimental.vector.extract.last.active (PR #184067)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 4 19:46:32 PST 2026


================
@@ -1702,6 +1702,35 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
                                CmpInst::FCMP_UNO, CostKind);
     return Cost;
   }
+  case Intrinsic::experimental_vector_extract_last_active: {
+    Type *ValTy = ICA.getArgTypes()[0];
+    Type *MaskTy = ICA.getArgTypes()[1];
+
+    auto ValLT = getTypeLegalizationCost(ValTy);
+    auto MaskLT = getTypeLegalizationCost(MaskTy);
+
+    if (!ValLT.first.isValid() || !MaskLT.first.isValid())
+      return InstructionCost::getInvalid();
----------------
lukel97 wrote:

Since you're multiplying by ValLT.first and MaskLT.first below I think it will automatically propagate invalid costs now, I think you can remove this
```suggestion
```

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


More information about the llvm-commits mailing list