diff options
author | Chris Lattner <sabre@nondot.org> | 2006-06-17 18:17:52 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-06-17 18:17:52 +0000 |
commit | 5cff2677a68bf7748bbc2d680b59248448a7fc89 (patch) | |
tree | a72f33a9db8ebfafd8c8741cd3835554ffa708b9 /lib/Analysis/ConstantFolding.cpp | |
parent | dfc0375ec35ffa966abca572ed994fa581efed95 (diff) | |
download | external_llvm-5cff2677a68bf7748bbc2d680b59248448a7fc89.zip external_llvm-5cff2677a68bf7748bbc2d680b59248448a7fc89.tar.gz external_llvm-5cff2677a68bf7748bbc2d680b59248448a7fc89.tar.bz2 |
Constant fold sqrtf
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28853 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ConstantFolding.cpp')
-rw-r--r-- | lib/Analysis/ConstantFolding.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp index 3321115..7e802ba 100644 --- a/lib/Analysis/ConstantFolding.cpp +++ b/lib/Analysis/ConstantFolding.cpp @@ -76,7 +76,8 @@ llvm::canConstantFoldCallTo(Function *F) { case 'p': return Name == "pow"; case 's': - return Name == "sin" || Name == "sinh" || Name == "sqrt"; + return Name == "sin" || Name == "sinh" || + Name == "sqrt" || Name == "sqrtf"; case 't': return Name == "tan" || Name == "tanh"; default: @@ -150,6 +151,8 @@ llvm::ConstantFoldCall(Function *F, const std::vector<Constant*> &Operands) { return ConstantFP::get(Ty, sinh(V)); else if (Name == "sqrt" && V >= 0) return ConstantFP::get(Ty, sqrt(V)); + else if (Name == "sqrtf" && V >= 0) + return ConstantFP::get(Ty, sqrt((float)V)); break; case 't': if (Name == "tan") |