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

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

Issue 1405453003: CTZ instruction implemented as optional operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed a bug when bmi1=false Created 5 years, 2 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/x64/instruction-codes-x64.h ('k') | src/compiler/x87/instruction-selector-x87.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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 VisitWord64Shift(this, node, kX64Ror); 571 VisitWord64Shift(this, node, kX64Ror);
572 } 572 }
573 573
574 574
575 void InstructionSelector::VisitWord32Clz(Node* node) { 575 void InstructionSelector::VisitWord32Clz(Node* node) {
576 X64OperandGenerator g(this); 576 X64OperandGenerator g(this);
577 Emit(kX64Lzcnt32, g.DefineAsRegister(node), g.Use(node->InputAt(0))); 577 Emit(kX64Lzcnt32, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
578 } 578 }
579 579
580 580
581 void InstructionSelector::VisitWord32Ctz(Node* node) {
582 X64OperandGenerator g(this);
583 Emit(kX64Tzcnt32, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
584 }
585
586
581 void InstructionSelector::VisitInt32Add(Node* node) { 587 void InstructionSelector::VisitInt32Add(Node* node) {
582 X64OperandGenerator g(this); 588 X64OperandGenerator g(this);
583 589
584 // Try to match the Add to a leal pattern 590 // Try to match the Add to a leal pattern
585 BaseWithIndexAndDisplacement32Matcher m(node); 591 BaseWithIndexAndDisplacement32Matcher m(node);
586 if (m.matches() && 592 if (m.matches() &&
587 (m.displacement() == NULL || g.CanBeImmediate(m.displacement()))) { 593 (m.displacement() == NULL || g.CanBeImmediate(m.displacement()))) {
588 EmitLea(this, kX64Lea32, node, m.index(), m.scale(), m.base(), 594 EmitLea(this, kX64Lea32, node, m.index(), m.scale(), m.base(),
589 m.displacement()); 595 m.displacement());
590 return; 596 return;
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1697 1703
1698 1704
1699 // static 1705 // static
1700 MachineOperatorBuilder::Flags 1706 MachineOperatorBuilder::Flags
1701 InstructionSelector::SupportedMachineOperatorFlags() { 1707 InstructionSelector::SupportedMachineOperatorFlags() {
1702 MachineOperatorBuilder::Flags flags = 1708 MachineOperatorBuilder::Flags flags =
1703 MachineOperatorBuilder::kFloat32Max | 1709 MachineOperatorBuilder::kFloat32Max |
1704 MachineOperatorBuilder::kFloat32Min | 1710 MachineOperatorBuilder::kFloat32Min |
1705 MachineOperatorBuilder::kFloat64Max | 1711 MachineOperatorBuilder::kFloat64Max |
1706 MachineOperatorBuilder::kFloat64Min | 1712 MachineOperatorBuilder::kFloat64Min |
1707 MachineOperatorBuilder::kWord32ShiftIsSafe; 1713 MachineOperatorBuilder::kWord32ShiftIsSafe |
1714 MachineOperatorBuilder::kWord32Ctz;
1708 if (CpuFeatures::IsSupported(SSE4_1)) { 1715 if (CpuFeatures::IsSupported(SSE4_1)) {
1709 flags |= MachineOperatorBuilder::kFloat64RoundDown | 1716 flags |= MachineOperatorBuilder::kFloat64RoundDown |
1710 MachineOperatorBuilder::kFloat64RoundTruncate; 1717 MachineOperatorBuilder::kFloat64RoundTruncate;
1711 } 1718 }
1712 return flags; 1719 return flags;
1713 } 1720 }
1714 1721
1715 } // namespace compiler 1722 } // namespace compiler
1716 } // namespace internal 1723 } // namespace internal
1717 } // namespace v8 1724 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/x64/instruction-codes-x64.h ('k') | src/compiler/x87/instruction-selector-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698