[llvm] [AArch64] Optimize vector multiplications by certain constants for v2i64 (PR #183827)

David Green via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 6 03:19:55 PST 2026


https://github.com/davemgreen commented:

This sounds like a good place for it. The other thing that decomposeMulByConstant can do is decompose to
```
  // (2) multiply-by-(power-of-2 +/- power-of-2) into shifts and add/sub.
  // mul x, (2^N + 2^M) --> (add (shl x, N), (shl x, M))
  // mul x, (2^N - 2^M) --> (sub (shl x, N), (shl x, M))
```
Is that worth doing too? It would be less than the 6 instructions needed to scalarize.

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


More information about the llvm-commits mailing list