[PATCH] D150482: [AArch64] Don't use tbl lowering if ZExt can be folded into user.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 15 08:39:01 PDT 2023


fhahn marked 4 inline comments as done.
fhahn added a comment.

Thanks for taking a look. Comments should be addressed in baebe719a52acbe0a5aaa04dcf1abcfd4035bf1f <https://reviews.llvm.org/rGbaebe719a52acbe0a5aaa04dcf1abcfd4035bf1f> and response inline.



================
Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:14657
+    auto SrcWidth = SrcTy->getElementType()->getScalarSizeInBits();
+    if (TTI.getCastInstrCost(I->getOpcode(), DstTy, TruncDstType,
+                             TargetTransformInfo::getCastContextHint(I),
----------------
v01dXYZ wrote:
> Sorry the question is dumb but why does it use `TruncType` instead of `DoubleSrcType := SrcType with Element type width multiplied by 2` ?
TBL lowering is not profitable if only one `zext` step is saved. If the zext to the next smaller type is free (i.e. it can be folded into the user), then only 1 step will be needed and no tbl should be generated


================
Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:14664
+      DstTy = TruncDstType;
+      DstWidth = TruncDstType->getElementType()->getScalarSizeInBits();
     }
----------------
v01dXYZ wrote:
> This assignment is not necessary.
Thanks, removed!


================
Comment at: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp:1888
+      // type.
+      if (Op == I || Cast->getSrcTy() == Cast->getSrcTy())
+        SrcTys.push_back(Src);
----------------
v01dXYZ wrote:
> There is a typo (I think).
Yes, this should check I's source type, should be fixed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150482



More information about the llvm-commits mailing list