diff options
| author | Nate Begeman <natebegeman@mac.com> | 2006-01-14 01:25:24 +0000 |
|---|---|---|
| committer | Nate Begeman <natebegeman@mac.com> | 2006-01-14 01:25:24 +0000 |
| commit | 6fb3bd6a658940287789198d3207b0da04c0a4e6 (patch) | |
| tree | 7d3b9be2b6b00fd564f0b884de5c1999b1985890 /lib/VMCore | |
| parent | 6283760cd13fa3f41c7f6462456661ea54ded980 (diff) | |
| download | external_llvm-6fb3bd6a658940287789198d3207b0da04c0a4e6.zip external_llvm-6fb3bd6a658940287789198d3207b0da04c0a4e6.tar.gz external_llvm-6fb3bd6a658940287789198d3207b0da04c0a4e6.tar.bz2 | |
Add bswap intrinsics as documented in the Language Reference
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25309 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
| -rw-r--r-- | lib/VMCore/Function.cpp | 5 | ||||
| -rw-r--r-- | lib/VMCore/Verifier.cpp | 30 |
2 files changed, 35 insertions, 0 deletions
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index 0cbe14c..3abfef9 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -207,6 +207,11 @@ unsigned Function::getIntrinsicID() const { assert(getName().size() != 5 && "'llvm.' is an invalid intrinsic name!"); switch (getName()[5]) { + case 'b': + if (getName() == "llvm.bswap.i16") return Intrinsic::bswap_i16; + if (getName() == "llvm.bswap.i32") return Intrinsic::bswap_i32; + if (getName() == "llvm.bswap.i64") return Intrinsic::bswap_i64; + break; case 'c': if (getName() == "llvm.ctpop") return Intrinsic::ctpop; if (getName() == "llvm.cttz") return Intrinsic::cttz; diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 9dd7184..f67a497 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -749,6 +749,36 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) { NumArgs = 0; break; + case Intrinsic::bswap_i16: + 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->getReturnType() == Type::UShortTy, + "Return type is not ushort!", IF); + NumArgs = 1; + break; + + case Intrinsic::bswap_i32: + 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->getReturnType() == Type::UIntTy, + "Return type is not uint!", IF); + NumArgs = 1; + break; + + case Intrinsic::bswap_i64: + 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->getReturnType() == Type::ULongTy, + "Return type is not ulong!", IF); + NumArgs = 1; + break; + case Intrinsic::ctpop: case Intrinsic::ctlz: case Intrinsic::cttz: |
