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

Side by Side Diff: src/compiler/machine-operator-reducer.cc

Issue 1225993002: [turbofan] Add TruncationMode for TruncateFloat64ToInt32. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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 unified diff | Download patch
« no previous file with comments | « src/compiler/machine-operator.cc ('k') | src/compiler/mips/instruction-selector-mips.cc » ('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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 639
640 640
641 Reduction MachineOperatorReducer::ReduceTruncateFloat64ToInt32(Node* node) { 641 Reduction MachineOperatorReducer::ReduceTruncateFloat64ToInt32(Node* node) {
642 Float64Matcher m(node->InputAt(0)); 642 Float64Matcher m(node->InputAt(0));
643 if (m.HasValue()) return ReplaceInt32(DoubleToInt32(m.Value())); 643 if (m.HasValue()) return ReplaceInt32(DoubleToInt32(m.Value()));
644 if (m.IsChangeInt32ToFloat64()) return Replace(m.node()->InputAt(0)); 644 if (m.IsChangeInt32ToFloat64()) return Replace(m.node()->InputAt(0));
645 if (m.IsPhi()) { 645 if (m.IsPhi()) {
646 Node* const phi = m.node(); 646 Node* const phi = m.node();
647 DCHECK_EQ(kRepFloat64, RepresentationOf(OpParameter<MachineType>(phi))); 647 DCHECK_EQ(kRepFloat64, RepresentationOf(OpParameter<MachineType>(phi)));
648 if (phi->OwnedBy(node)) { 648 if (phi->OwnedBy(node)) {
649 // TruncateFloat64ToInt32(Phi[Float64](x1,...,xn)) 649 // TruncateFloat64ToInt32[mode](Phi[Float64](x1,...,xn))
650 // => Phi[Int32](TruncateFloat64ToInt32(x1), 650 // => Phi[Int32](TruncateFloat64ToInt32[mode](x1),
651 // ..., 651 // ...,
652 // TruncateFloat64ToInt32(xn)) 652 // TruncateFloat64ToInt32[mode](xn))
653 const int value_input_count = phi->InputCount() - 1; 653 const int value_input_count = phi->InputCount() - 1;
654 for (int i = 0; i < value_input_count; ++i) { 654 for (int i = 0; i < value_input_count; ++i) {
655 Node* input = graph()->NewNode(machine()->TruncateFloat64ToInt32(), 655 Node* input = graph()->NewNode(node->op(), phi->InputAt(i));
656 phi->InputAt(i));
657 // TODO(bmeurer): Reschedule input for reduction once we have Revisit() 656 // TODO(bmeurer): Reschedule input for reduction once we have Revisit()
658 // instead of recursing into ReduceTruncateFloat64ToInt32() here. 657 // instead of recursing into ReduceTruncateFloat64ToInt32() here.
659 Reduction reduction = ReduceTruncateFloat64ToInt32(input); 658 Reduction reduction = ReduceTruncateFloat64ToInt32(input);
660 if (reduction.Changed()) input = reduction.replacement(); 659 if (reduction.Changed()) input = reduction.replacement();
661 phi->ReplaceInput(i, input); 660 phi->ReplaceInput(i, input);
662 } 661 }
663 phi->set_op(common()->Phi(kMachInt32, value_input_count)); 662 phi->set_op(common()->Phi(kMachInt32, value_input_count));
664 return Replace(phi); 663 return Replace(phi);
665 } 664 }
666 } 665 }
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 MachineOperatorBuilder* MachineOperatorReducer::machine() const { 1012 MachineOperatorBuilder* MachineOperatorReducer::machine() const {
1014 return jsgraph()->machine(); 1013 return jsgraph()->machine();
1015 } 1014 }
1016 1015
1017 1016
1018 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); } 1017 Graph* MachineOperatorReducer::graph() const { return jsgraph()->graph(); }
1019 1018
1020 } // namespace compiler 1019 } // namespace compiler
1021 } // namespace internal 1020 } // namespace internal
1022 } // namespace v8 1021 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/machine-operator.cc ('k') | src/compiler/mips/instruction-selector-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698