685 static bool supports_sse4_1() { return (_cpuFeatures & CPU_SSE4_1) != 0; }
686 static bool supports_sse4_2() { return (_cpuFeatures & CPU_SSE4_2) != 0; }
687 static bool supports_popcnt() { return (_cpuFeatures & CPU_POPCNT) != 0; }
688 static bool supports_avx() { return (_cpuFeatures & CPU_AVX) != 0; }
689 static bool supports_avx2() { return (_cpuFeatures & CPU_AVX2) != 0; }
690 static bool supports_tsc() { return (_cpuFeatures & CPU_TSC) != 0; }
691 static bool supports_aes() { return (_cpuFeatures & CPU_AES) != 0; }
692 static bool supports_erms() { return (_cpuFeatures & CPU_ERMS) != 0; }
693 static bool supports_clmul() { return (_cpuFeatures & CPU_CLMUL) != 0; }
694 static bool supports_rtm() { return (_cpuFeatures & CPU_RTM) != 0; }
695 static bool supports_bmi1() { return (_cpuFeatures & CPU_BMI1) != 0; }
696 static bool supports_bmi2() { return (_cpuFeatures & CPU_BMI2) != 0; }
697 static bool supports_adx() { return (_cpuFeatures & CPU_ADX) != 0; }
698 static bool supports_evex() { return (_cpuFeatures & CPU_AVX512F) != 0; }
699 static bool supports_avx512dq() { return (_cpuFeatures & CPU_AVX512DQ) != 0; }
700 static bool supports_avx512pf() { return (_cpuFeatures & CPU_AVX512PF) != 0; }
701 static bool supports_avx512er() { return (_cpuFeatures & CPU_AVX512ER) != 0; }
702 static bool supports_avx512cd() { return (_cpuFeatures & CPU_AVX512CD) != 0; }
703 static bool supports_avx512bw() { return (_cpuFeatures & CPU_AVX512BW) != 0; }
704 static bool supports_avx512vl() { return (_cpuFeatures & CPU_AVX512VL) != 0; }
705 // Intel features
706 static bool is_intel_family_core() { return is_intel() &&
707 extended_cpu_family() == CPU_FAMILY_INTEL_CORE; }
708
709 static bool is_intel_tsc_synched_at_init() {
710 if (is_intel_family_core()) {
711 uint32_t ext_model = extended_cpu_model();
712 if (ext_model == CPU_MODEL_NEHALEM_EP ||
713 ext_model == CPU_MODEL_WESTMERE_EP ||
714 ext_model == CPU_MODEL_SANDYBRIDGE_EP ||
715 ext_model == CPU_MODEL_IVYBRIDGE_EP) {
716 // <= 2-socket invariant tsc support. EX versions are usually used
717 // in > 2-socket systems and likely don't synchronize tscs at
718 // initialization.
719 // Code that uses tsc values must be prepared for them to arbitrarily
720 // jump forward or backward.
721 return true;
722 }
723 }
724 return false;
|
685 static bool supports_sse4_1() { return (_cpuFeatures & CPU_SSE4_1) != 0; }
686 static bool supports_sse4_2() { return (_cpuFeatures & CPU_SSE4_2) != 0; }
687 static bool supports_popcnt() { return (_cpuFeatures & CPU_POPCNT) != 0; }
688 static bool supports_avx() { return (_cpuFeatures & CPU_AVX) != 0; }
689 static bool supports_avx2() { return (_cpuFeatures & CPU_AVX2) != 0; }
690 static bool supports_tsc() { return (_cpuFeatures & CPU_TSC) != 0; }
691 static bool supports_aes() { return (_cpuFeatures & CPU_AES) != 0; }
692 static bool supports_erms() { return (_cpuFeatures & CPU_ERMS) != 0; }
693 static bool supports_clmul() { return (_cpuFeatures & CPU_CLMUL) != 0; }
694 static bool supports_rtm() { return (_cpuFeatures & CPU_RTM) != 0; }
695 static bool supports_bmi1() { return (_cpuFeatures & CPU_BMI1) != 0; }
696 static bool supports_bmi2() { return (_cpuFeatures & CPU_BMI2) != 0; }
697 static bool supports_adx() { return (_cpuFeatures & CPU_ADX) != 0; }
698 static bool supports_evex() { return (_cpuFeatures & CPU_AVX512F) != 0; }
699 static bool supports_avx512dq() { return (_cpuFeatures & CPU_AVX512DQ) != 0; }
700 static bool supports_avx512pf() { return (_cpuFeatures & CPU_AVX512PF) != 0; }
701 static bool supports_avx512er() { return (_cpuFeatures & CPU_AVX512ER) != 0; }
702 static bool supports_avx512cd() { return (_cpuFeatures & CPU_AVX512CD) != 0; }
703 static bool supports_avx512bw() { return (_cpuFeatures & CPU_AVX512BW) != 0; }
704 static bool supports_avx512vl() { return (_cpuFeatures & CPU_AVX512VL) != 0; }
705 static bool supports_avx512vlbw() { return (supports_avx512bw() && supports_avx512vl()); }
706 // Intel features
707 static bool is_intel_family_core() { return is_intel() &&
708 extended_cpu_family() == CPU_FAMILY_INTEL_CORE; }
709
710 static bool is_intel_tsc_synched_at_init() {
711 if (is_intel_family_core()) {
712 uint32_t ext_model = extended_cpu_model();
713 if (ext_model == CPU_MODEL_NEHALEM_EP ||
714 ext_model == CPU_MODEL_WESTMERE_EP ||
715 ext_model == CPU_MODEL_SANDYBRIDGE_EP ||
716 ext_model == CPU_MODEL_IVYBRIDGE_EP) {
717 // <= 2-socket invariant tsc support. EX versions are usually used
718 // in > 2-socket systems and likely don't synchronize tscs at
719 // initialization.
720 // Code that uses tsc values must be prepared for them to arbitrarily
721 // jump forward or backward.
722 return true;
723 }
724 }
725 return false;
|