Add llvm.sqrt intrinsic, patch contributed by Morten Ofstad

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21627 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-04-30 03:44:07 +00:00
parent 9f56b1feeb
commit eed37bad01
4 changed files with 13 additions and 1 deletions

View File

@ -63,6 +63,7 @@ namespace Intrinsic {
// libm related functions.
isunordered, // Return true if either argument is a NaN
sqrt,
// Input/Output intrinsics.
readport,

View File

@ -702,7 +702,7 @@ namespace {
static const char *DoesntAccessMemoryTable[] = {
// LLVM intrinsics:
"llvm.frameaddress", "llvm.returnaddress", "llvm.readport",
"llvm.isunordered",
"llvm.isunordered", "llvm.sqrt",
"abs", "labs", "llabs", "imaxabs", "fabs", "fabsf", "fabsl",
"trunc", "truncf", "truncl", "ldexp",

View File

@ -245,6 +245,7 @@ unsigned Function::getIntrinsicID() const {
if (getName() == "llvm.setjmp") return Intrinsic::setjmp;
if (getName() == "llvm.sigsetjmp") return Intrinsic::sigsetjmp;
if (getName() == "llvm.siglongjmp") return Intrinsic::siglongjmp;
if (getName() == "llvm.sqrt") return Intrinsic::sqrt;
break;
case 'v':
if (getName() == "llvm.va_copy") return Intrinsic::vacopy;

View File

@ -723,6 +723,16 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) {
NumArgs = 2;
break;
case Intrinsic::sqrt:
Assert1(FT->getNumParams() == 1,
"Illegal # arguments for intrinsic function!", IF);
Assert1(FT->getParamType(0)->isFloatingPoint(),
"Argument is not a floating point type!", IF);
Assert1(FT->getReturnType() == FT->getParamType(0),
"Return type is not the same as argument type!", IF);
NumArgs = 1;
break;
case Intrinsic::setjmp: NumArgs = 1; break;
case Intrinsic::longjmp: NumArgs = 2; break;
case Intrinsic::sigsetjmp: NumArgs = 2; break;