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