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

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

Issue 1424173006: Implemented the Word64Popcnt TurboFan operator for x64. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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/x64/instruction-codes-x64.h ('k') | src/x64/disasm-x64.cc » ('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 <algorithm> 5 #include <algorithm>
6 6
7 #include "src/base/adapters.h" 7 #include "src/base/adapters.h"
8 #include "src/compiler/instruction-selector-impl.h" 8 #include "src/compiler/instruction-selector-impl.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/node-properties.h" 10 #include "src/compiler/node-properties.h"
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 Emit(kX64Tzcnt32, g.DefineAsRegister(node), g.Use(node->InputAt(0))); 595 Emit(kX64Tzcnt32, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
596 } 596 }
597 597
598 598
599 void InstructionSelector::VisitWord32Popcnt(Node* node) { 599 void InstructionSelector::VisitWord32Popcnt(Node* node) {
600 X64OperandGenerator g(this); 600 X64OperandGenerator g(this);
601 Emit(kX64Popcnt32, g.DefineAsRegister(node), g.Use(node->InputAt(0))); 601 Emit(kX64Popcnt32, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
602 } 602 }
603 603
604 604
605 void InstructionSelector::VisitWord64Popcnt(Node* node) {
606 X64OperandGenerator g(this);
607 Emit(kX64Popcnt, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
608 }
609
610
605 void InstructionSelector::VisitInt32Add(Node* node) { 611 void InstructionSelector::VisitInt32Add(Node* node) {
606 X64OperandGenerator g(this); 612 X64OperandGenerator g(this);
607 613
608 // Try to match the Add to a leal pattern 614 // Try to match the Add to a leal pattern
609 BaseWithIndexAndDisplacement32Matcher m(node); 615 BaseWithIndexAndDisplacement32Matcher m(node);
610 if (m.matches() && 616 if (m.matches() &&
611 (m.displacement() == NULL || g.CanBeImmediate(m.displacement()))) { 617 (m.displacement() == NULL || g.CanBeImmediate(m.displacement()))) {
612 EmitLea(this, kX64Lea32, node, m.index(), m.scale(), m.base(), 618 EmitLea(this, kX64Lea32, node, m.index(), m.scale(), m.base(),
613 m.displacement()); 619 m.displacement());
614 return; 620 return;
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 MachineOperatorBuilder::Flags 1613 MachineOperatorBuilder::Flags
1608 InstructionSelector::SupportedMachineOperatorFlags() { 1614 InstructionSelector::SupportedMachineOperatorFlags() {
1609 MachineOperatorBuilder::Flags flags = 1615 MachineOperatorBuilder::Flags flags =
1610 MachineOperatorBuilder::kFloat32Max | 1616 MachineOperatorBuilder::kFloat32Max |
1611 MachineOperatorBuilder::kFloat32Min | 1617 MachineOperatorBuilder::kFloat32Min |
1612 MachineOperatorBuilder::kFloat64Max | 1618 MachineOperatorBuilder::kFloat64Max |
1613 MachineOperatorBuilder::kFloat64Min | 1619 MachineOperatorBuilder::kFloat64Min |
1614 MachineOperatorBuilder::kWord32ShiftIsSafe | 1620 MachineOperatorBuilder::kWord32ShiftIsSafe |
1615 MachineOperatorBuilder::kWord32Ctz | MachineOperatorBuilder::kWord64Ctz; 1621 MachineOperatorBuilder::kWord32Ctz | MachineOperatorBuilder::kWord64Ctz;
1616 if (CpuFeatures::IsSupported(POPCNT)) { 1622 if (CpuFeatures::IsSupported(POPCNT)) {
1617 flags |= MachineOperatorBuilder::kWord32Popcnt; 1623 flags |= MachineOperatorBuilder::kWord32Popcnt |
1624 MachineOperatorBuilder::kWord64Popcnt;
1618 } 1625 }
1619 if (CpuFeatures::IsSupported(SSE4_1)) { 1626 if (CpuFeatures::IsSupported(SSE4_1)) {
1620 flags |= MachineOperatorBuilder::kFloat64RoundDown | 1627 flags |= MachineOperatorBuilder::kFloat64RoundDown |
1621 MachineOperatorBuilder::kFloat64RoundTruncate; 1628 MachineOperatorBuilder::kFloat64RoundTruncate;
1622 } 1629 }
1623 return flags; 1630 return flags;
1624 } 1631 }
1625 1632
1626 } // namespace compiler 1633 } // namespace compiler
1627 } // namespace internal 1634 } // namespace internal
1628 } // namespace v8 1635 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/x64/instruction-codes-x64.h ('k') | src/x64/disasm-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698