[llvm] [AArch64][Codegen]Transform saturating smull to sqdmulh (PR #143671)

David Green via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 2 23:55:25 PDT 2025


================
@@ -20918,6 +20929,90 @@ static SDValue performBuildVectorCombine(SDNode *N,
   return SDValue();
 }
 
+// A special combine for the sqdmulh family of instructions.
+// smin( sra ( mul( sext v0, sext v1 ) ), SHIFT_AMOUNT ),
+// SATURATING_VAL ) can be reduced to sqdmulh(...)
+static SDValue trySQDMULHCombine(SDNode *N, SelectionDAG &DAG) {
+
+  if (N->getOpcode() != ISD::SMIN)
+    return SDValue();
+
+  EVT VT = N->getValueType(0);
+
+  if (!VT.isVector() || VT.getScalarSizeInBits() > 64)
----------------
davemgreen wrote:

Makes sure the type isnt scalable too for the moment.

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


More information about the llvm-commits mailing list