[llvm-branch-commits] [llvm] [AArch64] SLP can vectorize frem (PR #82488)

Paul Walker via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Feb 22 07:15:32 PST 2024


================
@@ -1031,6 +1032,22 @@ APInt llvm::possiblyDemandedEltsInMask(Value *Mask) {
   return DemandedElts;
 }
 
+InstructionCost
+llvm::getVecLibCallCost(const Instruction *I, const TargetTransformInfo *TTI,
+                        const TargetLibraryInfo *TLI, VectorType *VecTy,
+                        TargetTransformInfo::TargetCostKind CostKind) {
+  SmallVector<Type *, 4> OpTypes;
+  for (auto &Op : I->operands())
+    OpTypes.push_back(Op->getType());
+
+  LibFunc Func;
+  if (TLI->getLibFunc(I->getOpcode(), I->getType(), Func) &&
+      TLI->isFunctionVectorizable(TLI->getName(Func), VecTy->getElementCount()))
+    return TTI->getCallInstrCost(nullptr, VecTy, OpTypes, CostKind);
+
+  return InstructionCost::getInvalid();
----------------
paulwalker-arm wrote:

Given you've pulled this from LoopVectorize so the "hack" is easier to track I would rather you also update LoopVectorize to use it and thus verify existing behaviour is honoured.

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


More information about the llvm-branch-commits mailing list