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

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 30 02:20:16 PST 2020


dmgreen added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp:645
+    auto *VecTy = dyn_cast<FixedVectorType>(Ty);
+    bool IsInt64 = Ty->getScalarType()->isIntegerTy(64);
+    if (VecTy && IsInt64)
----------------
SjoerdMeijer wrote:
> dmgreen wrote:
> > I think this can just use LT.second == MVT::v2i64? (Otherwise it needs to account for scalable vectors, but dealing with the MVT is probably simpler).
> I have kept the check as it was because it checks for FixedVectorType, so looks correct to me, and with checking for MVT::v2i64 we would miss out on MVT::v4i64, etc.
getTypeLegalizationCost will return two things - the cost factor needed to convert to a legal type and the legal type it would convert it to. So for a v4i64 this would be a cost of 2 and legal type of v2i64.

i.e. I think this cost can just be `if (LT.second == MVT::v2i64)`, and that should capture all the cases we are interested in. (And something odd like a v2i40, which would be legalized to a v2i64 would also get the high cost, as far as I understand).


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

https://reviews.llvm.org/D92208



More information about the llvm-commits mailing list