713 static bool supports_aes() { return (_features & CPU_AES) != 0; }
714 static bool supports_erms() { return (_features & CPU_ERMS) != 0; }
715 static bool supports_clmul() { return (_features & CPU_CLMUL) != 0; }
716 static bool supports_rtm() { return (_features & CPU_RTM) != 0; }
717 static bool supports_bmi1() { return (_features & CPU_BMI1) != 0; }
718 static bool supports_bmi2() { return (_features & CPU_BMI2) != 0; }
719 static bool supports_adx() { return (_features & CPU_ADX) != 0; }
720 static bool supports_evex() { return (_features & CPU_AVX512F) != 0; }
721 static bool supports_avx512dq() { return (_features & CPU_AVX512DQ) != 0; }
722 static bool supports_avx512pf() { return (_features & CPU_AVX512PF) != 0; }
723 static bool supports_avx512er() { return (_features & CPU_AVX512ER) != 0; }
724 static bool supports_avx512cd() { return (_features & CPU_AVX512CD) != 0; }
725 static bool supports_avx512bw() { return (_features & CPU_AVX512BW) != 0; }
726 static bool supports_avx512vl() { return (_features & CPU_AVX512VL) != 0; }
727 static bool supports_avx512vlbw() { return (supports_avx512bw() && supports_avx512vl()); }
728 static bool supports_avx512novl() { return (supports_evex() && !supports_avx512vl()); }
729 static bool supports_avx512nobw() { return (supports_evex() && !supports_avx512bw()); }
730 static bool supports_avx256only() { return (supports_avx2() && !supports_evex()); }
731 static bool supports_avxonly() { return ((supports_avx2() || supports_avx()) && !supports_evex()); }
732 static bool supports_sha() { return (_features & CPU_SHA) != 0; }
733 static bool supports_fma() { return (_features & CPU_FMA) != 0; }
734 // Intel features
735 static bool is_intel_family_core() { return is_intel() &&
736 extended_cpu_family() == CPU_FAMILY_INTEL_CORE; }
737
738 static bool is_intel_tsc_synched_at_init() {
739 if (is_intel_family_core()) {
740 uint32_t ext_model = extended_cpu_model();
741 if (ext_model == CPU_MODEL_NEHALEM_EP ||
742 ext_model == CPU_MODEL_WESTMERE_EP ||
743 ext_model == CPU_MODEL_SANDYBRIDGE_EP ||
744 ext_model == CPU_MODEL_IVYBRIDGE_EP) {
745 // <= 2-socket invariant tsc support. EX versions are usually used
746 // in > 2-socket systems and likely don't synchronize tscs at
747 // initialization.
748 // Code that uses tsc values must be prepared for them to arbitrarily
749 // jump forward or backward.
750 return true;
751 }
752 }
753 return false;
|
713 static bool supports_aes() { return (_features & CPU_AES) != 0; }
714 static bool supports_erms() { return (_features & CPU_ERMS) != 0; }
715 static bool supports_clmul() { return (_features & CPU_CLMUL) != 0; }
716 static bool supports_rtm() { return (_features & CPU_RTM) != 0; }
717 static bool supports_bmi1() { return (_features & CPU_BMI1) != 0; }
718 static bool supports_bmi2() { return (_features & CPU_BMI2) != 0; }
719 static bool supports_adx() { return (_features & CPU_ADX) != 0; }
720 static bool supports_evex() { return (_features & CPU_AVX512F) != 0; }
721 static bool supports_avx512dq() { return (_features & CPU_AVX512DQ) != 0; }
722 static bool supports_avx512pf() { return (_features & CPU_AVX512PF) != 0; }
723 static bool supports_avx512er() { return (_features & CPU_AVX512ER) != 0; }
724 static bool supports_avx512cd() { return (_features & CPU_AVX512CD) != 0; }
725 static bool supports_avx512bw() { return (_features & CPU_AVX512BW) != 0; }
726 static bool supports_avx512vl() { return (_features & CPU_AVX512VL) != 0; }
727 static bool supports_avx512vlbw() { return (supports_avx512bw() && supports_avx512vl()); }
728 static bool supports_avx512novl() { return (supports_evex() && !supports_avx512vl()); }
729 static bool supports_avx512nobw() { return (supports_evex() && !supports_avx512bw()); }
730 static bool supports_avx256only() { return (supports_avx2() && !supports_evex()); }
731 static bool supports_avxonly() { return ((supports_avx2() || supports_avx()) && !supports_evex()); }
732 static bool supports_sha() { return (_features & CPU_SHA) != 0; }
733 static bool supports_fma() { return (_features & CPU_FMA) != 0 && supports_avx(); }
734 // Intel features
735 static bool is_intel_family_core() { return is_intel() &&
736 extended_cpu_family() == CPU_FAMILY_INTEL_CORE; }
737
738 static bool is_intel_tsc_synched_at_init() {
739 if (is_intel_family_core()) {
740 uint32_t ext_model = extended_cpu_model();
741 if (ext_model == CPU_MODEL_NEHALEM_EP ||
742 ext_model == CPU_MODEL_WESTMERE_EP ||
743 ext_model == CPU_MODEL_SANDYBRIDGE_EP ||
744 ext_model == CPU_MODEL_IVYBRIDGE_EP) {
745 // <= 2-socket invariant tsc support. EX versions are usually used
746 // in > 2-socket systems and likely don't synchronize tscs at
747 // initialization.
748 // Code that uses tsc values must be prepared for them to arbitrarily
749 // jump forward or backward.
750 return true;
751 }
752 }
753 return false;
|