Index: src/compiler/s390/instruction-selector-s390.cc |
diff --git a/src/compiler/s390/instruction-selector-s390.cc b/src/compiler/s390/instruction-selector-s390.cc |
index 2142d68b7fd2cff292f7f4ecb2c05944cedd690d..3476f1a5c58d54613369ec01d2ad02d8eb93e938 100644 |
--- a/src/compiler/s390/instruction-selector-s390.cc |
+++ b/src/compiler/s390/instruction-selector-s390.cc |
@@ -2517,7 +2517,39 @@ void InstructionSelector::VisitAtomicStore(Node* node) { |
inputs); |
} |
-void InstructionSelector::VisitAtomicExchange(Node* node) { UNIMPLEMENTED(); } |
+void InstructionSelector::VisitAtomicExchange(Node* node) { |
+ S390OperandGenerator g(this); |
+ Node* base = node->InputAt(0); |
+ Node* index = node->InputAt(1); |
+ Node* value = node->InputAt(2); |
+ ArchOpcode opcode = kArchNop; |
+ MachineType type = AtomicExchangeRepresentationOf(node->op()); |
+ if (type == MachineType::Int8()) { |
+ opcode = kAtomicExchangeInt8; |
+ } else if (type == MachineType::Uint8()) { |
+ opcode = kAtomicExchangeUint8; |
+ } else if (type == MachineType::Int16()) { |
+ opcode = kAtomicExchangeInt16; |
+ } else if (type == MachineType::Uint16()) { |
+ opcode = kAtomicExchangeUint16; |
+ } else if (type == MachineType::Int32() || type == MachineType::Uint32()) { |
+ opcode = kAtomicExchangeWord32; |
+ } else { |
+ UNREACHABLE(); |
+ return; |
+ } |
+ |
+ AddressingMode addressing_mode = kMode_MRR; |
+ 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); |
+ InstructionCode code = opcode | AddressingModeField::encode(addressing_mode); |
+ Emit(code, 1, outputs, input_count, inputs); |
+} |
// static |
MachineOperatorBuilder::Flags |