mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21676 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -206,6 +206,11 @@ unsigned Function::getIntrinsicID() const {
|
||||
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;
|
||||
|
@@ -723,6 +723,18 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) {
|
||||
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);
|
||||
|
Reference in New Issue
Block a user