diff options
author | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-06-13 01:23:56 +0000 |
---|---|---|
committer | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-06-13 01:23:56 +0000 |
commit | e395468ae514f59411ba9f5dd16ca215288f009b (patch) | |
tree | 155ebe32c071376df268d69f14ca518010aab384 /llvm/lib/Transforms/Utils/Local.cpp | |
parent | 0fa392310af8fbcfc042fca6eec691566ab85898 (diff) | |
download | bcm5719-llvm-e395468ae514f59411ba9f5dd16ca215288f009b.tar.gz bcm5719-llvm-e395468ae514f59411ba9f5dd16ca215288f009b.zip |
Add constant folding capabilities to the isunordered intrinsic.
llvm-svn: 14168
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 9d3338ffb77..edb9742655a 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/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<ConstantFP>(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) |