[llvm] [AArch64] Generalize costing for FP16 instructions (PR #150033)

David Green via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 7 10:00:46 PDT 2025


================
@@ -3975,6 +3975,26 @@ InstructionCost AArch64TTIImpl::getScalarizationOverhead(
   return DemandedElts.popcount() * (Insert + Extract) * VecInstCost;
 }
 
+std::optional<InstructionCost> AArch64TTIImpl::getFP16BF16PromoteCost(
+    Type *Ty, TTI::TargetCostKind CostKind, TTI::OperandValueInfo Op1Info,
+    TTI::OperandValueInfo Op2Info, bool IncludeTrunc,
+    std::function<InstructionCost(Type *)> InstCost) const {
+  if ((ST->hasFullFP16() || !Ty->getScalarType()->isHalfTy()) &&
+      !Ty->getScalarType()->isBFloatTy())
+    return std::nullopt;
----------------
davemgreen wrote:

Yeah I agree this is a bit complex to read.

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


More information about the llvm-commits mailing list