[llvm] [AMDGPU] Fold saddsat(x, -C) to ssubsat(x, C) when C is an inline constant (PR #216592)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 17 01:24:17 PDT 2026


================
@@ -1029,14 +1033,35 @@ class OpSelBinOpClampPat<SDPatternOperator node,
 let SubtargetPredicate = isGFX9Plus, True16Predicate = NotHasTrue16BitInsts in {
   def : OpSelBinOpClampPat<saddsat, V_ADD_I16_e64>;
   def : OpSelBinOpClampPat<ssubsat, V_SUB_I16_e64>;
+
+  let AddedComplexity = 15 in {
----------------
arsenm wrote:

These numbers are pretty arbitrary, minimal that works I suppose 

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


More information about the llvm-commits mailing list