[PATCH] D132784: [AArch64][TTI] Add cost table entry for trunc over vector of integers.

Mingming Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 2 09:41:43 PDT 2022


mingmingl added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp:1611
+    // FIXME: v4i64 -> v4i8 should be optimized to 1 uzp1 + 1 xtn
+    {ISD::TRUNCATE, MVT::v4i8, MVT::v4i64, 3},
+    {ISD::TRUNCATE, MVT::v4i16, MVT::v4i32, 1},   // xtn
----------------
dmgreen wrote:
> mingmingl wrote:
> > dmgreen wrote:
> > > It looks like it is already 2 here: https://godbolt.org/z/T4rTqf1Tx. I guess it is not very reliable at the moment.
> > I filed https://github.com/llvm/llvm-project/issues/57502 to track this difference and took the liberty to update this number to 2 in this patch.
> > 
> > Re-format the table entries so columns are aligned -> only <4 x i64> -> <4 x i8> entry is updated in `cast.ll` as a result of this entry update, compared with reviewed version.
> > 
> > Please let me know if it's more idiomatic to use the higher one (when the codegen is not very reliable and the diff is small). Will hold this patch for a few more days and possibly commit on next Monday if the change from 3 to 2 looks good. 
> > 
> > Thanks for reviews!
> I like removing the FIXME, but if the score is somewhere between 2 and 3, then 3 is probably the better option. It seems to be 3 in more cases where the result gets used, too.
Got it, thanks! Updated this entry to 3 and going to commit.


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

https://reviews.llvm.org/D132784



More information about the llvm-commits mailing list