diff options
-rw-r--r-- | docs/LangRef.html | 1 | ||||
-rw-r--r-- | include/llvm/Intrinsics.h | 1 | ||||
-rw-r--r-- | lib/CodeGen/IntrinsicLowering.cpp | 6 | ||||
-rw-r--r-- | lib/VMCore/Function.cpp | 1 | ||||
-rw-r--r-- | lib/VMCore/IntrinsicLowering.cpp | 6 | ||||
-rw-r--r-- | lib/VMCore/Verifier.cpp | 12 | ||||
-rw-r--r-- | test/Feature/intrinsics.ll | 5 |
7 files changed, 31 insertions, 1 deletions
diff --git a/docs/LangRef.html b/docs/LangRef.html index 14c0eb520e..a6a5fab506 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -125,6 +125,7 @@ <li><a href="#i_memmove">'<tt>llvm.memmove</tt>' Intrinsic</a></li> <li><a href="#i_memset">'<tt>llvm.memset</tt>' Intrinsic</a></li> <li><a href="#i_isnan">'<tt>llvm.isnan</tt>' Intrinsic</a></li> + <li><a href="#i_isunordered">'<tt>llvm.isunordered</tt>' Intrinsic</a></li> </ol> </li> <li><a href="#int_debugger">Debugger intrinsics</a></li> diff --git a/include/llvm/Intrinsics.h b/include/llvm/Intrinsics.h index 8cca2cd326..85e7802c77 100644 --- a/include/llvm/Intrinsics.h +++ b/include/llvm/Intrinsics.h @@ -61,6 +61,7 @@ namespace Intrinsic { // libm related functions. isnan, // Return true if fp argument is a NAN. + isunordered, // Return true if fp arguments are unordered // Input/Output intrinsics. readport, diff --git a/lib/CodeGen/IntrinsicLowering.cpp b/lib/CodeGen/IntrinsicLowering.cpp index b6ebe0991b..a4ec31d419 100644 --- a/lib/CodeGen/IntrinsicLowering.cpp +++ b/lib/CodeGen/IntrinsicLowering.cpp @@ -208,6 +208,12 @@ void DefaultIntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { Type::BoolTy, isnanFCache); break; } + case Intrinsic::isunordered: { + static Function *isunorderedFCache = 0; + ReplaceCallWith("isunordered", CI, CI->op_begin()+1, CI->op_end(), + Type::BoolTy, isunorderedFCache); + break; + } } assert(CI->use_empty() && diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index a0f86d55e5..4f6c997255 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -224,6 +224,7 @@ unsigned Function::getIntrinsicID() const { break; case 'i': if (getName() == "llvm.isnan") return Intrinsic::isnan; + if (getName() == "llvm.isunordered") return Intrinsic::isunordered; break; case 'l': if (getName() == "llvm.longjmp") return Intrinsic::longjmp; diff --git a/lib/VMCore/IntrinsicLowering.cpp b/lib/VMCore/IntrinsicLowering.cpp index b6ebe0991b..a4ec31d419 100644 --- a/lib/VMCore/IntrinsicLowering.cpp +++ b/lib/VMCore/IntrinsicLowering.cpp @@ -208,6 +208,12 @@ void DefaultIntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { Type::BoolTy, isnanFCache); break; } + case Intrinsic::isunordered: { + static Function *isunorderedFCache = 0; + ReplaceCallWith("isunordered", CI, CI->op_begin()+1, CI->op_end(), + Type::BoolTy, isunorderedFCache); + break; + } } assert(CI->use_empty() && diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 244d346490..d221de9e65 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -688,7 +688,7 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) { break; } - case Intrinsic::isnan: + case Intrinsic::isnan: Assert1(FT->getNumParams() == 1 && FT->getParamType(0)->isFloatingPoint(), "Illegal prototype for llvm.isnan", IF); Assert1(FT->getReturnType() == Type::BoolTy, @@ -696,6 +696,16 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) { NumArgs = 1; break; + case Intrinsic::isunordered: + Assert1(FT->getNumParams() == 2 && + FT->getParamType(0)->isFloatingPoint() && + FT->getParamType(1)->isFloatingPoint(), + "Illegal prototype for llvm.isunordered", IF); + Assert1(FT->getReturnType() == Type::BoolTy, + "Illegal prototype for llvm.isunordered", IF); + NumArgs = 2; + break; + case Intrinsic::setjmp: NumArgs = 1; break; case Intrinsic::longjmp: NumArgs = 2; break; case Intrinsic::sigsetjmp: NumArgs = 2; break; diff --git a/test/Feature/intrinsics.ll b/test/Feature/intrinsics.ll index 53a78b5417..51f738c9ef 100644 --- a/test/Feature/intrinsics.ll +++ b/test/Feature/intrinsics.ll @@ -2,6 +2,9 @@ declare bool %llvm.isnan(float) declare bool %llvm.isnan(double) +declare bool %llvm.isunordered(float, float) +declare bool %llvm.isunordered(double, double) + implementation ; Test llvm intrinsics @@ -9,5 +12,7 @@ implementation void %libm() { call bool %llvm.isnan(float 0.0) call bool %llvm.isnan(double 10.0) + call bool %llvm.isunordered(float 0.0, float 1.0) + call bool %llvm.isunordered(double 0.0, double 1.0) ret void } |