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

Side by Side Diff: src/compiler/ia32/instruction-selector-ia32.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/ia32/instruction-codes-ia32.h ('k') | src/compiler/instruction-selector.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 "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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 VisitShift(this, node, kIA32Ror); 546 VisitShift(this, node, kIA32Ror);
547 } 547 }
548 548
549 549
550 void InstructionSelector::VisitWord32Clz(Node* node) { 550 void InstructionSelector::VisitWord32Clz(Node* node) {
551 IA32OperandGenerator g(this); 551 IA32OperandGenerator g(this);
552 Emit(kIA32Lzcnt, g.DefineAsRegister(node), g.Use(node->InputAt(0))); 552 Emit(kIA32Lzcnt, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
553 } 553 }
554 554
555 555
556 void InstructionSelector::VisitWord32Ctz(Node* node) {
557 IA32OperandGenerator g(this);
558 Emit(kIA32Tzcnt, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
559 }
560
561
556 void InstructionSelector::VisitInt32Add(Node* node) { 562 void InstructionSelector::VisitInt32Add(Node* node) {
557 IA32OperandGenerator g(this); 563 IA32OperandGenerator g(this);
558 564
559 // Try to match the Add to a lea pattern 565 // Try to match the Add to a lea pattern
560 BaseWithIndexAndDisplacement32Matcher m(node); 566 BaseWithIndexAndDisplacement32Matcher m(node);
561 if (m.matches() && 567 if (m.matches() &&
562 (m.displacement() == NULL || g.CanBeImmediate(m.displacement()))) { 568 (m.displacement() == NULL || g.CanBeImmediate(m.displacement()))) {
563 InstructionOperand inputs[4]; 569 InstructionOperand inputs[4];
564 size_t input_count = 0; 570 size_t input_count = 0;
565 AddressingMode mode = g.GenerateMemoryOperandInputs( 571 AddressingMode mode = g.GenerateMemoryOperandInputs(
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 1356
1351 1357
1352 // static 1358 // static
1353 MachineOperatorBuilder::Flags 1359 MachineOperatorBuilder::Flags
1354 InstructionSelector::SupportedMachineOperatorFlags() { 1360 InstructionSelector::SupportedMachineOperatorFlags() {
1355 MachineOperatorBuilder::Flags flags = 1361 MachineOperatorBuilder::Flags flags =
1356 MachineOperatorBuilder::kFloat32Max | 1362 MachineOperatorBuilder::kFloat32Max |
1357 MachineOperatorBuilder::kFloat32Min | 1363 MachineOperatorBuilder::kFloat32Min |
1358 MachineOperatorBuilder::kFloat64Max | 1364 MachineOperatorBuilder::kFloat64Max |
1359 MachineOperatorBuilder::kFloat64Min | 1365 MachineOperatorBuilder::kFloat64Min |
1360 MachineOperatorBuilder::kWord32ShiftIsSafe; 1366 MachineOperatorBuilder::kWord32ShiftIsSafe |
1367 MachineOperatorBuilder::kWord32Ctz;
1361 if (CpuFeatures::IsSupported(SSE4_1)) { 1368 if (CpuFeatures::IsSupported(SSE4_1)) {
1362 flags |= MachineOperatorBuilder::kFloat64RoundDown | 1369 flags |= MachineOperatorBuilder::kFloat64RoundDown |
1363 MachineOperatorBuilder::kFloat64RoundTruncate; 1370 MachineOperatorBuilder::kFloat64RoundTruncate;
1364 } 1371 }
1365 return flags; 1372 return flags;
1366 } 1373 }
1367 1374
1368 } // namespace compiler 1375 } // namespace compiler
1369 } // namespace internal 1376 } // namespace internal
1370 } // namespace v8 1377 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ia32/instruction-codes-ia32.h ('k') | src/compiler/instruction-selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698