[llvm-commits] CVS: llvm/lib/VMCore/Function.cpp Verifier.cpp
Andrew Lenharth
alenhar2 at cs.uiuc.edu
Tue May 3 10:19:55 PDT 2005
Changes in directory llvm/lib/VMCore:
Function.cpp updated: 1.93 -> 1.94
Verifier.cpp updated: 1.131 -> 1.132
---
Log message:
Implement count leading zeros (ctlz), count trailing zeros (cttz), and count
population (ctpop). Generic lowering is implemented, however only promotion
is implemented for SelectionDAG at the moment.
More coming soon.
---
Diffs of the changes: (+17 -0)
Function.cpp | 5 +++++
Verifier.cpp | 12 ++++++++++++
2 files changed, 17 insertions(+)
Index: llvm/lib/VMCore/Function.cpp
diff -u llvm/lib/VMCore/Function.cpp:1.93 llvm/lib/VMCore/Function.cpp:1.94
--- llvm/lib/VMCore/Function.cpp:1.93 Fri Apr 29 22:43:51 2005
+++ llvm/lib/VMCore/Function.cpp Tue May 3 12:19:30 2005
@@ -206,6 +206,11 @@
assert(getName().size() != 5 && "'llvm.' is an invalid intrinsic name!");
switch (getName()[5]) {
+ case 'c':
+ if (getName() == "llvm.ctpop") return Intrinsic::ctpop;
+ if (getName() == "llvm.cttz") return Intrinsic::cttz;
+ if (getName() == "llvm.ctlz") return Intrinsic::ctlz;
+ break;
case 'd':
if (getName() == "llvm.dbg.stoppoint") return Intrinsic::dbg_stoppoint;
if (getName() == "llvm.dbg.region.start")return Intrinsic::dbg_region_start;
Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.131 llvm/lib/VMCore/Verifier.cpp:1.132
--- llvm/lib/VMCore/Verifier.cpp:1.131 Fri Apr 29 22:43:52 2005
+++ llvm/lib/VMCore/Verifier.cpp Tue May 3 12:19:30 2005
@@ -723,6 +723,18 @@
NumArgs = 2;
break;
+ case Intrinsic::ctpop:
+ case Intrinsic::ctlz:
+ case Intrinsic::cttz:
+ Assert1(FT->getNumParams() == 1,
+ "Illegal # arguments for intrinsic function!", IF);
+ Assert1(FT->getReturnType() == FT->getParamType(0),
+ "Return type does not match source type", IF);
+ Assert1(FT->getParamType(0)->isIntegral(),
+ "Argument must be of an int type!", IF);
+ NumArgs = 1;
+ break;
+
case Intrinsic::sqrt:
Assert1(FT->getNumParams() == 1,
"Illegal # arguments for intrinsic function!", IF);
More information about the llvm-commits
mailing list