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

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

Issue 1420233002: X87: Added Popcnt as an optional operator and implement it on x64 and ia32. (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/x87/instruction-codes-x87.h ('k') | src/x87/macro-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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 510
511 void InstructionSelector::VisitWord32Clz(Node* node) { 511 void InstructionSelector::VisitWord32Clz(Node* node) {
512 X87OperandGenerator g(this); 512 X87OperandGenerator g(this);
513 Emit(kX87Lzcnt, g.DefineAsRegister(node), g.Use(node->InputAt(0))); 513 Emit(kX87Lzcnt, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
514 } 514 }
515 515
516 516
517 void InstructionSelector::VisitWord32Ctz(Node* node) { UNREACHABLE(); } 517 void InstructionSelector::VisitWord32Ctz(Node* node) { UNREACHABLE(); }
518 518
519 519
520 void InstructionSelector::VisitWord32Popcnt(Node* node) { UNREACHABLE(); } 520 void InstructionSelector::VisitWord32Popcnt(Node* node) {
521 X87OperandGenerator g(this);
522 Emit(kX87Popcnt, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
523 }
521 524
522 525
523 void InstructionSelector::VisitInt32Add(Node* node) { 526 void InstructionSelector::VisitInt32Add(Node* node) {
524 X87OperandGenerator g(this); 527 X87OperandGenerator g(this);
525 528
526 // Try to match the Add to a lea pattern 529 // Try to match the Add to a lea pattern
527 BaseWithIndexAndDisplacement32Matcher m(node); 530 BaseWithIndexAndDisplacement32Matcher m(node);
528 if (m.matches() && 531 if (m.matches() &&
529 (m.displacement() == NULL || g.CanBeImmediate(m.displacement()))) { 532 (m.displacement() == NULL || g.CanBeImmediate(m.displacement()))) {
530 InstructionOperand inputs[4]; 533 InstructionOperand inputs[4];
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 1367
1365 // static 1368 // static
1366 MachineOperatorBuilder::Flags 1369 MachineOperatorBuilder::Flags
1367 InstructionSelector::SupportedMachineOperatorFlags() { 1370 InstructionSelector::SupportedMachineOperatorFlags() {
1368 MachineOperatorBuilder::Flags flags = 1371 MachineOperatorBuilder::Flags flags =
1369 MachineOperatorBuilder::kFloat32Max | 1372 MachineOperatorBuilder::kFloat32Max |
1370 MachineOperatorBuilder::kFloat32Min | 1373 MachineOperatorBuilder::kFloat32Min |
1371 MachineOperatorBuilder::kFloat64Max | 1374 MachineOperatorBuilder::kFloat64Max |
1372 MachineOperatorBuilder::kFloat64Min | 1375 MachineOperatorBuilder::kFloat64Min |
1373 MachineOperatorBuilder::kWord32ShiftIsSafe; 1376 MachineOperatorBuilder::kWord32ShiftIsSafe;
1377 if (CpuFeatures::IsSupported(POPCNT)) {
1378 flags |= MachineOperatorBuilder::kWord32Popcnt;
1379 }
1374 return flags; 1380 return flags;
1375 } 1381 }
1376 1382
1377 } // namespace compiler 1383 } // namespace compiler
1378 } // namespace internal 1384 } // namespace internal
1379 } // namespace v8 1385 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/x87/instruction-codes-x87.h ('k') | src/x87/macro-assembler-x87.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698