[llvm] [RISCV][TTI] Implement cost of intrinsic active_lane_mask (PR #87931)

Shih-Po Hung via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 9 00:13:13 PDT 2024


================
@@ -863,6 +863,21 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
     }
     break;
   }
+  case Intrinsic::get_active_lane_mask: {
+    if (ST->hasVInstructions()) {
+      Type *ExpRetTy = VectorType::get(
+          ICA.getArgTypes()[0], cast<VectorType>(RetTy)->getElementCount());
+      auto LT = getTypeLegalizationCost(ExpRetTy);
+
+      // vid.v   v8  // considered hoisted
----------------
arcbbb wrote:

This poses a dilemma as both statements hold true:
1) the `vid.v` would be hoisted.
2) BasicImpl doesn't count it for all CostKind.

so I am leaning toward to consistency with the base implementation.

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


More information about the llvm-commits mailing list