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 | 7a708989df9334e73cde31737656cce1436d1798 (patch) | |
tree | d1d3d5cced1422f5607b025d8aef1ba78ffced16 /llvm/lib | |
parent | 0b2652027baa06327ea4b7c387ebaa42ded7b2b8 (diff) | |
download | bcm5719-llvm-7a708989df9334e73cde31737656cce1436d1798.tar.gz bcm5719-llvm-7a708989df9334e73cde31737656cce1436d1798.zip |
Constant fold sqrtf
llvm-svn: 28853
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Analysis/ConstantFolding.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index 3321115c53e..7e802ba7dd6 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/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") |