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

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

Issue 683753004: [turbofan] Transform x * -1.0 to -0.0 - x. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Corner cases. Created 6 years, 1 month 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 | test/mjsunit/asm/float64mul.js » ('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 d1a275d56a07e4289934941122cac808c6cddd6d..900fadfe5073861be8e3cb4e51178afc10c2481b 100644
--- a/src/compiler/machine-operator-reducer.cc
+++ b/src/compiler/machine-operator-reducer.cc
@@ -441,6 +441,12 @@ Reduction MachineOperatorReducer::Reduce(Node* node) {
}
case IrOpcode::kFloat64Mul: {
Float64BinopMatcher m(node);
+ if (m.right().Is(-1)) { // x * -1.0 => -0.0 - x
+ node->set_op(machine()->Float64Sub());
+ node->ReplaceInput(0, Float64Constant(-0.0));
+ node->ReplaceInput(1, m.left().node());
+ return Changed(node);
+ }
if (m.right().Is(1)) return Replace(m.left().node()); // x * 1.0 => x
if (m.right().IsNaN()) { // x * NaN => NaN
return Replace(m.right().node());
« no previous file with comments | « no previous file | test/mjsunit/asm/float64mul.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698