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)); |