[llvm] [AArch64][CostModel] Reduce the cost of fadd reduction with fast flag (PR #108791)

Sushant Gokhale via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 16 03:17:33 PDT 2024


================
@@ -4147,6 +4147,22 @@ AArch64TTIImpl::getArithmeticReductionCost(unsigned Opcode, VectorType *ValTy,
   switch (ISD) {
   default:
     break;
+  case ISD::FADD: {
+    if (MTy.isVector()) {
+      // FIXME: Consider cases where the number of vector elements is not power
+      // of 2.
+      const unsigned NElts = MTy.getVectorNumElements();
+      if (ValTy->getElementCount().getFixedValue() >= 2 && NElts >= 2 &&
----------------
sushgokh wrote:

This is only for fixed length vectors. For scalable vectors, the  [control flow](https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp#L4102) is different.

I havent checked the case with SVE to be honest.

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


More information about the llvm-commits mailing list