Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: src/compiler/x87/instruction-selector-x87.cc

Issue 1947833002: X87: [Atomics] Make Atomics.store a builtin using TF. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/x87/instruction-codes-x87.h ('k') | src/x87/assembler-x87.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/compiler/instruction-selector-impl.h" 6 #include "src/compiler/instruction-selector-impl.h"
7 #include "src/compiler/node-matchers.h" 7 #include "src/compiler/node-matchers.h"
8 #include "src/compiler/node-properties.h" 8 #include "src/compiler/node-properties.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after
1591 1591
1592 void InstructionSelector::VisitAtomicLoad(Node* node) { 1592 void InstructionSelector::VisitAtomicLoad(Node* node) {
1593 LoadRepresentation load_rep = LoadRepresentationOf(node->op()); 1593 LoadRepresentation load_rep = LoadRepresentationOf(node->op());
1594 DCHECK(load_rep.representation() == MachineRepresentation::kWord8 || 1594 DCHECK(load_rep.representation() == MachineRepresentation::kWord8 ||
1595 load_rep.representation() == MachineRepresentation::kWord16 || 1595 load_rep.representation() == MachineRepresentation::kWord16 ||
1596 load_rep.representation() == MachineRepresentation::kWord32); 1596 load_rep.representation() == MachineRepresentation::kWord32);
1597 USE(load_rep); 1597 USE(load_rep);
1598 VisitLoad(node); 1598 VisitLoad(node);
1599 } 1599 }
1600 1600
1601 void InstructionSelector::VisitAtomicStore(Node* node) {
1602 X87OperandGenerator g(this);
1603 Node* base = node->InputAt(0);
1604 Node* index = node->InputAt(1);
1605 Node* value = node->InputAt(2);
1606
1607 MachineRepresentation rep = AtomicStoreRepresentationOf(node->op());
1608 ArchOpcode opcode = kArchNop;
1609 switch (rep) {
1610 case MachineRepresentation::kWord8:
1611 opcode = kX87Xchgb;
1612 break;
1613 case MachineRepresentation::kWord16:
1614 opcode = kX87Xchgw;
1615 break;
1616 case MachineRepresentation::kWord32:
1617 opcode = kX87Xchgl;
1618 break;
1619 default:
1620 UNREACHABLE();
1621 break;
1622 }
1623 AddressingMode addressing_mode;
1624 InstructionOperand inputs[4];
1625 size_t input_count = 0;
1626 inputs[input_count++] = g.UseUniqueRegister(base);
1627 if (g.CanBeImmediate(index)) {
1628 inputs[input_count++] = g.UseImmediate(index);
1629 addressing_mode = kMode_MRI;
1630 } else {
1631 inputs[input_count++] = g.UseUniqueRegister(index);
1632 addressing_mode = kMode_MR1;
1633 }
1634 inputs[input_count++] = g.UseUniqueRegister(value);
1635 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode);
1636 Emit(code, 0, nullptr, input_count, inputs);
1637 }
1638
1601 // static 1639 // static
1602 MachineOperatorBuilder::Flags 1640 MachineOperatorBuilder::Flags
1603 InstructionSelector::SupportedMachineOperatorFlags() { 1641 InstructionSelector::SupportedMachineOperatorFlags() {
1604 MachineOperatorBuilder::Flags flags = 1642 MachineOperatorBuilder::Flags flags =
1605 MachineOperatorBuilder::kFloat32Max | 1643 MachineOperatorBuilder::kFloat32Max |
1606 MachineOperatorBuilder::kFloat32Min | 1644 MachineOperatorBuilder::kFloat32Min |
1607 MachineOperatorBuilder::kFloat64Max | 1645 MachineOperatorBuilder::kFloat64Max |
1608 MachineOperatorBuilder::kFloat64Min | 1646 MachineOperatorBuilder::kFloat64Min |
1609 MachineOperatorBuilder::kWord32ShiftIsSafe; 1647 MachineOperatorBuilder::kWord32ShiftIsSafe;
1610 if (CpuFeatures::IsSupported(POPCNT)) { 1648 if (CpuFeatures::IsSupported(POPCNT)) {
1611 flags |= MachineOperatorBuilder::kWord32Popcnt; 1649 flags |= MachineOperatorBuilder::kWord32Popcnt;
1612 } 1650 }
1613 1651
1614 flags |= MachineOperatorBuilder::kFloat32RoundDown | 1652 flags |= MachineOperatorBuilder::kFloat32RoundDown |
1615 MachineOperatorBuilder::kFloat64RoundDown | 1653 MachineOperatorBuilder::kFloat64RoundDown |
1616 MachineOperatorBuilder::kFloat32RoundUp | 1654 MachineOperatorBuilder::kFloat32RoundUp |
1617 MachineOperatorBuilder::kFloat64RoundUp | 1655 MachineOperatorBuilder::kFloat64RoundUp |
1618 MachineOperatorBuilder::kFloat32RoundTruncate | 1656 MachineOperatorBuilder::kFloat32RoundTruncate |
1619 MachineOperatorBuilder::kFloat64RoundTruncate | 1657 MachineOperatorBuilder::kFloat64RoundTruncate |
1620 MachineOperatorBuilder::kFloat32RoundTiesEven | 1658 MachineOperatorBuilder::kFloat32RoundTiesEven |
1621 MachineOperatorBuilder::kFloat64RoundTiesEven; 1659 MachineOperatorBuilder::kFloat64RoundTiesEven;
1622 return flags; 1660 return flags;
1623 } 1661 }
1624 1662
1625 } // namespace compiler 1663 } // namespace compiler
1626 } // namespace internal 1664 } // namespace internal
1627 } // namespace v8 1665 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/x87/instruction-codes-x87.h ('k') | src/x87/assembler-x87.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698