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 2719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2730 inputs[input_count++] = g.UseUniqueRegister(index); | 2730 inputs[input_count++] = g.UseUniqueRegister(index); |
2731 inputs[input_count++] = g.UseUniqueRegister(value); | 2731 inputs[input_count++] = g.UseUniqueRegister(value); |
2732 InstructionOperand outputs[1]; | 2732 InstructionOperand outputs[1]; |
2733 outputs[0] = g.UseUniqueRegister(node); | 2733 outputs[0] = g.UseUniqueRegister(node); |
2734 InstructionOperand temp[2]; | 2734 InstructionOperand temp[2]; |
2735 temp[0] = g.TempRegister(); | 2735 temp[0] = g.TempRegister(); |
2736 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode); | 2736 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode); |
2737 Emit(code, 1, outputs, input_count, inputs, 1, temp); | 2737 Emit(code, 1, outputs, input_count, inputs, 1, temp); |
2738 } | 2738 } |
2739 | 2739 |
| 2740 void InstructionSelector::VisitAtomicCompareExchange(Node* node) { |
| 2741 Arm64OperandGenerator g(this); |
| 2742 Node* base = node->InputAt(0); |
| 2743 Node* index = node->InputAt(1); |
| 2744 Node* old_value = node->InputAt(2); |
| 2745 Node* new_value = node->InputAt(3); |
| 2746 ArchOpcode opcode = kArchNop; |
| 2747 MachineType type = AtomicCompareExchangeRepresentationOf(node->op()); |
| 2748 if (type == MachineType::Int8()) { |
| 2749 opcode = kAtomicCompareExchangeInt8; |
| 2750 } else if (type == MachineType::Uint8()) { |
| 2751 opcode = kAtomicCompareExchangeUint8; |
| 2752 } else if (type == MachineType::Int16()) { |
| 2753 opcode = kAtomicCompareExchangeInt16; |
| 2754 } else if (type == MachineType::Uint16()) { |
| 2755 opcode = kAtomicCompareExchangeUint16; |
| 2756 } else if (type == MachineType::Int32() || type == MachineType::Uint32()) { |
| 2757 opcode = kAtomicCompareExchangeWord32; |
| 2758 } else { |
| 2759 UNREACHABLE(); |
| 2760 return; |
| 2761 } |
| 2762 |
| 2763 AddressingMode addressing_mode = kMode_MRR; |
| 2764 InstructionOperand inputs[4]; |
| 2765 size_t input_count = 0; |
| 2766 inputs[input_count++] = g.UseUniqueRegister(base); |
| 2767 inputs[input_count++] = g.UseUniqueRegister(index); |
| 2768 inputs[input_count++] = g.UseUniqueRegister(old_value); |
| 2769 inputs[input_count++] = g.UseUniqueRegister(new_value); |
| 2770 InstructionOperand outputs[1]; |
| 2771 outputs[0] = g.UseUniqueRegister(node); |
| 2772 InstructionOperand temp[2]; |
| 2773 temp[0] = g.TempRegister(); |
| 2774 temp[1] = g.TempRegister(); |
| 2775 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode); |
| 2776 Emit(code, 1, outputs, input_count, inputs, 2, temp); |
| 2777 } |
| 2778 |
2740 // static | 2779 // static |
2741 MachineOperatorBuilder::Flags | 2780 MachineOperatorBuilder::Flags |
2742 InstructionSelector::SupportedMachineOperatorFlags() { | 2781 InstructionSelector::SupportedMachineOperatorFlags() { |
2743 return MachineOperatorBuilder::kFloat32RoundDown | | 2782 return MachineOperatorBuilder::kFloat32RoundDown | |
2744 MachineOperatorBuilder::kFloat64RoundDown | | 2783 MachineOperatorBuilder::kFloat64RoundDown | |
2745 MachineOperatorBuilder::kFloat32RoundUp | | 2784 MachineOperatorBuilder::kFloat32RoundUp | |
2746 MachineOperatorBuilder::kFloat64RoundUp | | 2785 MachineOperatorBuilder::kFloat64RoundUp | |
2747 MachineOperatorBuilder::kFloat32RoundTruncate | | 2786 MachineOperatorBuilder::kFloat32RoundTruncate | |
2748 MachineOperatorBuilder::kFloat64RoundTruncate | | 2787 MachineOperatorBuilder::kFloat64RoundTruncate | |
2749 MachineOperatorBuilder::kFloat64RoundTiesAway | | 2788 MachineOperatorBuilder::kFloat64RoundTiesAway | |
2750 MachineOperatorBuilder::kFloat32RoundTiesEven | | 2789 MachineOperatorBuilder::kFloat32RoundTiesEven | |
2751 MachineOperatorBuilder::kFloat64RoundTiesEven | | 2790 MachineOperatorBuilder::kFloat64RoundTiesEven | |
2752 MachineOperatorBuilder::kWord32ShiftIsSafe | | 2791 MachineOperatorBuilder::kWord32ShiftIsSafe | |
2753 MachineOperatorBuilder::kInt32DivIsSafe | | 2792 MachineOperatorBuilder::kInt32DivIsSafe | |
2754 MachineOperatorBuilder::kUint32DivIsSafe | | 2793 MachineOperatorBuilder::kUint32DivIsSafe | |
2755 MachineOperatorBuilder::kWord32ReverseBits | | 2794 MachineOperatorBuilder::kWord32ReverseBits | |
2756 MachineOperatorBuilder::kWord64ReverseBits; | 2795 MachineOperatorBuilder::kWord64ReverseBits; |
2757 } | 2796 } |
2758 | 2797 |
2759 // static | 2798 // static |
2760 MachineOperatorBuilder::AlignmentRequirements | 2799 MachineOperatorBuilder::AlignmentRequirements |
2761 InstructionSelector::AlignmentRequirements() { | 2800 InstructionSelector::AlignmentRequirements() { |
2762 return MachineOperatorBuilder::AlignmentRequirements:: | 2801 return MachineOperatorBuilder::AlignmentRequirements:: |
2763 FullUnalignedAccessSupport(); | 2802 FullUnalignedAccessSupport(); |
2764 } | 2803 } |
2765 | 2804 |
2766 } // namespace compiler | 2805 } // namespace compiler |
2767 } // namespace internal | 2806 } // namespace internal |
2768 } // namespace v8 | 2807 } // namespace v8 |
OLD | NEW |