mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +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:
@@ -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")
|
||||
|
Reference in New Issue
Block a user