[llvm] [X86] Optimized ADD + ADC to ADC (PR #173543)

Sebastian Buchwald via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 18 15:24:15 PST 2026


================
@@ -58163,6 +58166,17 @@ static SDValue combineX86AddSub(SDNode *N, SelectionDAG &DAG,
     }
   }
 
+  // Fold ADD(ADC(Y, C1, CF), C2) -> ADC(Y, C1 + C2, CF)
----------------
UniQP wrote:

I missed that the corresponding intrinsics (e.g., `llvm.x86.addcarry.32`) are x86-specific and thus cannot be used for other backends.

I'm still wondering whether this rule (and the ADC(ADD…) variant) should be added as part of this pull request or in a separate one.

Also, is there a test case for this rule that doesn't use `llvm.x86.addcarry` intrinsics?

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


More information about the llvm-commits mailing list