[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 05:56:41 PST 2026
================
@@ -1702,6 +1702,29 @@ 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();
+
+ // TODO: Return free when the entire lane is inactive.
+ // The expected asm sequence is:
+ // vid v10, v0.t
----------------
lukel97 wrote:
Is there not also a vcpop.m emitted? This is checking llvm/test/codegen/riscv/rvv/vector-extract-last-active.ll
https://github.com/llvm/llvm-project/pull/184067
More information about the llvm-commits
mailing list