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

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 22:05:51 PST 2025


================
@@ -2848,6 +2848,11 @@ 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 {
+  auto LMULCost = getLMULCost(VT);
+  if (Subtarget.hasFastVRGather() && LMULCost.isValid()) {
+    unsigned Log = Log2_64(*LMULCost.getValue());
+    return LMULCost * Log;
+  }
   return getLMULCost(VT) * getLMULCost(VT);
----------------
topperc wrote:

Can we reuse the `LMULCost` local here? No reason to call it 3 times.

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


More information about the llvm-commits mailing list