mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-15 07:59:50 +00:00
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
This commit is contained in:
parent
26bbe93ec9
commit
df497317f1
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user