equal
deleted
inserted
replaced
76 dca : 1, |
76 dca : 1, |
77 sse4_1 : 1, |
77 sse4_1 : 1, |
78 sse4_2 : 1, |
78 sse4_2 : 1, |
79 : 2, |
79 : 2, |
80 popcnt : 1, |
80 popcnt : 1, |
81 : 3, |
81 : 1, |
|
82 aes : 1, |
|
83 : 1, |
82 osxsave : 1, |
84 osxsave : 1, |
83 avx : 1, |
85 avx : 1, |
84 : 3; |
86 : 3; |
85 } bits; |
87 } bits; |
86 }; |
88 }; |
242 CPU_POPCNT = (1 << 13), |
244 CPU_POPCNT = (1 << 13), |
243 CPU_LZCNT = (1 << 14), |
245 CPU_LZCNT = (1 << 14), |
244 CPU_TSC = (1 << 15), |
246 CPU_TSC = (1 << 15), |
245 CPU_TSCINV = (1 << 16), |
247 CPU_TSCINV = (1 << 16), |
246 CPU_AVX = (1 << 17), |
248 CPU_AVX = (1 << 17), |
247 CPU_AVX2 = (1 << 18) |
249 CPU_AVX2 = (1 << 18), |
|
250 CPU_AES = (1 << 19) |
248 } cpuFeatureFlags; |
251 } cpuFeatureFlags; |
249 |
252 |
250 enum { |
253 enum { |
251 // AMD |
254 // AMD |
252 CPU_FAMILY_AMD_11H = 0x11, |
255 CPU_FAMILY_AMD_11H = 0x11, |
418 } |
421 } |
419 if (_cpuid_info.std_cpuid1_edx.bits.tsc != 0) |
422 if (_cpuid_info.std_cpuid1_edx.bits.tsc != 0) |
420 result |= CPU_TSC; |
423 result |= CPU_TSC; |
421 if (_cpuid_info.ext_cpuid7_edx.bits.tsc_invariance != 0) |
424 if (_cpuid_info.ext_cpuid7_edx.bits.tsc_invariance != 0) |
422 result |= CPU_TSCINV; |
425 result |= CPU_TSCINV; |
|
426 if (_cpuid_info.std_cpuid1_ecx.bits.aes != 0) |
|
427 result |= CPU_AES; |
423 |
428 |
424 // AMD features. |
429 // AMD features. |
425 if (is_amd()) { |
430 if (is_amd()) { |
426 if ((_cpuid_info.ext_cpuid1_edx.bits.tdnow != 0) || |
431 if ((_cpuid_info.ext_cpuid1_edx.bits.tdnow != 0) || |
427 (_cpuid_info.ext_cpuid1_ecx.bits.prefetchw != 0)) |
432 (_cpuid_info.ext_cpuid1_ecx.bits.prefetchw != 0)) |
542 static bool supports_sse4_2() { return (_cpuFeatures & CPU_SSE4_2) != 0; } |
547 static bool supports_sse4_2() { return (_cpuFeatures & CPU_SSE4_2) != 0; } |
543 static bool supports_popcnt() { return (_cpuFeatures & CPU_POPCNT) != 0; } |
548 static bool supports_popcnt() { return (_cpuFeatures & CPU_POPCNT) != 0; } |
544 static bool supports_avx() { return (_cpuFeatures & CPU_AVX) != 0; } |
549 static bool supports_avx() { return (_cpuFeatures & CPU_AVX) != 0; } |
545 static bool supports_avx2() { return (_cpuFeatures & CPU_AVX2) != 0; } |
550 static bool supports_avx2() { return (_cpuFeatures & CPU_AVX2) != 0; } |
546 static bool supports_tsc() { return (_cpuFeatures & CPU_TSC) != 0; } |
551 static bool supports_tsc() { return (_cpuFeatures & CPU_TSC) != 0; } |
|
552 static bool supports_aes() { return (_cpuFeatures & CPU_AES) != 0; } |
547 |
553 |
548 // Intel features |
554 // Intel features |
549 static bool is_intel_family_core() { return is_intel() && |
555 static bool is_intel_family_core() { return is_intel() && |
550 extended_cpu_family() == CPU_FAMILY_INTEL_CORE; } |
556 extended_cpu_family() == CPU_FAMILY_INTEL_CORE; } |
551 |
557 |