[llvm] [AArch64][LV][SLP] Vectorizers use getFRemInstrCost for frem costs (PR #82488)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 23 08:51:06 PST 2024


================
@@ -881,6 +882,24 @@ InstructionCost TargetTransformInfo::getArithmeticInstrCost(
   return Cost;
 }
 
+InstructionCost TargetTransformInfo::getFRemInstrCost(
+    const TargetLibraryInfo *TLI, unsigned Opcode, Type *Ty,
+    TTI::TargetCostKind CostKind, OperandValueInfo Op1Info,
+    OperandValueInfo Op2Info, ArrayRef<const Value *> Args,
+    const Instruction *CxtI) const {
+  assert(Opcode == Instruction::FRem && "Instruction must be frem");
+
+  VectorType *VecTy = dyn_cast<VectorType>(Ty);
+  Type *ScalarTy = VecTy ? VecTy->getScalarType() : Ty;
----------------
paulwalker-arm wrote:

`getScalarType()` has the correct behaviour for vectors and scalars so you can confidently use `Ty-> getScalarType()` as part of `getLibFunc` call.

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


More information about the llvm-commits mailing list