OLD | NEW |
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 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 | 893 |
894 void InstructionSelector::VisitFloat64Mod(Node* node) { | 894 void InstructionSelector::VisitFloat64Mod(Node* node) { |
895 X64OperandGenerator g(this); | 895 X64OperandGenerator g(this); |
896 InstructionOperand temps[] = {g.TempRegister(rax)}; | 896 InstructionOperand temps[] = {g.TempRegister(rax)}; |
897 Emit(kSSEFloat64Mod, g.DefineSameAsFirst(node), | 897 Emit(kSSEFloat64Mod, g.DefineSameAsFirst(node), |
898 g.UseRegister(node->InputAt(0)), g.UseRegister(node->InputAt(1)), 1, | 898 g.UseRegister(node->InputAt(0)), g.UseRegister(node->InputAt(1)), 1, |
899 temps); | 899 temps); |
900 } | 900 } |
901 | 901 |
902 | 902 |
| 903 void InstructionSelector::VisitFloat64Max(Node* node) { |
| 904 X64OperandGenerator g(this); |
| 905 if (IsSupported(AVX)) { |
| 906 Emit(kAVXFloat64Max, g.DefineAsRegister(node), |
| 907 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); |
| 908 } else { |
| 909 Emit(kSSEFloat64Max, g.DefineSameAsFirst(node), |
| 910 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); |
| 911 } |
| 912 } |
| 913 |
| 914 |
| 915 void InstructionSelector::VisitFloat64Min(Node* node) { |
| 916 X64OperandGenerator g(this); |
| 917 if (IsSupported(AVX)) { |
| 918 Emit(kAVXFloat64Min, g.DefineAsRegister(node), |
| 919 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); |
| 920 } else { |
| 921 Emit(kSSEFloat64Min, g.DefineSameAsFirst(node), |
| 922 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); |
| 923 } |
| 924 } |
| 925 |
| 926 |
903 void InstructionSelector::VisitFloat64Sqrt(Node* node) { | 927 void InstructionSelector::VisitFloat64Sqrt(Node* node) { |
904 X64OperandGenerator g(this); | 928 X64OperandGenerator g(this); |
905 Emit(kSSEFloat64Sqrt, g.DefineAsRegister(node), g.Use(node->InputAt(0))); | 929 Emit(kSSEFloat64Sqrt, g.DefineAsRegister(node), g.Use(node->InputAt(0))); |
906 } | 930 } |
907 | 931 |
908 | 932 |
909 namespace { | 933 namespace { |
910 | 934 |
911 void VisitRRFloat64(InstructionSelector* selector, InstructionCode opcode, | 935 void VisitRRFloat64(InstructionSelector* selector, InstructionCode opcode, |
912 Node* node) { | 936 Node* node) { |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 Node* right = node->InputAt(1); | 1466 Node* right = node->InputAt(1); |
1443 Emit(kSSEFloat64InsertHighWord32, g.DefineSameAsFirst(node), | 1467 Emit(kSSEFloat64InsertHighWord32, g.DefineSameAsFirst(node), |
1444 g.UseRegister(left), g.Use(right)); | 1468 g.UseRegister(left), g.Use(right)); |
1445 } | 1469 } |
1446 | 1470 |
1447 | 1471 |
1448 // static | 1472 // static |
1449 MachineOperatorBuilder::Flags | 1473 MachineOperatorBuilder::Flags |
1450 InstructionSelector::SupportedMachineOperatorFlags() { | 1474 InstructionSelector::SupportedMachineOperatorFlags() { |
1451 MachineOperatorBuilder::Flags flags = | 1475 MachineOperatorBuilder::Flags flags = |
| 1476 MachineOperatorBuilder::kFloat64Max | |
| 1477 MachineOperatorBuilder::kFloat64Min | |
1452 MachineOperatorBuilder::kWord32ShiftIsSafe; | 1478 MachineOperatorBuilder::kWord32ShiftIsSafe; |
1453 if (CpuFeatures::IsSupported(SSE4_1)) { | 1479 if (CpuFeatures::IsSupported(SSE4_1)) { |
1454 flags |= MachineOperatorBuilder::kFloat64RoundDown | | 1480 flags |= MachineOperatorBuilder::kFloat64RoundDown | |
1455 MachineOperatorBuilder::kFloat64RoundTruncate; | 1481 MachineOperatorBuilder::kFloat64RoundTruncate; |
1456 } | 1482 } |
1457 return flags; | 1483 return flags; |
1458 } | 1484 } |
1459 | 1485 |
1460 } // namespace compiler | 1486 } // namespace compiler |
1461 } // namespace internal | 1487 } // namespace internal |
1462 } // namespace v8 | 1488 } // namespace v8 |
OLD | NEW |