Index: src/compiler/arm/instruction-selector-arm.cc |
diff --git a/src/compiler/arm/instruction-selector-arm.cc b/src/compiler/arm/instruction-selector-arm.cc |
index 14e37d729d1ed01ff97a7b7a12e40c6b6a925529..819b8514ea6e809eb5203ba8a95fffa045213ed9 100644 |
--- a/src/compiler/arm/instruction-selector-arm.cc |
+++ b/src/compiler/arm/instruction-selector-arm.cc |
@@ -2234,7 +2234,7 @@ void InstructionSelector::VisitAtomicExchange(Node* node) { |
Node* index = node->InputAt(1); |
Node* value = node->InputAt(2); |
ArchOpcode opcode = kArchNop; |
- MachineType type = AtomicExchangeRepresentationOf(node->op()); |
+ MachineType type = AtomicOpRepresentationOf(node->op()); |
if (type == MachineType::Int8()) { |
opcode = kAtomicExchangeInt8; |
} else if (type == MachineType::Uint8()) { |
@@ -2271,7 +2271,7 @@ void InstructionSelector::VisitAtomicCompareExchange(Node* node) { |
Node* old_value = node->InputAt(2); |
Node* new_value = node->InputAt(3); |
ArchOpcode opcode = kArchNop; |
- MachineType type = AtomicCompareExchangeRepresentationOf(node->op()); |
+ MachineType type = AtomicOpRepresentationOf(node->op()); |
if (type == MachineType::Int8()) { |
opcode = kAtomicCompareExchangeInt8; |
} else if (type == MachineType::Uint8()) { |
@@ -2303,6 +2303,58 @@ void InstructionSelector::VisitAtomicCompareExchange(Node* node) { |
Emit(code, 1, outputs, input_count, inputs, 2, temp); |
} |
+void InstructionSelector::VisitAtomicBinaryOperation( |
+ Node* node, ArchOpcode int8_op, ArchOpcode uint8_op, ArchOpcode int16_op, |
+ ArchOpcode uint16_op, ArchOpcode word32_op) { |
+ ArmOperandGenerator g(this); |
+ Node* base = node->InputAt(0); |
+ Node* index = node->InputAt(1); |
+ Node* value = node->InputAt(2); |
+ ArchOpcode opcode = kArchNop; |
+ MachineType type = AtomicOpRepresentationOf(node->op()); |
+ if (type == MachineType::Int8()) { |
+ opcode = int8_op; |
+ } else if (type == MachineType::Uint8()) { |
+ opcode = uint8_op; |
+ } else if (type == MachineType::Int16()) { |
+ opcode = int16_op; |
+ } else if (type == MachineType::Uint16()) { |
+ opcode = uint16_op; |
+ } else if (type == MachineType::Int32() || type == MachineType::Uint32()) { |
+ opcode = word32_op; |
+ } else { |
+ UNREACHABLE(); |
+ return; |
+ } |
+ |
+ AddressingMode addressing_mode = kMode_Offset_RR; |
+ InstructionOperand inputs[3]; |
+ size_t input_count = 0; |
+ inputs[input_count++] = g.UseUniqueRegister(base); |
+ inputs[input_count++] = g.UseUniqueRegister(index); |
+ inputs[input_count++] = g.UseUniqueRegister(value); |
+ InstructionOperand outputs[1]; |
+ outputs[0] = g.UseUniqueRegister(node); |
+ InstructionOperand temps[2]; |
+ temps[0] = g.TempRegister(); |
+ temps[1] = g.TempRegister(); |
+ InstructionCode code = opcode | AddressingModeField::encode(addressing_mode); |
+ Emit(code, 1, outputs, input_count, inputs, 2, temps); |
+} |
+ |
+#define VISIT_ATOMIC_BINOP(op) \ |
+ void InstructionSelector::VisitAtomic##op(Node* node) { \ |
+ VisitAtomicBinaryOperation(node, kAtomic##op##Int8, kAtomic##op##Uint8, \ |
+ kAtomic##op##Int16, kAtomic##op##Uint16, \ |
+ kAtomic##op##Word32); \ |
+ } |
+VISIT_ATOMIC_BINOP(Add) |
+VISIT_ATOMIC_BINOP(Sub) |
+VISIT_ATOMIC_BINOP(And) |
+VISIT_ATOMIC_BINOP(Or) |
+VISIT_ATOMIC_BINOP(Xor) |
+#undef VISIT_ATOMIC_BINOP |
+ |
#define SIMD_TYPE_LIST(V) \ |
V(F32x4) \ |
V(I32x4) \ |