[PATCH] D73158: [AArch64TTI] AArch64 supports NT vector stores through STNP.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 22 10:42:12 PST 2020


fhahn marked 2 inline comments as done.
fhahn added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h:188-189
+              Ty->isIntegerTy(128)) &&
+             (StoreSize == 16 || StoreSize == 32 || StoreSize == 64 ||
+              StoreSize == 128 || StoreSize == 256);
+    }
----------------
dmgreen wrote:
> Are these because the vectorizer will run this with:
> 
>           // Arbitrarily try a vector of 2 elements.
>           Type *VecTy = VectorType::get(T, /*NumElements=*/2);
>           ...
>           if (!TTI->isLegalNTStore(VecTy, *Alignment))
> 
> And decides at that point if it is legal or not? Without knowing real vector widths.
I've generalised the checks, but yes, that is the reason. I think what LV does is relatively reasonable. LV should only create power of 2 vectors and if <2 x ty> is legal, any vector it creates can be broken down to <2 x ty> I think.


================
Comment at: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h:191
+    }
+    return BaseT::isLegalMaskedStore(DataType, Alignment);
+  }
----------------
dmgreen wrote:
> isLegalMaskedStore->isLegalNTStore
> 
> It seems that the base version of isLegalNTStore just checks:
>     // By default, assume nontemporal memory stores are available for stores
>     // that are aligned and have a size that is a power of 2.
>     unsigned DataSize = DL.getTypeStoreSize(DataType);
>     return Alignment >= DataSize && isPowerOf2_32(DataSize);
> I'm guessing that it is the alignment that is causing problems for these larger vectors?
I don't think the default implementation is relevant for AArch64. I could not find anything in ArmARM that would indicate any alignment requirements on STNP/LDNP addresses. I think we should probably handle non-vector types here similar to vector types, but probably best done as follow-on change (also, I don't think there are any non-vector users currently in tree)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73158/new/

https://reviews.llvm.org/D73158





More information about the llvm-commits mailing list