I misled Alkis: LLVM should have isnan, not isunordered.

isunordered(X, Y) === isnan(X) | isnan(Y)

Remove isunordered, add isnan.

llvm-svn: 14132
This commit is contained in:
Chris Lattner 2004-06-11 02:29:43 +00:00
parent 3b4f437526
commit 8f69c9e439
4 changed files with 16 additions and 10 deletions

View File

@ -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.

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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;