[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue May 10 22:27:26 PDT 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.101 -> 1.102
---
Log message:

Add some notes for expanding clz/ctz


---
Diffs of the changes:  (+21 -4)

 LegalizeDAG.cpp |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.101 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.102
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.101	Wed May 11 00:21:31 2005
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Wed May 11 00:27:09 2005
@@ -1132,10 +1132,27 @@
         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;






More information about the llvm-commits mailing list