aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-05-11 18:35:21 +0000
committerChris Lattner <sabre@nondot.org>2005-05-11 18:35:21 +0000
commit5c33c9a166c2d68d64c68d8097598d09d9af6c20 (patch)
treecdc1a7a21187c5d94f1977d3371aeb22ccf8182f
parent50d435f3a76a9df04bc20638db56a6d28164dd4b (diff)
Make sure to legalize generated ctpop nodes, convert tabs to spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21868 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeDAG.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 19285845de..a19e6119a7 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -1134,15 +1134,15 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
}
case ISD::CTLZ: {
/* for now, we do this:
- x = x | (x >> 1);
- x = x | (x >> 2);
- ...
- x = x | (x >>16);
- x = x | (x >>32); // for 64-bit input
- return popcount(~x);
+ x = x | (x >> 1);
+ x = x | (x >> 2);
+ ...
+ x = x | (x >>16);
+ x = x | (x >>32); // for 64-bit input
+ return popcount(~x);
- but see also: http://www.hackersdelight.org/HDcode/nlz.cc */
- MVT::ValueType VT = Tmp1.getValueType();
+ but see also: http://www.hackersdelight.org/HDcode/nlz.cc */
+ MVT::ValueType VT = Tmp1.getValueType();
MVT::ValueType ShVT = TLI.getShiftAmountTy();
unsigned len = getSizeInBits(VT);
for (unsigned i = 0; (1U << i) <= (len / 2); ++i) {
@@ -1151,19 +1151,19 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
DAG.getNode(ISD::SRL, VT, Tmp1, Tmp3));
}
Tmp3 = DAG.getNode(ISD::XOR, VT, Tmp1, DAG.getConstant(~0ULL, VT));
- Result = DAG.getNode(ISD::CTPOP, VT, Tmp3);
+ Result = LegalizeOp(DAG.getNode(ISD::CTPOP, VT, Tmp3));
break;
}
case ISD::CTTZ: {
- // for now, we use: { return popcount(~x & (x - 1)); }
- // but see also http://www.hackersdelight.org/HDcode/ntz.cc )
- MVT::ValueType VT = Tmp1.getValueType();
- Tmp2 = DAG.getConstant(~0ULL, VT);
- Tmp3 = DAG.getNode(ISD::AND, VT,
- DAG.getNode(ISD::XOR, VT, Tmp1, Tmp2),
- DAG.getNode(ISD::SUB, VT, Tmp1,
- DAG.getConstant(1, VT)));
- Result = DAG.getNode(ISD::CTPOP, VT, Tmp3);
+ // for now, we use: { return popcount(~x & (x - 1)); }
+ // but see also http://www.hackersdelight.org/HDcode/ntz.cc
+ MVT::ValueType VT = Tmp1.getValueType();
+ Tmp2 = DAG.getConstant(~0ULL, VT);
+ Tmp3 = DAG.getNode(ISD::AND, VT,
+ DAG.getNode(ISD::XOR, VT, Tmp1, Tmp2),
+ DAG.getNode(ISD::SUB, VT, Tmp1,
+ DAG.getConstant(1, VT)));
+ Result = LegalizeOp(DAG.getNode(ISD::CTPOP, VT, Tmp3));
break;
}
default: