[PATCH] D47559: [SelectionDAG] Expand UADDO/USUBO into ADD/SUBCARRY if legal for target

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 30 14:50:39 PDT 2018


efriedma added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:2290
+      return DAG.getNode(ISD::UADDO, DL, N->getVTList(), N0, N1);
+  }
 
----------------
You probably also need to fix visitSUBCARRY.


================
Comment at: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:3506
+    if (TLI.isOperationLegalOrCustom(OpcCarry, Node->getValueType(0))) {
+      SDValue CarryIn = DAG.getConstant(!IsAdd, dl, Node->getValueType(1));
+      SDValue NodeCarry = DAG.getNode(OpcCarry, dl, Node->getVTList(),
----------------
The third operand to SUBCARRY is actually a x86-style borrow, so it should be zero here.


Repository:
  rL LLVM

https://reviews.llvm.org/D47559





More information about the llvm-commits mailing list