Legalize this correctly
authorChris Lattner <sabre@nondot.org>
Wed, 11 May 2005 05:09:47 +0000 (05:09 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 11 May 2005 05:09:47 +0000 (05:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21859 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

index d59e335c18758c1e3e1f3482c5d5c5272c4a8df5..2f72dd4fa94fddc5daafdc67ea958f5c36c3769b 100644 (file)
@@ -2173,7 +2173,9 @@ void SelectionDAGLegalize::ExpandOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi){
 
   case ISD::CTPOP:
     ExpandOp(Node->getOperand(0), Lo, Hi);
-    Lo = DAG.getNode(ISD::ADD, NVT, Lo, Hi);
+    Lo = DAG.getNode(ISD::ADD, NVT,          // ctpop(HL) -> ctpop(H)+ctpop(L)
+                     DAG.getNode(ISD::CTPOP, NVT, Lo),
+                     DAG.getNode(ISD::CTPOP, NVT, Hi));
     Hi = DAG.getConstant(0, NVT);
     break;