diff --git a/llvm/include/llvm/Intrinsics.h b/llvm/include/llvm/Intrinsics.h index 56ecb4f1e61b..8cca2cd32669 100644 --- a/llvm/include/llvm/Intrinsics.h +++ b/llvm/include/llvm/Intrinsics.h @@ -59,7 +59,8 @@ namespace Intrinsic { memmove, // Copy potentially overlapping memory blocks memset, // Fill memory with a byte value - // Standard libm functions. + // libm related functions. + isnan, // Return true if fp argument is a NAN. // Input/Output intrinsics. readport, @@ -67,9 +68,6 @@ namespace Intrinsic { readio, writeio, - // Support for unordered compare intrinsic - isunordered, - //===------------------------------------------------------------------===// // This section defines intrinsic functions used to represent Alpha // instructions. diff --git a/llvm/lib/VMCore/Function.cpp b/llvm/lib/VMCore/Function.cpp index 82f3645acb10..a0f86d55e54d 100644 --- a/llvm/lib/VMCore/Function.cpp +++ b/llvm/lib/VMCore/Function.cpp @@ -223,7 +223,7 @@ unsigned Function::getIntrinsicID() const { if (getName() == "llvm.gcroot") return Intrinsic::gcroot; break; case 'i': - if (getName() == "llvm.isunordered") return Intrinsic::isunordered; + if (getName() == "llvm.isnan") return Intrinsic::isnan; break; case 'l': if (getName() == "llvm.longjmp") return Intrinsic::longjmp; diff --git a/llvm/lib/VMCore/IntrinsicLowering.cpp b/llvm/lib/VMCore/IntrinsicLowering.cpp index 38ba73d01f8f..bc6f02e4d653 100644 --- a/llvm/lib/VMCore/IntrinsicLowering.cpp +++ b/llvm/lib/VMCore/IntrinsicLowering.cpp @@ -191,10 +191,12 @@ void DefaultIntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { (*(CI->op_begin()+1))->getType(), MemsetFCache); break; } - case Intrinsic::isunordered: { - static Function *IsunorderedFCache = 0; - ReplaceCallWith("isunordered", CI, CI->op_begin()+1, CI->op_end(), - (*(CI->op_begin()+1))->getType(), IsunorderedFCache); + case Intrinsic::isnan: { + // FIXME: This should force the argument to be a double. There may be + // multiple isnans for different FP arguments. + static Function *isnanFCache = 0; + ReplaceCallWith("isnan", CI, CI->op_begin()+1, CI->op_end(), + (*(CI->op_begin()+1))->getType(), isnanFCache); break; } } diff --git a/llvm/lib/VMCore/Verifier.cpp b/llvm/lib/VMCore/Verifier.cpp index 156b2cc45d15..244d3464903c 100644 --- a/llvm/lib/VMCore/Verifier.cpp +++ b/llvm/lib/VMCore/Verifier.cpp @@ -688,7 +688,13 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) { break; } - case Intrinsic::isunordered: NumArgs = 2; break; + case Intrinsic::isnan: + Assert1(FT->getNumParams() == 1 && FT->getParamType(0)->isFloatingPoint(), + "Illegal prototype for llvm.isnan", IF); + Assert1(FT->getReturnType() == Type::BoolTy, + "Illegal prototype for llvm.isnan", IF); + NumArgs = 1; + break; case Intrinsic::setjmp: NumArgs = 1; break; case Intrinsic::longjmp: NumArgs = 2; break;