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/base/adapters.h" | 5 #include "src/base/adapters.h" |
6 #include "src/base/bits.h" | 6 #include "src/base/bits.h" |
7 #include "src/compiler/instruction-selector-impl.h" | 7 #include "src/compiler/instruction-selector-impl.h" |
8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 | 10 |
(...skipping 1974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1985 } else { | 1985 } else { |
1986 InstructionOperand addr_reg = g.TempRegister(); | 1986 InstructionOperand addr_reg = g.TempRegister(); |
1987 Emit(kMips64Dadd | AddressingModeField::encode(kMode_None), addr_reg, | 1987 Emit(kMips64Dadd | AddressingModeField::encode(kMode_None), addr_reg, |
1988 g.UseRegister(index), g.UseRegister(base)); | 1988 g.UseRegister(index), g.UseRegister(base)); |
1989 // Emit desired load opcode, using temp addr_reg. | 1989 // Emit desired load opcode, using temp addr_reg. |
1990 Emit(opcode | AddressingModeField::encode(kMode_MRI), | 1990 Emit(opcode | AddressingModeField::encode(kMode_MRI), |
1991 g.DefineAsRegister(node), addr_reg, g.TempImmediate(0)); | 1991 g.DefineAsRegister(node), addr_reg, g.TempImmediate(0)); |
1992 } | 1992 } |
1993 } | 1993 } |
1994 | 1994 |
| 1995 void InstructionSelector::VisitAtomicStore(Node* node) { |
| 1996 MachineRepresentation rep = AtomicStoreRepresentationOf(node->op()); |
| 1997 Mips64OperandGenerator g(this); |
| 1998 Node* base = node->InputAt(0); |
| 1999 Node* index = node->InputAt(1); |
| 2000 Node* value = node->InputAt(2); |
| 2001 ArchOpcode opcode = kArchNop; |
| 2002 switch (rep) { |
| 2003 case MachineRepresentation::kWord8: |
| 2004 opcode = kAtomicStoreWord8; |
| 2005 break; |
| 2006 case MachineRepresentation::kWord16: |
| 2007 opcode = kAtomicStoreWord16; |
| 2008 break; |
| 2009 case MachineRepresentation::kWord32: |
| 2010 opcode = kAtomicStoreWord32; |
| 2011 break; |
| 2012 default: |
| 2013 UNREACHABLE(); |
| 2014 return; |
| 2015 } |
| 2016 |
| 2017 if (g.CanBeImmediate(index, opcode)) { |
| 2018 Emit(opcode | AddressingModeField::encode(kMode_MRI), |
| 2019 g.DefineAsRegister(node), g.UseRegister(base), g.UseImmediate(index), |
| 2020 g.UseRegister(value)); |
| 2021 } else { |
| 2022 InstructionOperand addr_reg = g.TempRegister(); |
| 2023 Emit(kMips64Dadd | AddressingModeField::encode(kMode_None), addr_reg, |
| 2024 g.UseRegister(index), g.UseRegister(base)); |
| 2025 // Emit desired store opcode, using temp addr_reg. |
| 2026 Emit(opcode | AddressingModeField::encode(kMode_MRI), |
| 2027 g.DefineAsRegister(node), addr_reg, g.TempImmediate(0), |
| 2028 g.UseRegister(value)); |
| 2029 } |
| 2030 } |
| 2031 |
1995 // static | 2032 // static |
1996 MachineOperatorBuilder::Flags | 2033 MachineOperatorBuilder::Flags |
1997 InstructionSelector::SupportedMachineOperatorFlags() { | 2034 InstructionSelector::SupportedMachineOperatorFlags() { |
1998 return MachineOperatorBuilder::kWord32Ctz | | 2035 return MachineOperatorBuilder::kWord32Ctz | |
1999 MachineOperatorBuilder::kWord64Ctz | | 2036 MachineOperatorBuilder::kWord64Ctz | |
2000 MachineOperatorBuilder::kWord32Popcnt | | 2037 MachineOperatorBuilder::kWord32Popcnt | |
2001 MachineOperatorBuilder::kWord64Popcnt | | 2038 MachineOperatorBuilder::kWord64Popcnt | |
2002 MachineOperatorBuilder::kWord32ShiftIsSafe | | 2039 MachineOperatorBuilder::kWord32ShiftIsSafe | |
2003 MachineOperatorBuilder::kInt32DivIsSafe | | 2040 MachineOperatorBuilder::kInt32DivIsSafe | |
2004 MachineOperatorBuilder::kUint32DivIsSafe | | 2041 MachineOperatorBuilder::kUint32DivIsSafe | |
2005 MachineOperatorBuilder::kFloat64Min | | 2042 MachineOperatorBuilder::kFloat64Min | |
2006 MachineOperatorBuilder::kFloat64Max | | 2043 MachineOperatorBuilder::kFloat64Max | |
2007 MachineOperatorBuilder::kFloat32Min | | 2044 MachineOperatorBuilder::kFloat32Min | |
2008 MachineOperatorBuilder::kFloat32Max | | 2045 MachineOperatorBuilder::kFloat32Max | |
2009 MachineOperatorBuilder::kFloat64RoundDown | | 2046 MachineOperatorBuilder::kFloat64RoundDown | |
2010 MachineOperatorBuilder::kFloat32RoundDown | | 2047 MachineOperatorBuilder::kFloat32RoundDown | |
2011 MachineOperatorBuilder::kFloat64RoundUp | | 2048 MachineOperatorBuilder::kFloat64RoundUp | |
2012 MachineOperatorBuilder::kFloat32RoundUp | | 2049 MachineOperatorBuilder::kFloat32RoundUp | |
2013 MachineOperatorBuilder::kFloat64RoundTruncate | | 2050 MachineOperatorBuilder::kFloat64RoundTruncate | |
2014 MachineOperatorBuilder::kFloat32RoundTruncate | | 2051 MachineOperatorBuilder::kFloat32RoundTruncate | |
2015 MachineOperatorBuilder::kFloat64RoundTiesEven | | 2052 MachineOperatorBuilder::kFloat64RoundTiesEven | |
2016 MachineOperatorBuilder::kFloat32RoundTiesEven; | 2053 MachineOperatorBuilder::kFloat32RoundTiesEven; |
2017 } | 2054 } |
2018 | 2055 |
2019 } // namespace compiler | 2056 } // namespace compiler |
2020 } // namespace internal | 2057 } // namespace internal |
2021 } // namespace v8 | 2058 } // namespace v8 |
OLD | NEW |