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

David Green via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 2 03:34:35 PST 2026


davemgreen wrote:

I'm not 100% on which is better, but I would opt for keeping the smull/umull where we can use it. That should be a sensible default on most cpus as the instruction count is lower and latency can be lower.  smull is `v2i64 mul(sext v2i32, sext v2i32)` (where one of the operands could be a constant, implicitly sext'd). A umull is `v2i64 mul(zext v2i32, zext v2i32)` so checking that the operand is a zext / sext would help prevent turning it into a add+shift. There may be other cases that use known-bits, but they might be fine being transformed, it can depend on whether they will require a truncate. Feel free to regenerate those tests but make sure there are tests for `mul(sext, const)` directly.

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


More information about the llvm-commits mailing list