[PATCH] D92208: [AArch64][CostModel] Fixed costs for mul <2 x i64>

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 27 05:16:10 PST 2020


SjoerdMeijer added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp:647
+    if (VecTy && IsInt64)
+      return 1 * VecTy->getNumElements() + VecTy->getNumElements();
+    return (Cost + 1) * LT.first;
----------------
dmgreen wrote:
> Hmm. According this this it should have a cost around 8:
> https://godbolt.org/z/fjjEc7
> LT.first is the cost factor to get it to the MVE::v2i64 type. getScalarizationOverhead could be used to get that overhead.
> 
> What do you think of something like LT.first * (2 + 2*getScalarizationOverhead(extract) + getScalarizationOverhead(insert)) ? I'm not sure what cost that would give.
> Hmm. According this this it should have a cost around 8:
> https://godbolt.org/z/fjjEc7

I excluded the movs. In that link/example, the last two movs are for returning the vector, and the first 2 to shuffle arguments in place.
Thus, the instruction cost I think are: 1 instruction for the lane extract, and 1 for scalar mul.  Thus, for a <2 x i64> we would get 1 * 2 + 2 = 4, that's what I was trying to model here. What do you think?


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

https://reviews.llvm.org/D92208



More information about the llvm-commits mailing list