Changes in directory llvm/lib/VMCore:
Function.cpp updated: 1.97 -> 1.98 Verifier.cpp updated: 1.139 -> 1.140 --- Log message: Add bswap intrinsics as documented in the Language Reference --- Diffs of the changes: (+35 -0) Function.cpp | 5 +++++ Verifier.cpp | 30 ++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) Index: llvm/lib/VMCore/Function.cpp diff -u llvm/lib/VMCore/Function.cpp:1.97 llvm/lib/VMCore/Function.cpp:1.98 --- llvm/lib/VMCore/Function.cpp:1.97 Thu Jan 12 20:15:39 2006 +++ llvm/lib/VMCore/Function.cpp Fri Jan 13 19:25:24 2006 @@ -207,6 +207,11 @@ 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; Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.139 llvm/lib/VMCore/Verifier.cpp:1.140 --- llvm/lib/VMCore/Verifier.cpp:1.139 Thu Jan 12 20:15:39 2006 +++ llvm/lib/VMCore/Verifier.cpp Fri Jan 13 19:25:24 2006 @@ -749,6 +749,36 @@ 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: _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits