Index: src/compiler/x87/instruction-selector-x87.cc |
diff --git a/src/compiler/x87/instruction-selector-x87.cc b/src/compiler/x87/instruction-selector-x87.cc |
index c197380c4ce8b1ab789edb6bcf3638370f83187f..24f5c3f5c8c742394e6bf0e2b5df9683d1248ac2 100644 |
--- a/src/compiler/x87/instruction-selector-x87.cc |
+++ b/src/compiler/x87/instruction-selector-x87.cc |
@@ -517,7 +517,10 @@ void InstructionSelector::VisitWord32Clz(Node* node) { |
void InstructionSelector::VisitWord32Ctz(Node* node) { UNREACHABLE(); } |
-void InstructionSelector::VisitWord32Popcnt(Node* node) { UNREACHABLE(); } |
+void InstructionSelector::VisitWord32Popcnt(Node* node) { |
+ X87OperandGenerator g(this); |
+ Emit(kX87Popcnt, g.DefineAsRegister(node), g.Use(node->InputAt(0))); |
+} |
void InstructionSelector::VisitInt32Add(Node* node) { |
@@ -1371,6 +1374,9 @@ InstructionSelector::SupportedMachineOperatorFlags() { |
MachineOperatorBuilder::kFloat64Max | |
MachineOperatorBuilder::kFloat64Min | |
MachineOperatorBuilder::kWord32ShiftIsSafe; |
+ if (CpuFeatures::IsSupported(POPCNT)) { |
+ flags |= MachineOperatorBuilder::kWord32Popcnt; |
+ } |
return flags; |
} |