[PATCH] D25966: [AArch64] Lower multiplication by a constant int to shl+add+shl

Renato Golin via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 12 07:09:34 PST 2016


rengolin added a comment.

With the minor comment, this looks good to me. But I'll let @Gerolf and @mcrosier have a final look and approve.

Thanks!



================
Comment at: lib/Target/AArch64/AArch64ISelLowering.cpp:7661
+    // (mul x, (2^N + 1) * 2^M) => (shl (add (shl x, N), x), M)
+    // Use ConstantA instead of ConstValue to support the last one.
+    APInt CAMinus1 = ConstantA - 1;
----------------
IIGIR, the old case is still covered because if `TrailingZeroes == 0`, then `ConstantA == ConstValue`.

Your comment should reflect that. Not here, but above, before `ConstantA`'s instantiation.

Here, you can just add the new case:

    // (mul x, (2^N + 1) * 2^M) => (shl (add (shl x, N), x), M)


Repository:
  rL LLVM

https://reviews.llvm.org/D25966





More information about the llvm-commits mailing list