mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 19:12:56 +02:00
Constant fold llvm.sqrt
llvm-svn: 23487
This commit is contained in:
parent
cd79ed877a
commit
6ce1d7dabb
@ -240,7 +240,9 @@ bool llvm::canConstantFoldCallTo(Function *F) {
|
||||
const std::string &Name = F->getName();
|
||||
|
||||
switch (F->getIntrinsicID()) {
|
||||
case Intrinsic::isunordered: return true;
|
||||
case Intrinsic::isunordered:
|
||||
case Intrinsic::sqrt:
|
||||
return true;
|
||||
default: break;
|
||||
}
|
||||
|
||||
@ -321,6 +323,12 @@ Constant *llvm::ConstantFoldCall(Function *F,
|
||||
return ConstantFP::get(Ty, log(V));
|
||||
else if (Name == "log10" && V > 0)
|
||||
return ConstantFoldFP(log10, V, Ty);
|
||||
else if (Name == "llvm.sqrt") {
|
||||
if (V >= -0.0)
|
||||
return ConstantFP::get(Ty, sqrt(V));
|
||||
else // Undefined
|
||||
return ConstantFP::get(Ty, 0.0);
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
if (Name == "sin")
|
||||
|
Loading…
Reference in New Issue
Block a user