Fix a FIXME: use an apint in CTTZ legalization.
authorDuncan Sands <baldrick@free.fr>
Thu, 10 Jul 2008 15:30:54 +0000 (15:30 +0000)
committerDuncan Sands <baldrick@free.fr>
Thu, 10 Jul 2008 15:30:54 +0000 (15:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53406 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp

index 6c8f546be85582d6381ba9b270b2e19e62a7dfd2..f633159a3db0ef0e3082853604a5aa21effff7b8 100644 (file)
@@ -363,9 +363,9 @@ SDOperand DAGTypeLegalizer::PromoteIntRes_CTTZ(SDNode *N) {
   // The count is the same in the promoted type except if the original
   // value was zero.  This can be handled by setting the bit just off
   // the top of the original type.
-  Op = DAG.getNode(ISD::OR, NVT, Op,
-                   // FIXME: Do this using an APINT constant.
-                   DAG.getConstant(1UL << OVT.getSizeInBits(), NVT));
+  APInt TopBit(NVT.getSizeInBits(), 0);
+  TopBit.set(OVT.getSizeInBits());
+  Op = DAG.getNode(ISD::OR, NVT, Op, DAG.getConstant(TopBit, NVT));
   return DAG.getNode(ISD::CTTZ, NVT, Op);
 }