aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-05-11 05:27:09 +0000
committerChris Lattner <sabre@nondot.org>2005-05-11 05:27:09 +0000
commit18aa680a96c49cf9e28b52f5ab3f2c4f98793636 (patch)
tree78510a75a0b05a0043edbae00ef58f71da13928b
parente3ef0a8b9f79d77116e888ffe51730c8279b7363 (diff)
Add some notes for expanding clz/ctz
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21862 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeDAG.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 27e621f6d8..0f6f3d5915 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -1132,10 +1132,27 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
Result = Tmp1;
break;
}
-// case ISD::CTTZ:
-// break;
-// case ISD::CTLZ:
-// break;
+ case ISD::CTTZ:
+ /* This should be used for targets that support ctpop:
+int nlz5(unsigned x) {
+ int pop(unsigned x);
+
+ x = x | (x >> 1);
+ x = x | (x >> 2);
+ x = x | (x >> 4);
+ x = x | (x >> 8);
+ x = x | (x >>16);
+ return ctpop(~x);
+}
+ See also: http://www.hackersdelight.org/HDcode/nlz.cc
+*/
+
+ assert(0 && "Cannot expand this yet!");
+ break;
+ case ISD::CTLZ:
+ // See Also: http://www.hackersdelight.org/HDcode/ntz.cc
+ assert(0 && "Cannot expand this yet!");
+ break;
default:
assert(0 && "Cannot expand this yet!");
break;