1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Constant fold sqrtf

llvm-svn: 28853
This commit is contained in:
Chris Lattner 2006-06-17 18:17:52 +00:00
parent 9d6d1e0236
commit 9d028c26c8

View File

@ -76,7 +76,8 @@ llvm::canConstantFoldCallTo(Function *F) {
case 'p': case 'p':
return Name == "pow"; return Name == "pow";
case 's': case 's':
return Name == "sin" || Name == "sinh" || Name == "sqrt"; return Name == "sin" || Name == "sinh" ||
Name == "sqrt" || Name == "sqrtf";
case 't': case 't':
return Name == "tan" || Name == "tanh"; return Name == "tan" || Name == "tanh";
default: default:
@ -150,6 +151,8 @@ llvm::ConstantFoldCall(Function *F, const std::vector<Constant*> &Operands) {
return ConstantFP::get(Ty, sinh(V)); return ConstantFP::get(Ty, sinh(V));
else if (Name == "sqrt" && V >= 0) else if (Name == "sqrt" && V >= 0)
return ConstantFP::get(Ty, sqrt(V)); return ConstantFP::get(Ty, sqrt(V));
else if (Name == "sqrtf" && V >= 0)
return ConstantFP::get(Ty, sqrt((float)V));
break; break;
case 't': case 't':
if (Name == "tan") if (Name == "tan")