[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
================
@@ -5919,6 +5919,44 @@ static unsigned selectUmullSmull(SDValue &N0, SDValue &N1, SelectionDAG &DAG,
return 0;
}
+// Transform mul<v2i64, splat(2^n +-1)> into a SHL and ADD/SUB
+// this transormation is much faster when vector mul is not supported
+static SDValue convertMulToShlAdd(SDNode *N, SelectionDAG &DAG) {
+ const SDNode *Operand = N->getOperand(1).getNode();
+ APInt SplatValue;
+ ISD::isConstantSplatVector(Operand, SplatValue);
+
+ // Not a constant splat so should just stay as a mulitplcation operation
+ if (!SplatValue.getBoolValue())
----------------
davemgreen wrote:
`if (!ISD::isConstantSplatVector(Operand, SplatValue) || !SplatValue.getBoolValue())`
https://github.com/llvm/llvm-project/pull/183827
More information about the llvm-commits
mailing list