[llvm] [AArch64] Improve operand sinking for mul instructions (PR #116604)

Hari Limaye via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 5 08:45:48 PST 2024


================
@@ -5168,26 +5168,46 @@ bool AArch64TTIImpl::isProfitableToSinkOperands(
     return false;
   }
   case Instruction::Mul: {
+    auto ShouldSinkSplatForIndexedVariant = [](Value *V) {
+      auto *Ty = cast<VectorType>(V->getType());
+      // For SVE the lane-indexing is within 128-bits, so we can't fold splats.
+      if (Ty->isScalableTy())
+        return false;
+
+      // Indexed variants of Mul exist for i16 and i32 element types only.
+      auto ElemVT = MVT::getVT(Ty->getElementType(), /*HandleUnknown=*/true);
+      return (ElemVT == MVT::i16 || ElemVT == MVT::i32);
----------------
hazzlim wrote:

Ah ok nice, that's a better way of doing it. I've updated to do this.

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


More information about the llvm-commits mailing list