[llvm] [LV][AArch64] LoopVectorizer allows scalable frem instructions (PR #76247)
Paschalis Mpeis via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 9 09:36:32 PST 2024
================
@@ -7142,6 +7142,19 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I, ElementCount VF,
Legal->isInvariant(Op2))
Op2Info.Kind = TargetTransformInfo::OK_UniformValue;
+ // Some targets replace frem with vector library calls.
+ if (I->getOpcode() == Instruction::FRem && VectorTy->isScalableTy()) {
+ LibFunc Func;
+ if (TLI->getLibFunc(I->getOpcode(), I->getType(), Func)) {
+ if (TLI->isFunctionVectorizable(TLI->getName(Func))) {
+ SmallVector<Type *, 4> OpTypes;
+ for (auto &Op : I->operands())
+ OpTypes.push_back(Op->getType());
+ return TTI.getCallInstrCost(nullptr, VectorTy, OpTypes, CostKind);
----------------
paschalis-mpeis wrote:
Now it compares against the default cost. Since this is now in place, the restriction to scalable types (in the [next comment](https://github.com/llvm/llvm-project/pull/76247#discussion_r1441661371) is lifted.
https://github.com/llvm/llvm-project/pull/76247
More information about the llvm-commits
mailing list