From df497317f1cfc1566d3e1c61040593d90434fca2 Mon Sep 17 00:00:00 2001 From: Alkis Evlogimenos Date: Sun, 13 Jun 2004 01:23:56 +0000 Subject: [PATCH] Add constant folding capabilities to the isunordered intrinsic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14168 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/Local.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp index 9d3338ffb77..edb9742655a 100644 --- a/lib/Transforms/Utils/Local.cpp +++ b/lib/Transforms/Utils/Local.cpp @@ -238,6 +238,7 @@ bool llvm::canConstantFoldCallTo(Function *F) { switch (F->getIntrinsicID()) { case Intrinsic::isnan: return true; + case Intrinsic::isunordered: return true; default: break; } @@ -293,7 +294,9 @@ Constant *llvm::ConstantFoldCall(Function *F, if (ConstantFP *Op2 = dyn_cast(Operands[1])) { double Op1V = Op1->getValue(), Op2V = Op2->getValue(); - if (Name == "pow") { + if (Name == "llvm.isunordered") + return ConstantBool::get(isnan(Op1V) | isnan(Op2V)); + else if (Name == "pow") { errno = 0; double V = pow(Op1V, Op2V); if (errno == 0)