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 2683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2694 AddressingMode addressing_mode = kMode_MRR; | 2694 AddressingMode addressing_mode = kMode_MRR; |
2695 InstructionOperand inputs[3]; | 2695 InstructionOperand inputs[3]; |
2696 size_t input_count = 0; | 2696 size_t input_count = 0; |
2697 inputs[input_count++] = g.UseUniqueRegister(base); | 2697 inputs[input_count++] = g.UseUniqueRegister(base); |
2698 inputs[input_count++] = g.UseUniqueRegister(index); | 2698 inputs[input_count++] = g.UseUniqueRegister(index); |
2699 inputs[input_count++] = g.UseUniqueRegister(value); | 2699 inputs[input_count++] = g.UseUniqueRegister(value); |
2700 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode); | 2700 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode); |
2701 Emit(code, 0, nullptr, input_count, inputs); | 2701 Emit(code, 0, nullptr, input_count, inputs); |
2702 } | 2702 } |
2703 | 2703 |
| 2704 void InstructionSelector::VisitAtomicExchange(Node* node) { |
| 2705 Arm64OperandGenerator g(this); |
| 2706 Node* base = node->InputAt(0); |
| 2707 Node* index = node->InputAt(1); |
| 2708 Node* value = node->InputAt(2); |
| 2709 ArchOpcode opcode = kArchNop; |
| 2710 MachineType type = AtomicExchangeRepresentationOf(node->op()); |
| 2711 if (type == MachineType::Int8()) { |
| 2712 opcode = kAtomicExchangeInt8; |
| 2713 } else if (type == MachineType::Uint8()) { |
| 2714 opcode = kAtomicExchangeUint8; |
| 2715 } else if (type == MachineType::Int16()) { |
| 2716 opcode = kAtomicExchangeInt16; |
| 2717 } else if (type == MachineType::Uint16()) { |
| 2718 opcode = kAtomicExchangeUint16; |
| 2719 } else if (type == MachineType::Int32() || type == MachineType::Uint32()) { |
| 2720 opcode = kAtomicExchangeWord32; |
| 2721 } else { |
| 2722 UNREACHABLE(); |
| 2723 return; |
| 2724 } |
| 2725 |
| 2726 AddressingMode addressing_mode = kMode_MRR; |
| 2727 InstructionOperand inputs[3]; |
| 2728 size_t input_count = 0; |
| 2729 inputs[input_count++] = g.UseUniqueRegister(base); |
| 2730 inputs[input_count++] = g.UseUniqueRegister(index); |
| 2731 inputs[input_count++] = g.UseUniqueRegister(value); |
| 2732 InstructionOperand outputs[1]; |
| 2733 outputs[0] = g.UseUniqueRegister(node); |
| 2734 InstructionOperand temp[2]; |
| 2735 temp[0] = g.TempRegister(); |
| 2736 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode); |
| 2737 Emit(code, 1, outputs, input_count, inputs, 1, temp); |
| 2738 } |
| 2739 |
2704 // static | 2740 // static |
2705 MachineOperatorBuilder::Flags | 2741 MachineOperatorBuilder::Flags |
2706 InstructionSelector::SupportedMachineOperatorFlags() { | 2742 InstructionSelector::SupportedMachineOperatorFlags() { |
2707 return MachineOperatorBuilder::kFloat32RoundDown | | 2743 return MachineOperatorBuilder::kFloat32RoundDown | |
2708 MachineOperatorBuilder::kFloat64RoundDown | | 2744 MachineOperatorBuilder::kFloat64RoundDown | |
2709 MachineOperatorBuilder::kFloat32RoundUp | | 2745 MachineOperatorBuilder::kFloat32RoundUp | |
2710 MachineOperatorBuilder::kFloat64RoundUp | | 2746 MachineOperatorBuilder::kFloat64RoundUp | |
2711 MachineOperatorBuilder::kFloat32RoundTruncate | | 2747 MachineOperatorBuilder::kFloat32RoundTruncate | |
2712 MachineOperatorBuilder::kFloat64RoundTruncate | | 2748 MachineOperatorBuilder::kFloat64RoundTruncate | |
2713 MachineOperatorBuilder::kFloat64RoundTiesAway | | 2749 MachineOperatorBuilder::kFloat64RoundTiesAway | |
2714 MachineOperatorBuilder::kFloat32RoundTiesEven | | 2750 MachineOperatorBuilder::kFloat32RoundTiesEven | |
2715 MachineOperatorBuilder::kFloat64RoundTiesEven | | 2751 MachineOperatorBuilder::kFloat64RoundTiesEven | |
2716 MachineOperatorBuilder::kWord32ShiftIsSafe | | 2752 MachineOperatorBuilder::kWord32ShiftIsSafe | |
2717 MachineOperatorBuilder::kInt32DivIsSafe | | 2753 MachineOperatorBuilder::kInt32DivIsSafe | |
2718 MachineOperatorBuilder::kUint32DivIsSafe | | 2754 MachineOperatorBuilder::kUint32DivIsSafe | |
2719 MachineOperatorBuilder::kWord32ReverseBits | | 2755 MachineOperatorBuilder::kWord32ReverseBits | |
2720 MachineOperatorBuilder::kWord64ReverseBits; | 2756 MachineOperatorBuilder::kWord64ReverseBits; |
2721 } | 2757 } |
2722 | 2758 |
2723 // static | 2759 // static |
2724 MachineOperatorBuilder::AlignmentRequirements | 2760 MachineOperatorBuilder::AlignmentRequirements |
2725 InstructionSelector::AlignmentRequirements() { | 2761 InstructionSelector::AlignmentRequirements() { |
2726 return MachineOperatorBuilder::AlignmentRequirements:: | 2762 return MachineOperatorBuilder::AlignmentRequirements:: |
2727 FullUnalignedAccessSupport(); | 2763 FullUnalignedAccessSupport(); |
2728 } | 2764 } |
2729 | 2765 |
2730 } // namespace compiler | 2766 } // namespace compiler |
2731 } // namespace internal | 2767 } // namespace internal |
2732 } // namespace v8 | 2768 } // namespace v8 |
OLD | NEW |