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

Shengchen Kan via llvm-commits llvm-commits at lists.llvm.org
Sun May 26 19:10:58 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;
----------------
KanRobert wrote:

What does this `DCI.CombineTo` look like? I am trying replace the second result of `SUB` (old flag) with the result of CCMP (new flag). Not understand why you suggest the first parameter is the first (unused) result of SUB.

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


More information about the llvm-commits mailing list