Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Unified Diff: src/compiler/machine-operator-reducer.cc

Issue 2333663002: [turbofan] Do constant folding for Float64Pow. (Closed)
Patch Set: Make sure to have exponent 0/-0 properly. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/machine-operator-reducer.cc
diff --git a/src/compiler/machine-operator-reducer.cc b/src/compiler/machine-operator-reducer.cc
index 99044aa86da64dc8338e5bf69ae800e279cafc4d..18f96947cfe188a0129cca6cf5a74970a82a2ded 100644
--- a/src/compiler/machine-operator-reducer.cc
+++ b/src/compiler/machine-operator-reducer.cc
@@ -541,8 +541,9 @@ Reduction MachineOperatorReducer::Reduce(Node* node) {
}
case IrOpcode::kFloat64Pow: {
Float64BinopMatcher m(node);
- // TODO(bmeurer): Constant fold once we have a unified pow implementation.
- if (m.right().Is(0.0)) { // x ** +-0.0 => 1.0
+ if (m.IsFoldable()) {
+ return ReplaceFloat64(Pow(m.left().Value(), m.right().Value()));
+ } else if (m.right().Is(0.0)) { // x ** +-0.0 => 1.0
return ReplaceFloat64(1.0);
} else if (m.right().Is(-2.0)) { // x ** -2.0 => 1 / (x * x)
node->ReplaceInput(0, Float64Constant(1.0));
« no previous file with comments | « no previous file | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698