[llvm] [AArch64] Prevent generating tbl instruction instead of smull (PR #106375)

David Green via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 4 04:19:29 PDT 2024


================
@@ -16795,6 +16795,16 @@ bool AArch64TargetLowering::optimizeExtendOrTruncateConversion(
 
       DstTy = TruncDstType;
     }
+
+    // mul(zext(i8), sext) can be transformed into smull(zext, sext) when
+    // destination type is at least SrcWidth * 4, which is faster than using tbl
+    // instructions
----------------
davemgreen wrote:

I happened to be looking at something else yesterday where isWideningInstr should maybe have been returning true if the size was more than double, but I think it might need to be more precise than that. Part of the extend becomes free, not the entire operation, and it should be accounted for somewhere. Whether that means that isWideningInstruction should be true or not I didn't look into, I would guess it probably could so long as the extend cost was accounted for.

https://github.com/llvm/llvm-project/pull/106375


More information about the llvm-commits mailing list