[llvm] [RISCV] Tune flag for fast vrgather.vv (PR #124664)

Petr Penzin via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 5 16:18:05 PST 2025


================
@@ -2848,7 +2848,12 @@ InstructionCost RISCVTargetLowering::getLMULCost(MVT VT) const {
 /// is generally quadratic in the number of vreg implied by LMUL.  Note that
 /// operand (index and possibly mask) are handled separately.
 InstructionCost RISCVTargetLowering::getVRGatherVVCost(MVT VT) const {
-  return getLMULCost(VT) * getLMULCost(VT);
+  auto LMULCost = getLMULCost(VT);
+  if (Subtarget.hasFastVRGather() && LMULCost.isValid()) {
+    unsigned Log = Log2_64(*LMULCost.getValue());
+    return LMULCost * Log;
----------------
ppenzin wrote:

Addressed

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


More information about the llvm-commits mailing list