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/base/bits.h" | 5 #include "src/base/bits.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 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
949 return; | 949 return; |
950 } | 950 } |
951 VisitRRRFloat64(this, kArmVaddF64, node); | 951 VisitRRRFloat64(this, kArmVaddF64, node); |
952 } | 952 } |
953 | 953 |
954 | 954 |
955 void InstructionSelector::VisitFloat64Sub(Node* node) { | 955 void InstructionSelector::VisitFloat64Sub(Node* node) { |
956 ArmOperandGenerator g(this); | 956 ArmOperandGenerator g(this); |
957 Float64BinopMatcher m(node); | 957 Float64BinopMatcher m(node); |
958 if (m.left().IsMinusZero()) { | 958 if (m.left().IsMinusZero()) { |
| 959 if (m.right().IsFloat64RoundDown() && |
| 960 CanCover(m.node(), m.right().node())) { |
| 961 if (m.right().InputAt(0)->opcode() == IrOpcode::kFloat64Sub && |
| 962 CanCover(m.right().node(), m.right().InputAt(0))) { |
| 963 Float64BinopMatcher mright0(m.right().InputAt(0)); |
| 964 if (mright0.left().IsMinusZero()) { |
| 965 Emit(kArmVrintpF64, g.DefineAsRegister(node), |
| 966 g.UseRegister(mright0.right().node())); |
| 967 return; |
| 968 } |
| 969 } |
| 970 } |
959 Emit(kArmVnegF64, g.DefineAsRegister(node), | 971 Emit(kArmVnegF64, g.DefineAsRegister(node), |
960 g.UseRegister(m.right().node())); | 972 g.UseRegister(m.right().node())); |
961 return; | 973 return; |
962 } | 974 } |
963 if (m.right().IsFloat64Mul() && CanCover(node, m.right().node())) { | 975 if (m.right().IsFloat64Mul() && CanCover(node, m.right().node())) { |
964 Float64BinopMatcher mright(m.right().node()); | 976 Float64BinopMatcher mright(m.right().node()); |
965 Emit(kArmVmlsF64, g.DefineSameAsFirst(node), g.UseRegister(m.left().node()), | 977 Emit(kArmVmlsF64, g.DefineSameAsFirst(node), g.UseRegister(m.left().node()), |
966 g.UseRegister(mright.left().node()), | 978 g.UseRegister(mright.left().node()), |
967 g.UseRegister(mright.right().node())); | 979 g.UseRegister(mright.right().node())); |
968 return; | 980 return; |
(...skipping 18 matching lines...) Expand all Loading... |
987 g.UseFixed(node->InputAt(1), d1))->MarkAsCall(); | 999 g.UseFixed(node->InputAt(1), d1))->MarkAsCall(); |
988 } | 1000 } |
989 | 1001 |
990 | 1002 |
991 void InstructionSelector::VisitFloat64Sqrt(Node* node) { | 1003 void InstructionSelector::VisitFloat64Sqrt(Node* node) { |
992 ArmOperandGenerator g(this); | 1004 ArmOperandGenerator g(this); |
993 Emit(kArmVsqrtF64, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0))); | 1005 Emit(kArmVsqrtF64, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0))); |
994 } | 1006 } |
995 | 1007 |
996 | 1008 |
997 void InstructionSelector::VisitFloat64Floor(Node* node) { | 1009 void InstructionSelector::VisitFloat64RoundDown(Node* node) { |
998 DCHECK(CpuFeatures::IsSupported(ARMv8)); | 1010 VisitRRFloat64(this, kArmVrintmF64, node); |
999 VisitRRFloat64(this, kArmVfloorF64, node); | |
1000 } | |
1001 | |
1002 | |
1003 void InstructionSelector::VisitFloat64Ceil(Node* node) { | |
1004 DCHECK(CpuFeatures::IsSupported(ARMv8)); | |
1005 VisitRRFloat64(this, kArmVceilF64, node); | |
1006 } | 1011 } |
1007 | 1012 |
1008 | 1013 |
1009 void InstructionSelector::VisitFloat64RoundTruncate(Node* node) { | 1014 void InstructionSelector::VisitFloat64RoundTruncate(Node* node) { |
1010 DCHECK(CpuFeatures::IsSupported(ARMv8)); | 1015 VisitRRFloat64(this, kArmVrintzF64, node); |
1011 VisitRRFloat64(this, kArmVroundTruncateF64, node); | |
1012 } | 1016 } |
1013 | 1017 |
1014 | 1018 |
1015 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { | 1019 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { |
1016 DCHECK(CpuFeatures::IsSupported(ARMv8)); | 1020 VisitRRFloat64(this, kArmVrintaF64, node); |
1017 VisitRRFloat64(this, kArmVroundTiesAwayF64, node); | |
1018 } | 1021 } |
1019 | 1022 |
1020 | 1023 |
1021 void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { | 1024 void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { |
1022 ArmOperandGenerator g(this); | 1025 ArmOperandGenerator g(this); |
1023 const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(node); | 1026 const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(node); |
1024 | 1027 |
1025 FrameStateDescriptor* frame_state_descriptor = NULL; | 1028 FrameStateDescriptor* frame_state_descriptor = NULL; |
1026 if (descriptor->NeedsFrameState()) { | 1029 if (descriptor->NeedsFrameState()) { |
1027 frame_state_descriptor = | 1030 frame_state_descriptor = |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1441 | 1444 |
1442 | 1445 |
1443 // static | 1446 // static |
1444 MachineOperatorBuilder::Flags | 1447 MachineOperatorBuilder::Flags |
1445 InstructionSelector::SupportedMachineOperatorFlags() { | 1448 InstructionSelector::SupportedMachineOperatorFlags() { |
1446 MachineOperatorBuilder::Flags flags = | 1449 MachineOperatorBuilder::Flags flags = |
1447 MachineOperatorBuilder::kInt32DivIsSafe | | 1450 MachineOperatorBuilder::kInt32DivIsSafe | |
1448 MachineOperatorBuilder::kUint32DivIsSafe; | 1451 MachineOperatorBuilder::kUint32DivIsSafe; |
1449 | 1452 |
1450 if (CpuFeatures::IsSupported(ARMv8)) { | 1453 if (CpuFeatures::IsSupported(ARMv8)) { |
1451 flags |= MachineOperatorBuilder::kFloat64Floor | | 1454 flags |= MachineOperatorBuilder::kFloat64RoundDown | |
1452 MachineOperatorBuilder::kFloat64Ceil | | |
1453 MachineOperatorBuilder::kFloat64RoundTruncate | | 1455 MachineOperatorBuilder::kFloat64RoundTruncate | |
1454 MachineOperatorBuilder::kFloat64RoundTiesAway; | 1456 MachineOperatorBuilder::kFloat64RoundTiesAway; |
1455 } | 1457 } |
1456 return flags; | 1458 return flags; |
1457 } | 1459 } |
1458 | 1460 |
1459 } // namespace compiler | 1461 } // namespace compiler |
1460 } // namespace internal | 1462 } // namespace internal |
1461 } // namespace v8 | 1463 } // namespace v8 |
OLD | NEW |