Mercurial > hg > graal-jvmci-8
comparison src/cpu/x86/vm/vm_version_x86.hpp @ 643:c771b7f43bbf
6378821: bitCount() should use POPC on SPARC processors and AMD+10h
Summary: bitCount() should use POPC on SPARC processors where POPC is implemented directly in hardware.
Reviewed-by: kvn, never
author | twisti |
---|---|
date | Fri, 13 Mar 2009 11:35:17 -0700 |
parents | 22e09c0f4b47 |
children | 93c14e5562c4 |
comparison
equal
deleted
inserted
replaced
642:660978a2a31a | 643:c771b7f43bbf |
---|---|
68 cmpxchg16: 1, | 68 cmpxchg16: 1, |
69 : 4, | 69 : 4, |
70 dca : 1, | 70 dca : 1, |
71 sse4_1 : 1, | 71 sse4_1 : 1, |
72 sse4_2 : 1, | 72 sse4_2 : 1, |
73 : 11; | 73 : 2, |
74 popcnt : 1, | |
75 : 8; | |
74 } bits; | 76 } bits; |
75 }; | 77 }; |
76 | 78 |
77 union StdCpuid1Edx { | 79 union StdCpuid1Edx { |
78 uint32_t value; | 80 uint32_t value; |
177 CPU_SSE2 = (1 << 7), | 179 CPU_SSE2 = (1 << 7), |
178 CPU_SSE3 = (1 << 8), // SSE3 comes from cpuid 1 (ECX) | 180 CPU_SSE3 = (1 << 8), // SSE3 comes from cpuid 1 (ECX) |
179 CPU_SSSE3 = (1 << 9), | 181 CPU_SSSE3 = (1 << 9), |
180 CPU_SSE4A = (1 << 10), | 182 CPU_SSE4A = (1 << 10), |
181 CPU_SSE4_1 = (1 << 11), | 183 CPU_SSE4_1 = (1 << 11), |
182 CPU_SSE4_2 = (1 << 12) | 184 CPU_SSE4_2 = (1 << 12), |
185 CPU_POPCNT = (1 << 13) | |
183 } cpuFeatureFlags; | 186 } cpuFeatureFlags; |
184 | 187 |
185 // cpuid information block. All info derived from executing cpuid with | 188 // cpuid information block. All info derived from executing cpuid with |
186 // various function numbers is stored here. Intel and AMD info is | 189 // various function numbers is stored here. Intel and AMD info is |
187 // merged in this block: accessor methods disentangle it. | 190 // merged in this block: accessor methods disentangle it. |
288 result |= CPU_SSE4A; | 291 result |= CPU_SSE4A; |
289 if (_cpuid_info.std_cpuid1_ecx.bits.sse4_1 != 0) | 292 if (_cpuid_info.std_cpuid1_ecx.bits.sse4_1 != 0) |
290 result |= CPU_SSE4_1; | 293 result |= CPU_SSE4_1; |
291 if (_cpuid_info.std_cpuid1_ecx.bits.sse4_2 != 0) | 294 if (_cpuid_info.std_cpuid1_ecx.bits.sse4_2 != 0) |
292 result |= CPU_SSE4_2; | 295 result |= CPU_SSE4_2; |
296 if (_cpuid_info.std_cpuid1_ecx.bits.popcnt != 0) | |
297 result |= CPU_POPCNT; | |
293 return result; | 298 return result; |
294 } | 299 } |
295 | 300 |
296 static void get_processor_features(); | 301 static void get_processor_features(); |
297 | 302 |
377 static bool supports_sse2() { return (_cpuFeatures & CPU_SSE2) != 0; } | 382 static bool supports_sse2() { return (_cpuFeatures & CPU_SSE2) != 0; } |
378 static bool supports_sse3() { return (_cpuFeatures & CPU_SSE3) != 0; } | 383 static bool supports_sse3() { return (_cpuFeatures & CPU_SSE3) != 0; } |
379 static bool supports_ssse3() { return (_cpuFeatures & CPU_SSSE3)!= 0; } | 384 static bool supports_ssse3() { return (_cpuFeatures & CPU_SSSE3)!= 0; } |
380 static bool supports_sse4_1() { return (_cpuFeatures & CPU_SSE4_1) != 0; } | 385 static bool supports_sse4_1() { return (_cpuFeatures & CPU_SSE4_1) != 0; } |
381 static bool supports_sse4_2() { return (_cpuFeatures & CPU_SSE4_2) != 0; } | 386 static bool supports_sse4_2() { return (_cpuFeatures & CPU_SSE4_2) != 0; } |
387 static bool supports_popcnt() { return (_cpuFeatures & CPU_POPCNT) != 0; } | |
382 // | 388 // |
383 // AMD features | 389 // AMD features |
384 // | 390 // |
385 static bool supports_3dnow() { return (_cpuFeatures & CPU_3DNOW) != 0; } | 391 static bool supports_3dnow() { return (_cpuFeatures & CPU_3DNOW) != 0; } |
386 static bool supports_mmx_ext() { return is_amd() && _cpuid_info.ext_cpuid1_edx.bits.mmx_amd != 0; } | 392 static bool supports_mmx_ext() { return is_amd() && _cpuid_info.ext_cpuid1_edx.bits.mmx_amd != 0; } |