1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

Add constant folding capabilities to the isunordered intrinsic.

llvm-svn: 14168
This commit is contained in:
Alkis Evlogimenos 2004-06-13 01:23:56 +00:00
parent dcf5341b61
commit dd550dc9cd

View File

@ -238,6 +238,7 @@ bool llvm::canConstantFoldCallTo(Function *F) {
switch (F->getIntrinsicID()) { switch (F->getIntrinsicID()) {
case Intrinsic::isnan: return true; case Intrinsic::isnan: return true;
case Intrinsic::isunordered: return true;
default: break; default: break;
} }
@ -293,7 +294,9 @@ Constant *llvm::ConstantFoldCall(Function *F,
if (ConstantFP *Op2 = dyn_cast<ConstantFP>(Operands[1])) { if (ConstantFP *Op2 = dyn_cast<ConstantFP>(Operands[1])) {
double Op1V = Op1->getValue(), Op2V = Op2->getValue(); 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; errno = 0;
double V = pow(Op1V, Op2V); double V = pow(Op1V, Op2V);
if (errno == 0) if (errno == 0)