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

Side by Side Diff: src/compiler/x87/instruction-selector-x87.cc

Issue 1227923003: X87: [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/x87/code-generator-x87.cc ('k') | no next file » | 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/base/adapters.h" 5 #include "src/base/adapters.h"
6 #include "src/compiler/instruction-selector-impl.h" 6 #include "src/compiler/instruction-selector-impl.h"
7 #include "src/compiler/node-matchers.h" 7 #include "src/compiler/node-matchers.h"
8 #include "src/compiler/node-properties.h" 8 #include "src/compiler/node-properties.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 } 640 }
641 641
642 642
643 void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) { 643 void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) {
644 X87OperandGenerator g(this); 644 X87OperandGenerator g(this);
645 Emit(kX87Float64ToFloat32, g.DefineAsFixed(node, stX_0), 645 Emit(kX87Float64ToFloat32, g.DefineAsFixed(node, stX_0),
646 g.Use(node->InputAt(0))); 646 g.Use(node->InputAt(0)));
647 } 647 }
648 648
649 649
650 void InstructionSelector::VisitTruncateFloat64ToInt32(Node* node) {
651 X87OperandGenerator g(this);
652
653 switch (TruncationModeOf(node->op())) {
654 case TruncationMode::kJavaScript:
655 Emit(kArchTruncateDoubleToI, g.DefineAsRegister(node),
656 g.Use(node->InputAt(0)));
657 return;
658 case TruncationMode::kRoundToZero:
659 Emit(kX87Float64ToInt32, g.DefineAsRegister(node),
660 g.Use(node->InputAt(0)));
661 return;
662 }
663 UNREACHABLE();
664 }
665
666
650 void InstructionSelector::VisitFloat32Add(Node* node) { 667 void InstructionSelector::VisitFloat32Add(Node* node) {
651 X87OperandGenerator g(this); 668 X87OperandGenerator g(this);
652 Emit(kX87PushFloat32, g.NoOutput(), g.Use(node->InputAt(0))); 669 Emit(kX87PushFloat32, g.NoOutput(), g.Use(node->InputAt(0)));
653 Emit(kX87PushFloat32, g.NoOutput(), g.Use(node->InputAt(1))); 670 Emit(kX87PushFloat32, g.NoOutput(), g.Use(node->InputAt(1)));
654 Emit(kX87Float32Add, g.DefineAsFixed(node, stX_0), 0, NULL); 671 Emit(kX87Float32Add, g.DefineAsFixed(node, stX_0), 0, NULL);
655 } 672 }
656 673
657 674
658 void InstructionSelector::VisitFloat64Add(Node* node) { 675 void InstructionSelector::VisitFloat64Add(Node* node) {
659 X87OperandGenerator g(this); 676 X87OperandGenerator g(this);
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 MachineOperatorBuilder::kFloat32Min | 1346 MachineOperatorBuilder::kFloat32Min |
1330 MachineOperatorBuilder::kFloat64Max | 1347 MachineOperatorBuilder::kFloat64Max |
1331 MachineOperatorBuilder::kFloat64Min | 1348 MachineOperatorBuilder::kFloat64Min |
1332 MachineOperatorBuilder::kWord32ShiftIsSafe; 1349 MachineOperatorBuilder::kWord32ShiftIsSafe;
1333 return flags; 1350 return flags;
1334 } 1351 }
1335 1352
1336 } // namespace compiler 1353 } // namespace compiler
1337 } // namespace internal 1354 } // namespace internal
1338 } // namespace v8 1355 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/x87/code-generator-x87.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698