[clang] [llvm] [AMDGPU] Add dot product patterns with saturating add (clamp) (PR #187945)

via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 12 09:42:37 PDT 2026


================
@@ -16946,6 +16946,73 @@ SDValue SITargetLowering::performAddCombine(SDNode *N,
   return SDValue();
 }
 
+// Try to fold saturating add with dot product intrinsic into dot instruction
+// with clamp. Matches patterns like:
+// uaddsat(dot4(..., 0), c) -> dot4(..., c) clamp
+// uaddsat(dot2(..., 0), c) -> dot2(..., c) clamp
+SDValue SITargetLowering::performSatAddCombine(SDNode *N,
----------------
addmisol wrote:

No, performSatAddCombine is currently not being called because ISD::UADDSAT/ISD::SADDSAT are not registered with setTargetDAGCombine. Without that registration, the DAG combiner never visits these nodes.

  Should I:
  1. Remove performSatAddCombine since the main paths are already covered, or
  2. Add setTargetDAGCombine({..., ISD::UADDSAT, ISD::SADDSAT, ..}) to make it functional?

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


More information about the cfe-commits mailing list