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

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

Issue 928723003: Revert of [x64] Improve instruction selection for TruncateInt64ToInt32. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | test/unittests/compiler/x64/instruction-selector-x64-unittest.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 <algorithm> 5 #include <algorithm>
6 6
7 #include "src/compiler/instruction-selector-impl.h" 7 #include "src/compiler/instruction-selector-impl.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/compiler/node-properties.h" 9 #include "src/compiler/node-properties.h"
10 10
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 X64OperandGenerator g(this); 805 X64OperandGenerator g(this);
806 Emit(kSSECvtsd2ss, g.DefineAsRegister(node), g.Use(node->InputAt(0))); 806 Emit(kSSECvtsd2ss, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
807 } 807 }
808 808
809 809
810 void InstructionSelector::VisitTruncateInt64ToInt32(Node* node) { 810 void InstructionSelector::VisitTruncateInt64ToInt32(Node* node) {
811 X64OperandGenerator g(this); 811 X64OperandGenerator g(this);
812 Node* value = node->InputAt(0); 812 Node* value = node->InputAt(0);
813 if (CanCover(node, value)) { 813 if (CanCover(node, value)) {
814 switch (value->opcode()) { 814 switch (value->opcode()) {
815 case IrOpcode::kWord64Sar: { 815 case IrOpcode::kWord64Sar:
816 case IrOpcode::kWord64Shr: {
816 Int64BinopMatcher m(value); 817 Int64BinopMatcher m(value);
817 if (m.right().IsInRange(1, 32)) { 818 if (m.right().Is(32)) {
818 Emit(kX64Shr, g.DefineSameAsFirst(node), 819 Emit(kX64Shr, g.DefineSameAsFirst(node),
819 g.UseRegister(m.left().node()), 820 g.UseRegister(m.left().node()), g.TempImmediate(32));
820 g.UseImmediate(m.right().node()));
821 return; 821 return;
822 } 822 }
823 break; 823 break;
824 }
825 case IrOpcode::kWord64Shl: {
826 Int64BinopMatcher m(value);
827 if (m.right().IsInRange(1, 31)) {
828 Emit(kX64Shl32, g.DefineSameAsFirst(node),
829 g.UseRegister(m.left().node()),
830 g.UseImmediate(m.right().node()));
831 return;
832 }
833 break;
834 } 824 }
835 default: 825 default:
836 break; 826 break;
837 } 827 }
838 } 828 }
839 // Otherwise truncation from 64-bit to 32-bit is a no-nop, as 32-bit 829 Emit(kX64Movl, g.DefineAsRegister(node), g.Use(value));
840 // operations just ignore the upper 64-bit.
841 Emit(kArchNop, g.DefineAsRegister(node), g.Use(value));
842 } 830 }
843 831
844 832
845 void InstructionSelector::VisitFloat64Add(Node* node) { 833 void InstructionSelector::VisitFloat64Add(Node* node) {
846 X64OperandGenerator g(this); 834 X64OperandGenerator g(this);
847 if (IsSupported(AVX)) { 835 if (IsSupported(AVX)) {
848 Emit(kAVXFloat64Add, g.DefineAsRegister(node), 836 Emit(kAVXFloat64Add, g.DefineAsRegister(node),
849 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); 837 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1)));
850 } else { 838 } else {
851 Emit(kSSEFloat64Add, g.DefineSameAsFirst(node), 839 Emit(kSSEFloat64Add, g.DefineSameAsFirst(node),
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 MachineOperatorBuilder::kFloat64Ceil | 1385 MachineOperatorBuilder::kFloat64Ceil |
1398 MachineOperatorBuilder::kFloat64RoundTruncate | 1386 MachineOperatorBuilder::kFloat64RoundTruncate |
1399 MachineOperatorBuilder::kWord32ShiftIsSafe; 1387 MachineOperatorBuilder::kWord32ShiftIsSafe;
1400 } 1388 }
1401 return MachineOperatorBuilder::kNoFlags; 1389 return MachineOperatorBuilder::kNoFlags;
1402 } 1390 }
1403 1391
1404 } // namespace compiler 1392 } // namespace compiler
1405 } // namespace internal 1393 } // namespace internal
1406 } // namespace v8 1394 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/unittests/compiler/x64/instruction-selector-x64-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698