Index: src/compiler/mips/instruction-selector-mips.cc |
diff --git a/src/compiler/mips/instruction-selector-mips.cc b/src/compiler/mips/instruction-selector-mips.cc |
index 3e0e3d8599ddf3432a186e2a66f5d568809e2b70..180f5262a77ae0d89eb7161f31e2b4bab53c6bc6 100644 |
--- a/src/compiler/mips/instruction-selector-mips.cc |
+++ b/src/compiler/mips/instruction-selector-mips.cc |
@@ -1481,6 +1481,43 @@ void InstructionSelector::VisitAtomicLoad(Node* node) { |
} |
} |
+void InstructionSelector::VisitAtomicStore(Node* node) { |
+ MachineRepresentation rep = AtomicStoreRepresentationOf(node->op()); |
+ MipsOperandGenerator g(this); |
+ Node* base = node->InputAt(0); |
+ Node* index = node->InputAt(1); |
+ Node* value = node->InputAt(2); |
+ ArchOpcode opcode = kArchNop; |
+ switch (rep) { |
+ case MachineRepresentation::kWord8: |
+ opcode = kAtomicStoreWord8; |
+ break; |
+ case MachineRepresentation::kWord16: |
+ opcode = kAtomicStoreWord16; |
+ break; |
+ case MachineRepresentation::kWord32: |
+ opcode = kAtomicStoreWord32; |
+ break; |
+ default: |
+ UNREACHABLE(); |
+ return; |
+ } |
+ |
+ if (g.CanBeImmediate(index, opcode)) { |
+ Emit(opcode | AddressingModeField::encode(kMode_MRI), |
+ g.DefineAsRegister(node), g.UseRegister(base), g.UseImmediate(index), |
+ g.UseRegister(value)); |
+ } else { |
+ InstructionOperand addr_reg = g.TempRegister(); |
+ Emit(kMipsAdd | AddressingModeField::encode(kMode_None), addr_reg, |
+ g.UseRegister(index), g.UseRegister(base)); |
+ // Emit desired store opcode, using temp addr_reg. |
+ Emit(opcode | AddressingModeField::encode(kMode_MRI), |
+ g.DefineAsRegister(node), addr_reg, g.TempImmediate(0), |
+ g.UseRegister(value)); |
+ } |
+} |
+ |
// static |
MachineOperatorBuilder::Flags |
InstructionSelector::SupportedMachineOperatorFlags() { |