OSDN Git Service

Use ADDC if it is valid at any smaller size. Do it right this time
authorAndrew Lenharth <andrewl@lenharth.org>
Tue, 7 Oct 2008 17:09:16 +0000 (17:09 +0000)
committerAndrew Lenharth <andrewl@lenharth.org>
Tue, 7 Oct 2008 17:09:16 +0000 (17:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57248 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

index 428e161..b353569 100644 (file)
@@ -6445,14 +6445,17 @@ void SelectionDAGLegalize::ExpandOp(SDValue Op, SDValue &Lo, SDValue &Hi){
     unsigned OpV = Node->getOpcode() == ISD::ADD ? ISD::ADDC : ISD::SUBC;
     bool hasCarry = false;
     if (NVT == MVT::i64)
-      hasCarry |= TLI.isOperationLegal(OpV, MVT::i32)
+      hasCarry |= TLI.isOperationLegal(OpV, MVT::i64)
+        | TLI.isOperationLegal(OpV, MVT::i32)
         | TLI.isOperationLegal(OpV, MVT::i16)
         | TLI.isOperationLegal(OpV, MVT::i8);
     if (NVT == MVT::i32)
-      hasCarry |= TLI.isOperationLegal(OpV, MVT::i16)
+      hasCarry |= TLI.isOperationLegal(OpV, MVT::i32)
+        | TLI.isOperationLegal(OpV, MVT::i16)
         | TLI.isOperationLegal(OpV, MVT::i8);
     if (NVT == MVT::i16)
-      hasCarry |= TLI.isOperationLegal(OpV, MVT::i8);
+      hasCarry |= TLI.isOperationLegal(OpV, MVT::i16)
+        | TLI.isOperationLegal(OpV, MVT::i8);
       
     if(hasCarry) {
       if (Node->getOpcode() == ISD::ADD) {