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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/asm/float64mul.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/machine-operator-reducer.h" 5 #include "src/compiler/machine-operator-reducer.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/division-by-constant.h" 8 #include "src/base/division-by-constant.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/compiler/diamond.h" 10 #include "src/compiler/diamond.h"
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 if (m.left().IsNaN()) { // NaN - x => NaN 434 if (m.left().IsNaN()) { // NaN - x => NaN
435 return Replace(m.left().node()); 435 return Replace(m.left().node());
436 } 436 }
437 if (m.IsFoldable()) { // K - K => K 437 if (m.IsFoldable()) { // K - K => K
438 return ReplaceFloat64(m.left().Value() - m.right().Value()); 438 return ReplaceFloat64(m.left().Value() - m.right().Value());
439 } 439 }
440 break; 440 break;
441 } 441 }
442 case IrOpcode::kFloat64Mul: { 442 case IrOpcode::kFloat64Mul: {
443 Float64BinopMatcher m(node); 443 Float64BinopMatcher m(node);
444 if (m.right().Is(-1)) { // x * -1.0 => -0.0 - x
445 node->set_op(machine()->Float64Sub());
446 node->ReplaceInput(0, Float64Constant(-0.0));
447 node->ReplaceInput(1, m.left().node());
448 return Changed(node);
449 }
444 if (m.right().Is(1)) return Replace(m.left().node()); // x * 1.0 => x 450 if (m.right().Is(1)) return Replace(m.left().node()); // x * 1.0 => x
445 if (m.right().IsNaN()) { // x * NaN => NaN 451 if (m.right().IsNaN()) { // x * NaN => NaN
446 return Replace(m.right().node()); 452 return Replace(m.right().node());
447 } 453 }
448 if (m.IsFoldable()) { // K * K => K 454 if (m.IsFoldable()) { // K * K => K
449 return ReplaceFloat64(m.left().Value() * m.right().Value()); 455 return ReplaceFloat64(m.left().Value() * m.right().Value());
450 } 456 }
451 break; 457 break;
452 } 458 }
453 case IrOpcode::kFloat64Div: { 459 case IrOpcode::kFloat64Div: {
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 MachineOperatorBuilder* MachineOperatorReducer::machine() const { 773 MachineOperatorBuilder* MachineOperatorReducer::machine() const {
768 return jsgraph()->machine(); 774 return jsgraph()->machine();
769 } 775 }
770 776
771 777
772 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } 778 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); }
773 779
774 } // namespace compiler 780 } // namespace compiler
775 } // namespace internal 781 } // namespace internal
776 } // namespace v8 782 } // namespace v8
OLDNEW
« 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