diff src/cpu/x86/vm/vm_version_x86.cpp @ 747:93c14e5562c4

6823354: Add intrinsics for {Integer,Long}.{numberOfLeadingZeros,numberOfTrailingZeros}() Summary: These methods can be instrinsified by using bit scan, bit test, and population count instructions. Reviewed-by: kvn, never
author twisti
date Wed, 06 May 2009 00:27:52 -0700
parents fbde8ec322d0
children 323bd24c6520
line wrap: on
line diff
--- a/src/cpu/x86/vm/vm_version_x86.cpp	Tue May 05 11:02:10 2009 -0700
+++ b/src/cpu/x86/vm/vm_version_x86.cpp	Wed May 06 00:27:52 2009 -0700
@@ -284,7 +284,7 @@
   }
 
   char buf[256];
-  jio_snprintf(buf, sizeof(buf), "(%u cores per cpu, %u threads per core) family %d model %d stepping %d%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
+  jio_snprintf(buf, sizeof(buf), "(%u cores per cpu, %u threads per core) family %d model %d stepping %d%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
                cores_per_cpu(), threads_per_core(),
                cpu_family(), _model, _stepping,
                (supports_cmov() ? ", cmov" : ""),
@@ -301,6 +301,7 @@
                (supports_mmx_ext() ? ", mmxext" : ""),
                (supports_3dnow()   ? ", 3dnow"  : ""),
                (supports_3dnow2()  ? ", 3dnowext" : ""),
+               (supports_lzcnt()   ? ", lzcnt": ""),
                (supports_sse4a()   ? ", sse4a": ""),
                (supports_ht() ? ", ht": ""));
   _features_str = strdup(buf);
@@ -364,6 +365,13 @@
         UseXmmI2D = false;
       }
     }
+
+    // Use count leading zeros count instruction if available.
+    if (supports_lzcnt()) {
+      if (FLAG_IS_DEFAULT(UseCountLeadingZerosInstruction)) {
+        UseCountLeadingZerosInstruction = true;
+      }
+    }
   }
 
   if( is_intel() ) { // Intel cpus specific settings