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 "src/compiler/instruction-selector-impl.h" | 5 #include "src/compiler/instruction-selector-impl.h" |
6 #include "src/compiler/node-matchers.h" | 6 #include "src/compiler/node-matchers.h" |
7 #include "src/compiler/node-properties.h" | 7 #include "src/compiler/node-properties.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 Emit(kArm64Mov32, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0))); | 1026 Emit(kArm64Mov32, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0))); |
1027 } | 1027 } |
1028 | 1028 |
1029 | 1029 |
1030 void InstructionSelector::VisitFloat64Add(Node* node) { | 1030 void InstructionSelector::VisitFloat64Add(Node* node) { |
1031 VisitRRRFloat64(this, kArm64Float64Add, node); | 1031 VisitRRRFloat64(this, kArm64Float64Add, node); |
1032 } | 1032 } |
1033 | 1033 |
1034 | 1034 |
1035 void InstructionSelector::VisitFloat64Sub(Node* node) { | 1035 void InstructionSelector::VisitFloat64Sub(Node* node) { |
| 1036 Arm64OperandGenerator g(this); |
| 1037 Float64BinopMatcher m(node); |
| 1038 if (m.left().IsMinusZero() && m.right().IsFloat64RoundDown() && |
| 1039 CanCover(m.node(), m.right().node())) { |
| 1040 if (m.right().InputAt(0)->opcode() == IrOpcode::kFloat64Sub && |
| 1041 CanCover(m.right().node(), m.right().InputAt(0))) { |
| 1042 Float64BinopMatcher mright0(m.right().InputAt(0)); |
| 1043 if (mright0.left().IsMinusZero()) { |
| 1044 Emit(kArm64Float64RoundUp, g.DefineAsRegister(node), |
| 1045 g.UseRegister(mright0.right().node())); |
| 1046 return; |
| 1047 } |
| 1048 } |
| 1049 } |
1036 VisitRRRFloat64(this, kArm64Float64Sub, node); | 1050 VisitRRRFloat64(this, kArm64Float64Sub, node); |
1037 } | 1051 } |
1038 | 1052 |
1039 | 1053 |
1040 void InstructionSelector::VisitFloat64Mul(Node* node) { | 1054 void InstructionSelector::VisitFloat64Mul(Node* node) { |
1041 VisitRRRFloat64(this, kArm64Float64Mul, node); | 1055 VisitRRRFloat64(this, kArm64Float64Mul, node); |
1042 } | 1056 } |
1043 | 1057 |
1044 | 1058 |
1045 void InstructionSelector::VisitFloat64Div(Node* node) { | 1059 void InstructionSelector::VisitFloat64Div(Node* node) { |
1046 VisitRRRFloat64(this, kArm64Float64Div, node); | 1060 VisitRRRFloat64(this, kArm64Float64Div, node); |
1047 } | 1061 } |
1048 | 1062 |
1049 | 1063 |
1050 void InstructionSelector::VisitFloat64Mod(Node* node) { | 1064 void InstructionSelector::VisitFloat64Mod(Node* node) { |
1051 Arm64OperandGenerator g(this); | 1065 Arm64OperandGenerator g(this); |
1052 Emit(kArm64Float64Mod, g.DefineAsFixed(node, d0), | 1066 Emit(kArm64Float64Mod, g.DefineAsFixed(node, d0), |
1053 g.UseFixed(node->InputAt(0), d0), | 1067 g.UseFixed(node->InputAt(0), d0), |
1054 g.UseFixed(node->InputAt(1), d1))->MarkAsCall(); | 1068 g.UseFixed(node->InputAt(1), d1))->MarkAsCall(); |
1055 } | 1069 } |
1056 | 1070 |
1057 | 1071 |
1058 void InstructionSelector::VisitFloat64Sqrt(Node* node) { | 1072 void InstructionSelector::VisitFloat64Sqrt(Node* node) { |
1059 VisitRRFloat64(this, kArm64Float64Sqrt, node); | 1073 VisitRRFloat64(this, kArm64Float64Sqrt, node); |
1060 } | 1074 } |
1061 | 1075 |
1062 | 1076 |
1063 void InstructionSelector::VisitFloat64Floor(Node* node) { | 1077 void InstructionSelector::VisitFloat64RoundDown(Node* node) { |
1064 VisitRRFloat64(this, kArm64Float64Floor, node); | 1078 VisitRRFloat64(this, kArm64Float64RoundDown, node); |
1065 } | 1079 } |
1066 | 1080 |
1067 | 1081 |
1068 void InstructionSelector::VisitFloat64Ceil(Node* node) { | |
1069 VisitRRFloat64(this, kArm64Float64Ceil, node); | |
1070 } | |
1071 | |
1072 | |
1073 void InstructionSelector::VisitFloat64RoundTruncate(Node* node) { | 1082 void InstructionSelector::VisitFloat64RoundTruncate(Node* node) { |
1074 VisitRRFloat64(this, kArm64Float64RoundTruncate, node); | 1083 VisitRRFloat64(this, kArm64Float64RoundTruncate, node); |
1075 } | 1084 } |
1076 | 1085 |
1077 | 1086 |
1078 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { | 1087 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { |
1079 VisitRRFloat64(this, kArm64Float64RoundTiesAway, node); | 1088 VisitRRFloat64(this, kArm64Float64RoundTiesAway, node); |
1080 } | 1089 } |
1081 | 1090 |
1082 | 1091 |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1606 Node* left = node->InputAt(0); | 1615 Node* left = node->InputAt(0); |
1607 Node* right = node->InputAt(1); | 1616 Node* right = node->InputAt(1); |
1608 Emit(kArm64Float64InsertHighWord32, g.DefineAsRegister(node), | 1617 Emit(kArm64Float64InsertHighWord32, g.DefineAsRegister(node), |
1609 g.UseRegister(left), g.UseRegister(right)); | 1618 g.UseRegister(left), g.UseRegister(right)); |
1610 } | 1619 } |
1611 | 1620 |
1612 | 1621 |
1613 // static | 1622 // static |
1614 MachineOperatorBuilder::Flags | 1623 MachineOperatorBuilder::Flags |
1615 InstructionSelector::SupportedMachineOperatorFlags() { | 1624 InstructionSelector::SupportedMachineOperatorFlags() { |
1616 return MachineOperatorBuilder::kFloat64Floor | | 1625 return MachineOperatorBuilder::kFloat64RoundDown | |
1617 MachineOperatorBuilder::kFloat64Ceil | | |
1618 MachineOperatorBuilder::kFloat64RoundTruncate | | 1626 MachineOperatorBuilder::kFloat64RoundTruncate | |
1619 MachineOperatorBuilder::kFloat64RoundTiesAway | | 1627 MachineOperatorBuilder::kFloat64RoundTiesAway | |
1620 MachineOperatorBuilder::kWord32ShiftIsSafe | | 1628 MachineOperatorBuilder::kWord32ShiftIsSafe | |
1621 MachineOperatorBuilder::kInt32DivIsSafe | | 1629 MachineOperatorBuilder::kInt32DivIsSafe | |
1622 MachineOperatorBuilder::kUint32DivIsSafe; | 1630 MachineOperatorBuilder::kUint32DivIsSafe; |
1623 } | 1631 } |
1624 | 1632 |
1625 } // namespace compiler | 1633 } // namespace compiler |
1626 } // namespace internal | 1634 } // namespace internal |
1627 } // namespace v8 | 1635 } // namespace v8 |
OLD | NEW |