Lines Matching +full:- +full:- +full:features
1 //===-- Host.cpp - Implement OS Host Concept --------------------*- C++ -*-===//
8 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
25 // Include the platform-specific parts of this class.
42 #define DEBUG_TYPE "host-detection"
44 //===----------------------------------------------------------------------===//
48 //===----------------------------------------------------------------------===//
62 return -1; in readCpuInfo()
67 return -1; in readCpuInfo()
172 /// getX86CpuIDAndInfo - Execute the specified cpuid and return the 4 values in
192 // pedantic #else returns to appease -Wunreachable-code (so we don't generate in getX86CpuIDAndInfo()
211 /// getX86CpuIDAndInfoEx - Execute the specified cpuid with subleaf and return
287 *Family = (EAX >> 8) & 0xf; // Bits 8 - 11 in detectX86FamilyModel()
288 *Model = (EAX >> 4) & 0xf; // Bits 4 - 7 in detectX86FamilyModel()
292 *Family += (EAX >> 20) & 0xff; // Bits 20 - 27 in detectX86FamilyModel()
294 *Model += ((EAX >> 16) & 0xf) << 4; // Bits 16 - 19 in detectX86FamilyModel()
300 unsigned int Brand_id, unsigned int Features, in getIntelProcessorTypeAndSubtype() argument
317 case 7: // Write-Back Enhanced IntelDX2 processors in getIntelProcessorTypeAndSubtype()
331 case 3: // Pentium OverDrive processors for Intel486 processor-based in getIntelProcessorTypeAndSubtype()
380 // Pentium Dual-Core processor, Intel Xeon processor, model in getIntelProcessorTypeAndSubtype()
444 *Type = INTEL_COREI7; // "skylake-avx512" in getIntelProcessorTypeAndSubtype()
478 if (Features & (1 << FEATURE_AVX512)) { in getIntelProcessorTypeAndSubtype()
483 if (Features & (1 << FEATURE_ADX)) { in getIntelProcessorTypeAndSubtype()
488 if (Features & (1 << FEATURE_AVX2)) { in getIntelProcessorTypeAndSubtype()
493 if (Features & (1 << FEATURE_AVX)) { in getIntelProcessorTypeAndSubtype()
498 if (Features & (1 << FEATURE_SSE4_2)) { in getIntelProcessorTypeAndSubtype()
499 if (Features & (1 << FEATURE_MOVBE)) { in getIntelProcessorTypeAndSubtype()
508 if (Features & (1 << FEATURE_SSE4_1)) { in getIntelProcessorTypeAndSubtype()
513 if (Features & (1 << FEATURE_SSSE3)) { in getIntelProcessorTypeAndSubtype()
514 if (Features & (1 << FEATURE_MOVBE)) { in getIntelProcessorTypeAndSubtype()
523 if (Features & (1 << FEATURE_EM64T)) { in getIntelProcessorTypeAndSubtype()
525 break; // x86-64 in getIntelProcessorTypeAndSubtype()
527 if (Features & (1 << FEATURE_SSE2)) { in getIntelProcessorTypeAndSubtype()
531 if (Features & (1 << FEATURE_SSE)) { in getIntelProcessorTypeAndSubtype()
535 if (Features & (1 << FEATURE_MMX)) { in getIntelProcessorTypeAndSubtype()
550 case 2: // Pentium 4 processor, Mobile Intel Pentium 4 processor - M, in getIntelProcessorTypeAndSubtype()
555 ((Features & (1 << FEATURE_EM64T)) ? INTEL_X86_64 : INTEL_PENTIUM_IV); in getIntelProcessorTypeAndSubtype()
570 ((Features & (1 << FEATURE_EM64T)) ? INTEL_NOCONA : INTEL_PRESCOTT); in getIntelProcessorTypeAndSubtype()
575 ((Features & (1 << FEATURE_EM64T)) ? INTEL_X86_64 : INTEL_PENTIUM_IV); in getIntelProcessorTypeAndSubtype()
587 unsigned int Features, in getAMDProcessorTypeAndSubtype() argument
591 // appears to be no way to generate the wide variety of AMD-specific targets in getAMDProcessorTypeAndSubtype()
606 break; // "k6-2" in getAMDProcessorTypeAndSubtype()
610 break; // "k6-3" in getAMDProcessorTypeAndSubtype()
621 break; // "athlon-tbird" in getAMDProcessorTypeAndSubtype()
626 break; // "athlon-mp" in getAMDProcessorTypeAndSubtype()
629 break; // "athlon-xp" in getAMDProcessorTypeAndSubtype()
634 if (Features & (1 << FEATURE_SSE3)) { in getAMDProcessorTypeAndSubtype()
636 break; // "k8-sse3" in getAMDProcessorTypeAndSubtype()
644 break; // "athlon-fx"; also opteron in getAMDProcessorTypeAndSubtype()
670 if (!(Features & in getAMDProcessorTypeAndSubtype()
677 break; // "bdver4"; 50h-6Fh: Excavator in getAMDProcessorTypeAndSubtype()
681 break; // "bdver3"; 30h-3Fh: Steamroller in getAMDProcessorTypeAndSubtype()
685 break; // "bdver2"; 10h-1Fh: Piledriver in getAMDProcessorTypeAndSubtype()
689 break; // "bdver1"; 00h-0Fh: Bulldozer in getAMDProcessorTypeAndSubtype()
694 if (!(Features & in getAMDProcessorTypeAndSubtype()
708 unsigned Features = 0; in getAvailableFeatures() local
710 Features |= (((EDX >> 23) & 1) << FEATURE_MMX); in getAvailableFeatures()
711 Features |= (((EDX >> 25) & 1) << FEATURE_SSE); in getAvailableFeatures()
712 Features |= (((EDX >> 26) & 1) << FEATURE_SSE2); in getAvailableFeatures()
713 Features |= (((ECX >> 0) & 1) << FEATURE_SSE3); in getAvailableFeatures()
714 Features |= (((ECX >> 9) & 1) << FEATURE_SSSE3); in getAvailableFeatures()
715 Features |= (((ECX >> 19) & 1) << FEATURE_SSE4_1); in getAvailableFeatures()
716 Features |= (((ECX >> 20) & 1) << FEATURE_SSE4_2); in getAvailableFeatures()
717 Features |= (((ECX >> 22) & 1) << FEATURE_MOVBE); in getAvailableFeatures()
731 Features |= (HasAVX << FEATURE_AVX); in getAvailableFeatures()
732 Features |= (HasAVX2 << FEATURE_AVX2); in getAvailableFeatures()
733 Features |= (HasAVX512 << FEATURE_AVX512); in getAvailableFeatures()
734 Features |= (HasAVX512Save << FEATURE_AVX512SAVE); in getAvailableFeatures()
735 Features |= (HasADX << FEATURE_ADX); in getAvailableFeatures()
738 Features |= (((EDX >> 29) & 0x1) << FEATURE_EM64T); in getAvailableFeatures()
739 return Features; in getAvailableFeatures()
753 unsigned Features = 0; in getHostCPUName() local
755 Features = getAvailableFeatures(ECX, EDX, MaxLeaf); in getHostCPUName()
761 getIntelProcessorTypeAndSubtype(Family, Model, Brand_id, Features, &Type, in getHostCPUName()
770 return "pentium-mmx"; in getHostCPUName()
781 return "pentium-m"; in getHostCPUName()
810 return "skylake-avx512"; in getHostCPUName()
826 return "x86-64"; in getHostCPUName()
835 getAMDProcessorTypeAndSubtype(Family, Model, Features, &Type, &Subtype); in getHostCPUName()
844 return "k6-2"; in getHostCPUName()
846 return "k6-3"; in getHostCPUName()
855 return "athlon-tbird"; in getHostCPUName()
857 return "athlon-mp"; in getHostCPUName()
859 return "athlon-xp"; in getHostCPUName()
861 return "k8-sse3"; in getHostCPUName()
865 return "athlon-fx"; in getHostCPUName()
953 // and so we must use an operating-system interface to determine the current in getHostCPUName()
961 if (CPUInfoSize == -1) in getHostCPUName()
997 CPULen = CIP - CPUStart; in getHostCPUName()
1042 if (CPUInfoSize == -1) in getHostCPUName()
1064 .Case("0x926", "arm926ej-s") in getHostCPUName()
1066 .Case("0xb36", "arm1136j-s") in getHostCPUName()
1067 .Case("0xb56", "arm1156t2-s") in getHostCPUName()
1068 .Case("0xb76", "arm1176jz-s") in getHostCPUName()
1069 .Case("0xc08", "cortex-a8") in getHostCPUName()
1070 .Case("0xc09", "cortex-a9") in getHostCPUName()
1071 .Case("0xc0f", "cortex-a15") in getHostCPUName()
1072 .Case("0xc20", "cortex-m0") in getHostCPUName()
1073 .Case("0xc23", "cortex-m3") in getHostCPUName()
1074 .Case("0xc24", "cortex-m4") in getHostCPUName()
1098 if (CPUInfoSize == -1) in getHostCPUName()
1105 // Look for the CPU features. in getHostCPUName()
1108 if (Lines[I].startswith("features")) { in getHostCPUName()
1130 Pos += sizeof("machine = ") - 1; in getHostCPUName()
1154 bool sys::getHostCPUFeatures(StringMap<bool> &Features) { in getHostCPUFeatures() argument
1168 Features["cmov"] = (EDX >> 15) & 1; in getHostCPUFeatures()
1169 Features["mmx"] = (EDX >> 23) & 1; in getHostCPUFeatures()
1170 Features["sse"] = (EDX >> 25) & 1; in getHostCPUFeatures()
1171 Features["sse2"] = (EDX >> 26) & 1; in getHostCPUFeatures()
1172 Features["sse3"] = (ECX >> 0) & 1; in getHostCPUFeatures()
1173 Features["ssse3"] = (ECX >> 9) & 1; in getHostCPUFeatures()
1174 Features["sse4.1"] = (ECX >> 19) & 1; in getHostCPUFeatures()
1175 Features["sse4.2"] = (ECX >> 20) & 1; in getHostCPUFeatures()
1177 Features["pclmul"] = (ECX >> 1) & 1; in getHostCPUFeatures()
1178 Features["cx16"] = (ECX >> 13) & 1; in getHostCPUFeatures()
1179 Features["movbe"] = (ECX >> 22) & 1; in getHostCPUFeatures()
1180 Features["popcnt"] = (ECX >> 23) & 1; in getHostCPUFeatures()
1181 Features["aes"] = (ECX >> 25) & 1; in getHostCPUFeatures()
1182 Features["rdrnd"] = (ECX >> 30) & 1; in getHostCPUFeatures()
1189 Features["avx"] = HasAVXSave; in getHostCPUFeatures()
1190 Features["fma"] = HasAVXSave && (ECX >> 12) & 1; in getHostCPUFeatures()
1191 Features["f16c"] = HasAVXSave && (ECX >> 29) & 1; in getHostCPUFeatures()
1194 Features["xsave"] = HasAVXSave && (ECX >> 26) & 1; in getHostCPUFeatures()
1204 Features["lzcnt"] = HasExtLeaf1 && ((ECX >> 5) & 1); in getHostCPUFeatures()
1205 Features["sse4a"] = HasExtLeaf1 && ((ECX >> 6) & 1); in getHostCPUFeatures()
1206 Features["prfchw"] = HasExtLeaf1 && ((ECX >> 8) & 1); in getHostCPUFeatures()
1207 Features["xop"] = HasExtLeaf1 && ((ECX >> 11) & 1) && HasAVXSave; in getHostCPUFeatures()
1208 Features["fma4"] = HasExtLeaf1 && ((ECX >> 16) & 1) && HasAVXSave; in getHostCPUFeatures()
1209 Features["tbm"] = HasExtLeaf1 && ((ECX >> 21) & 1); in getHostCPUFeatures()
1210 Features["mwaitx"] = HasExtLeaf1 && ((ECX >> 29) & 1); in getHostCPUFeatures()
1216 Features["avx2"] = HasAVXSave && HasLeaf7 && ((EBX >> 5) & 1); in getHostCPUFeatures()
1218 Features["fsgsbase"] = HasLeaf7 && ((EBX >> 0) & 1); in getHostCPUFeatures()
1219 Features["sgx"] = HasLeaf7 && ((EBX >> 2) & 1); in getHostCPUFeatures()
1220 Features["bmi"] = HasLeaf7 && ((EBX >> 3) & 1); in getHostCPUFeatures()
1221 Features["hle"] = HasLeaf7 && ((EBX >> 4) & 1); in getHostCPUFeatures()
1222 Features["bmi2"] = HasLeaf7 && ((EBX >> 8) & 1); in getHostCPUFeatures()
1223 Features["invpcid"] = HasLeaf7 && ((EBX >> 10) & 1); in getHostCPUFeatures()
1224 Features["rtm"] = HasLeaf7 && ((EBX >> 11) & 1); in getHostCPUFeatures()
1225 Features["rdseed"] = HasLeaf7 && ((EBX >> 18) & 1); in getHostCPUFeatures()
1226 Features["adx"] = HasLeaf7 && ((EBX >> 19) & 1); in getHostCPUFeatures()
1227 Features["smap"] = HasLeaf7 && ((EBX >> 20) & 1); in getHostCPUFeatures()
1228 Features["pcommit"] = HasLeaf7 && ((EBX >> 22) & 1); in getHostCPUFeatures()
1229 Features["clflushopt"] = HasLeaf7 && ((EBX >> 23) & 1); in getHostCPUFeatures()
1230 Features["clwb"] = HasLeaf7 && ((EBX >> 24) & 1); in getHostCPUFeatures()
1231 Features["sha"] = HasLeaf7 && ((EBX >> 29) & 1); in getHostCPUFeatures()
1234 Features["avx512f"] = HasLeaf7 && ((EBX >> 16) & 1) && HasAVX512Save; in getHostCPUFeatures()
1235 Features["avx512dq"] = HasLeaf7 && ((EBX >> 17) & 1) && HasAVX512Save; in getHostCPUFeatures()
1236 Features["avx512ifma"] = HasLeaf7 && ((EBX >> 21) & 1) && HasAVX512Save; in getHostCPUFeatures()
1237 Features["avx512pf"] = HasLeaf7 && ((EBX >> 26) & 1) && HasAVX512Save; in getHostCPUFeatures()
1238 Features["avx512er"] = HasLeaf7 && ((EBX >> 27) & 1) && HasAVX512Save; in getHostCPUFeatures()
1239 Features["avx512cd"] = HasLeaf7 && ((EBX >> 28) & 1) && HasAVX512Save; in getHostCPUFeatures()
1240 Features["avx512bw"] = HasLeaf7 && ((EBX >> 30) & 1) && HasAVX512Save; in getHostCPUFeatures()
1241 Features["avx512vl"] = HasLeaf7 && ((EBX >> 31) & 1) && HasAVX512Save; in getHostCPUFeatures()
1243 Features["prefetchwt1"] = HasLeaf7 && (ECX & 1); in getHostCPUFeatures()
1244 Features["avx512vbmi"] = HasLeaf7 && ((ECX >> 1) & 1) && HasAVX512Save; in getHostCPUFeatures()
1246 Features["pku"] = HasLeaf7 && ((ECX >> 4) & 1); in getHostCPUFeatures()
1252 Features["xsaveopt"] = HasAVXSave && HasLeafD && ((EAX >> 0) & 1); in getHostCPUFeatures()
1253 Features["xsavec"] = HasAVXSave && HasLeafD && ((EAX >> 1) & 1); in getHostCPUFeatures()
1254 Features["xsaves"] = HasAVXSave && HasLeafD && ((EAX >> 3) & 1); in getHostCPUFeatures()
1259 bool sys::getHostCPUFeatures(StringMap<bool> &Features) { in getHostCPUFeatures() argument
1260 // Read 1024 bytes from /proc/cpuinfo, which should contain the Features line in getHostCPUFeatures()
1264 if (CPUInfoSize == -1) in getHostCPUFeatures()
1274 // Look for the CPU features. in getHostCPUFeatures()
1276 if (Lines[I].startswith("Features")) { in getHostCPUFeatures()
1282 // Keep track of which crypto features we have seen in getHostCPUFeatures()
1291 .Case("fp", "fp-armv8") in getHostCPUFeatures()
1299 .Case("idiva", "hwdiv-arm") in getHostCPUFeatures()
1318 Features[LLVMFeatureStr] = true; in getHostCPUFeatures()
1324 Features["crypto"] = true; in getHostCPUFeatures()
1330 bool sys::getHostCPUFeatures(StringMap<bool> &Features) { return false; } in getHostCPUFeatures() argument