mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-19 04:32:19 +00:00
Constant fold llvm.sqrt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23487 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5b3c70263b
commit
32643d8e05
@ -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…
x
Reference in New Issue
Block a user