[llvm] [AArch64] Generalize costing for FP16 instructions (PR #150033)
Cullen Rhodes via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 5 02:26:29 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;
----------------
c-rhodes wrote:
this really makes my head hurt, if I understand correctly this is equivalent to:
```
if (!IsHalfTy && !IsBFloatTy)
return std::nullopt;
if (HasFullFP16 && IsHalfTy)
return std::nullopt;
```
?
https://github.com/llvm/llvm-project/pull/150033
More information about the llvm-commits
mailing list