[llvm] [RISCV][TTI] Implement cost of llvm.experimental.vector.extract.last.active (PR #184067)
Ryan Buchner via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 4 22:22:36 PST 2026
================
@@ -1702,6 +1702,32 @@ 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);
+
+ // TODO: Return cheaper cost when the entire lane is inactive.
+ // The expected asm sequence is:
+ // vcpop.m a0, v0
+ // beqz a0, exit # Return passthru when the entire lane is inactive.
+ // vid v10, v0.t
+ // vredmaxu.vs v10, v10, v10
+ // vmv.x.s a0, v10
+ // zext.b a0, a0
----------------
bababuck wrote:
Should the `beqz` and `zext` be included in the cost?
https://github.com/llvm/llvm-project/pull/184067
More information about the llvm-commits
mailing list