[llvm] [X86][CodeGen] Support lowering for CCMP/CTEST (PR #91747)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Sun May 26 11:24:54 PDT 2024


================
@@ -54759,6 +54923,10 @@ static SDValue combineX86AddSub(SDNode *N, SelectionDAG &DAG,
   bool IsSub = X86ISD::SUB == N->getOpcode();
   unsigned GenericOpc = IsSub ? ISD::SUB : ISD::ADD;
 
+  if (IsSub && isOneConstant(N->getOperand(1)) && !N->hasAnyUseOfValue(0))
+    if (SDValue CMP = combineX86SubCmpForFlags(N, SDValue(N, 1), DAG, DCI, ST))
+      return CMP;
----------------
s-barannikov wrote:

This should use DCI.CombineTo accepting two SDValues, the first one of which should be the first (unused) result of SUB. The SUB will be removed later on.


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


More information about the llvm-commits mailing list