Add popcnt support for pnacl

Detect popcount from cpuid and add feature flag in
pnacl.

BUG=660673

Review-Url: https://codereview.chromium.org/2458333002
Cr-Commit-Position: refs/heads/master@{#428632}
diff --git a/base/cpu_unittest.cc b/base/cpu_unittest.cc
index ec14620..9cabfd6 100644
--- a/base/cpu_unittest.cc
+++ b/base/cpu_unittest.cc
@@ -57,6 +57,11 @@
     __asm__ __volatile__("crc32 %%eax, %%eax\n" : : : "eax");
   }
 
+  if (cpu.has_popcnt()) {
+    // Execute a POPCNT instruction.
+    __asm__ __volatile__("popcnt %%eax, %%eax\n" : : : "eax");
+  }
+
   if (cpu.has_avx()) {
     // Execute an AVX instruction.
     __asm__ __volatile__("vzeroupper\n" : : : "xmm0");
@@ -100,6 +105,11 @@
     __asm crc32 eax, eax;
   }
 
+  if (cpu.has_popcnt()) {
+    // Execute a POPCNT instruction.
+    __asm popcnt eax, eax;
+  }
+
 // Visual C 2012 required for AVX.
 #if _MSC_VER >= 1700
   if (cpu.has_avx()) {