21#include "llvm/Config/llvm-config.h"
44#include <mach/host_info.h>
46#include <mach/mach_host.h>
47#include <mach/machine.h>
49#include <sys/sysctl.h>
52#include <sys/systemcfg.h>
54#if defined(__sun__) && defined(__svr4__)
57#if defined(__GNUC__) || defined(__clang__)
58#if (defined(__i386__) || defined(__x86_64__)) && !defined(_MSC_VER)
63#define DEBUG_TYPE "host-detection"
73static std::unique_ptr<llvm::MemoryBuffer>
75 const char *CPUInfoFile =
"/proc/cpuinfo";
76 if (
const char *CpuinfoIntercept = std::getenv(
"LLVM_CPUINFO"))
77 CPUInfoFile = CpuinfoIntercept;
81 if (std::error_code EC = Text.getError()) {
82 llvm::errs() <<
"Can't read " << CPUInfoFile <<
": " << EC.message()
86 return std::move(*Text);
93 const char *
generic =
"generic";
107 while (CIP < CPUInfoEnd && CPUStart ==
nullptr) {
108 if (CIP < CPUInfoEnd && *CIP ==
'\n')
111 if (CIP < CPUInfoEnd && *CIP ==
'c') {
113 if (CIP < CPUInfoEnd && *CIP ==
'p') {
115 if (CIP < CPUInfoEnd && *CIP ==
'u') {
117 while (CIP < CPUInfoEnd && (*CIP ==
' ' || *CIP ==
'\t'))
120 if (CIP < CPUInfoEnd && *CIP ==
':') {
122 while (CIP < CPUInfoEnd && (*CIP ==
' ' || *CIP ==
'\t'))
125 if (CIP < CPUInfoEnd) {
127 while (CIP < CPUInfoEnd && (*CIP !=
' ' && *CIP !=
'\t' &&
128 *CIP !=
',' && *CIP !=
'\n'))
130 CPULen = CIP - CPUStart;
137 if (CPUStart ==
nullptr)
138 while (CIP < CPUInfoEnd && *CIP !=
'\n')
142 if (CPUStart ==
nullptr)
146 .
Case(
"604e",
"604e")
148 .
Case(
"7400",
"7400")
149 .
Case(
"7410",
"7400")
150 .
Case(
"7447",
"7400")
151 .
Case(
"7455",
"7450")
153 .
Case(
"POWER4",
"970")
154 .
Case(
"PPC970FX",
"970")
155 .
Case(
"PPC970MP",
"970")
157 .
Case(
"POWER5",
"g5")
159 .
Case(
"POWER6",
"pwr6")
160 .
Case(
"POWER7",
"pwr7")
161 .
Case(
"POWER8",
"pwr8")
162 .
Case(
"POWER8E",
"pwr8")
163 .
Case(
"POWER8NVL",
"pwr8")
164 .
Case(
"POWER9",
"pwr9")
165 .
Case(
"POWER10",
"pwr10")
166 .
Case(
"POWER11",
"pwr11")
179 if (Parts.
size() == 2)
180 return (Parts[0] == Big && Parts[1] == Little) ||
181 (Parts[1] == Big && Parts[0] == Little);
185 if (Implementer ==
"0x41") {
192 if (MatchBigLittle(Parts,
"0xd85",
"0xd87"))
193 return "cortex-x925";
201 .
Case(
"0x926",
"arm926ej-s")
202 .
Case(
"0xb02",
"mpcore")
203 .
Case(
"0xb36",
"arm1136j-s")
204 .
Case(
"0xb56",
"arm1156t2-s")
205 .
Case(
"0xb76",
"arm1176jz-s")
206 .
Case(
"0xc05",
"cortex-a5")
207 .
Case(
"0xc07",
"cortex-a7")
208 .
Case(
"0xc08",
"cortex-a8")
209 .
Case(
"0xc09",
"cortex-a9")
210 .
Case(
"0xc0f",
"cortex-a15")
211 .
Case(
"0xc0e",
"cortex-a17")
212 .
Case(
"0xc20",
"cortex-m0")
213 .
Case(
"0xc23",
"cortex-m3")
214 .
Case(
"0xc24",
"cortex-m4")
215 .
Case(
"0xc27",
"cortex-m7")
216 .
Case(
"0xd20",
"cortex-m23")
217 .
Case(
"0xd21",
"cortex-m33")
218 .
Case(
"0xd24",
"cortex-m52")
219 .
Case(
"0xd22",
"cortex-m55")
220 .
Case(
"0xd23",
"cortex-m85")
221 .
Case(
"0xc18",
"cortex-r8")
222 .
Case(
"0xd13",
"cortex-r52")
223 .
Case(
"0xd16",
"cortex-r52plus")
224 .
Case(
"0xd15",
"cortex-r82")
225 .
Case(
"0xd14",
"cortex-r82ae")
226 .
Case(
"0xd02",
"cortex-a34")
227 .
Case(
"0xd04",
"cortex-a35")
228 .
Case(
"0xd8f",
"cortex-a320")
229 .
Case(
"0xd03",
"cortex-a53")
230 .
Case(
"0xd05",
"cortex-a55")
231 .
Case(
"0xd46",
"cortex-a510")
232 .
Case(
"0xd80",
"cortex-a520")
233 .
Case(
"0xd88",
"cortex-a520ae")
234 .
Case(
"0xd07",
"cortex-a57")
235 .
Case(
"0xd06",
"cortex-a65")
236 .
Case(
"0xd43",
"cortex-a65ae")
237 .
Case(
"0xd08",
"cortex-a72")
238 .
Case(
"0xd09",
"cortex-a73")
239 .
Case(
"0xd0a",
"cortex-a75")
240 .
Case(
"0xd0b",
"cortex-a76")
241 .
Case(
"0xd0e",
"cortex-a76ae")
242 .
Case(
"0xd0d",
"cortex-a77")
243 .
Case(
"0xd41",
"cortex-a78")
244 .
Case(
"0xd42",
"cortex-a78ae")
245 .
Case(
"0xd4b",
"cortex-a78c")
246 .
Case(
"0xd47",
"cortex-a710")
247 .
Case(
"0xd4d",
"cortex-a715")
248 .
Case(
"0xd81",
"cortex-a720")
249 .
Case(
"0xd89",
"cortex-a720ae")
250 .
Case(
"0xd87",
"cortex-a725")
251 .
Case(
"0xd44",
"cortex-x1")
252 .
Case(
"0xd4c",
"cortex-x1c")
253 .
Case(
"0xd48",
"cortex-x2")
254 .
Case(
"0xd4e",
"cortex-x3")
255 .
Case(
"0xd82",
"cortex-x4")
256 .
Case(
"0xd85",
"cortex-x925")
257 .
Case(
"0xd4a",
"neoverse-e1")
258 .
Case(
"0xd0c",
"neoverse-n1")
259 .
Case(
"0xd49",
"neoverse-n2")
260 .
Case(
"0xd8e",
"neoverse-n3")
261 .
Case(
"0xd40",
"neoverse-v1")
262 .
Case(
"0xd4f",
"neoverse-v2")
263 .
Case(
"0xd84",
"neoverse-v3")
264 .
Case(
"0xd83",
"neoverse-v3ae")
268 if (Implementer ==
"0x42" || Implementer ==
"0x43") {
270 .
Case(
"0x516",
"thunderx2t99")
271 .
Case(
"0x0516",
"thunderx2t99")
272 .
Case(
"0xaf",
"thunderx2t99")
273 .
Case(
"0x0af",
"thunderx2t99")
274 .
Case(
"0xa1",
"thunderxt88")
275 .
Case(
"0x0a1",
"thunderxt88")
279 if (Implementer ==
"0x46") {
281 .
Case(
"0x001",
"a64fx")
282 .
Case(
"0x003",
"fujitsu-monaka")
286 if (Implementer ==
"0x4e") {
288 .
Case(
"0x004",
"carmel")
289 .
Case(
"0x10",
"olympus")
290 .
Case(
"0x010",
"olympus")
294 if (Implementer ==
"0x48")
299 .
Case(
"0xd01",
"tsv110")
302 if (Implementer ==
"0x51")
307 .
Case(
"0x06f",
"krait")
308 .
Case(
"0x201",
"kryo")
309 .
Case(
"0x205",
"kryo")
310 .
Case(
"0x211",
"kryo")
311 .
Case(
"0x800",
"cortex-a73")
312 .
Case(
"0x801",
"cortex-a73")
313 .
Case(
"0x802",
"cortex-a75")
314 .
Case(
"0x803",
"cortex-a75")
315 .
Case(
"0x804",
"cortex-a76")
316 .
Case(
"0x805",
"cortex-a76")
317 .
Case(
"0xc00",
"falkor")
318 .
Case(
"0xc01",
"saphira")
319 .
Case(
"0x001",
"oryon-1")
321 if (Implementer ==
"0x53") {
327 unsigned Variant = GetVariant();
334 unsigned Exynos = (Variant << 12) | PartAsInt;
346 if (Implementer ==
"0x61") {
348 .
Case(
"0x020",
"apple-m1")
349 .
Case(
"0x021",
"apple-m1")
350 .
Case(
"0x022",
"apple-m1")
351 .
Case(
"0x023",
"apple-m1")
352 .
Case(
"0x024",
"apple-m1")
353 .
Case(
"0x025",
"apple-m1")
354 .
Case(
"0x028",
"apple-m1")
355 .
Case(
"0x029",
"apple-m1")
356 .
Case(
"0x030",
"apple-m2")
357 .
Case(
"0x031",
"apple-m2")
358 .
Case(
"0x032",
"apple-m2")
359 .
Case(
"0x033",
"apple-m2")
360 .
Case(
"0x034",
"apple-m2")
361 .
Case(
"0x035",
"apple-m2")
362 .
Case(
"0x038",
"apple-m2")
363 .
Case(
"0x039",
"apple-m2")
364 .
Case(
"0x049",
"apple-m3")
365 .
Case(
"0x048",
"apple-m3")
369 if (Implementer ==
"0x63") {
371 .
Case(
"0x132",
"star-mc1")
375 if (Implementer ==
"0x6d") {
378 .
Case(
"0xd49",
"neoverse-n2")
382 if (Implementer ==
"0xc0") {
384 .
Case(
"0xac3",
"ampere1")
385 .
Case(
"0xac4",
"ampere1a")
386 .
Case(
"0xac5",
"ampere1b")
400 ProcCpuinfoContent.
split(Lines,
'\n');
408 if (Line.consume_front(
"CPU implementer"))
409 Implementer = Line.ltrim(
"\t :");
410 else if (Line.consume_front(
"Hardware"))
411 Hardware = Line.ltrim(
"\t :");
412 else if (Line.consume_front(
"CPU part"))
423 auto GetVariant = [&]() {
424 unsigned Variant = 0;
426 if (
I.consume_front(
"CPU variant"))
427 I.ltrim(
"\t :").getAsInteger(0, Variant);
444 for (
auto Info : UniqueCpuInfos)
445 PartsHolder.
push_back(
"0x" + utohexstr(Bitfield::get<PartNum>(
Info),
451 for (
const auto &Part : PartsHolder)
455 "0x" + utohexstr(Bitfield::get<Implementer>(PrimaryCpuInfo),
459 "0x" + utohexstr(Bitfield::get<PartNum>(PrimaryCpuInfo),
462 Parts, [=]() {
return Bitfield::get<Variant>(PrimaryCpuInfo); });
466StringRef getCPUNameFromS390Model(
unsigned int Id,
bool HaveVectorSupport) {
486 return HaveVectorSupport?
"z13" :
"zEC12";
489 return HaveVectorSupport?
"z14" :
"zEC12";
492 return HaveVectorSupport?
"z15" :
"zEC12";
495 return HaveVectorSupport?
"z16" :
"zEC12";
499 return HaveVectorSupport?
"z17" :
"zEC12";
510 ProcCpuinfoContent.
split(Lines,
'\n');
514 for (
unsigned I = 0, E = Lines.size();
I != E; ++
I)
516 size_t Pos = Lines[
I].find(
':');
518 Lines[
I].drop_front(Pos + 1).split(CPUFeatures,
' ');
526 bool HaveVectorSupport =
false;
527 for (
unsigned I = 0, E = CPUFeatures.
size();
I != E; ++
I) {
528 if (CPUFeatures[
I] ==
"vx")
529 HaveVectorSupport =
true;
533 for (
unsigned I = 0, E = Lines.size();
I != E; ++
I) {
535 size_t Pos = Lines[
I].find(
"machine = ");
537 Pos +=
sizeof(
"machine = ") - 1;
539 if (!Lines[
I].drop_front(Pos).getAsInteger(10, Id))
540 return getCPUNameFromS390Model(Id, HaveVectorSupport);
552 ProcCpuinfoContent.
split(Lines,
'\n');
556 for (
unsigned I = 0, E = Lines.size();
I != E; ++
I) {
558 UArch = Lines[
I].substr(5).ltrim(
"\t :");
564 .
Case(
"eswin,eic770x",
"sifive-p550")
565 .
Case(
"sifive,u74-mc",
"sifive-u74")
566 .
Case(
"sifive,bullet0",
"sifive-u74")
571#if !defined(__linux__) || !defined(__x86_64__)
574 uint8_t v3_insns[40] __attribute__ ((aligned (8))) =
576 { 0xb7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
578 0xb7, 0x2, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0,
580 0xae, 0x20, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0,
582 0xb7, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0,
584 0x95, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 };
586 uint8_t v2_insns[40] __attribute__ ((aligned (8))) =
588 { 0xb7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
590 0xb7, 0x2, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0,
592 0xad, 0x20, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0,
594 0xb7, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0,
596 0x95, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 };
598 struct bpf_prog_load_attr {
614 int fd = syscall(321 , 5 , &attr,
622 memset(&attr, 0,
sizeof(attr));
627 fd = syscall(321 , 5 , &attr,
sizeof(attr));
636#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || \
637 defined(_M_X64)) && \
642static bool getX86CpuIDAndInfo(
unsigned value,
unsigned *rEAX,
unsigned *rEBX,
643 unsigned *rECX,
unsigned *rEDX) {
644#if (defined(__i386__) || defined(__x86_64__)) && !defined(_MSC_VER)
645 return !__get_cpuid(
value, rEAX, rEBX, rECX, rEDX);
646#elif defined(_MSC_VER)
649 __cpuid(registers,
value);
650 *rEAX = registers[0];
651 *rEBX = registers[1];
652 *rECX = registers[2];
653 *rEDX = registers[3];
665VendorSignatures getVendorSignature(
unsigned *MaxLeaf) {
666 unsigned EAX = 0, EBX = 0, ECX = 0, EDX = 0;
667 if (MaxLeaf ==
nullptr)
672 if (getX86CpuIDAndInfo(0, MaxLeaf, &EBX, &ECX, &EDX) || *MaxLeaf < 1)
673 return VendorSignatures::UNKNOWN;
676 if (EBX == 0x756e6547 && EDX == 0x49656e69 && ECX == 0x6c65746e)
677 return VendorSignatures::GENUINE_INTEL;
680 if (EBX == 0x68747541 && EDX == 0x69746e65 && ECX == 0x444d4163)
681 return VendorSignatures::AUTHENTIC_AMD;
683 return VendorSignatures::UNKNOWN;
696static bool getX86CpuIDAndInfoEx(
unsigned value,
unsigned subleaf,
697 unsigned *rEAX,
unsigned *rEBX,
unsigned *rECX,
703#if (defined(__i386__) || defined(__x86_64__)) && !defined(_MSC_VER)
704 return !__get_cpuid_count(
value, subleaf, rEAX, rEBX, rECX, rEDX);
705#elif defined(_MSC_VER)
707 __cpuidex(registers,
value, subleaf);
708 *rEAX = registers[0];
709 *rEBX = registers[1];
710 *rECX = registers[2];
711 *rEDX = registers[3];
719static bool getX86XCR0(
unsigned *rEAX,
unsigned *rEDX) {
723#if defined(__GNUC__) || defined(__clang__)
727 __asm__(
".byte 0x0f, 0x01, 0xd0" :
"=a"(*rEAX),
"=d"(*rEDX) :
"c"(0));
729#elif defined(_MSC_FULL_VER) && defined(_XCR_XFEATURE_ENABLED_MASK)
730 unsigned long long Result = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
739static void detectX86FamilyModel(
unsigned EAX,
unsigned *Family,
741 *Family = (
EAX >> 8) & 0xf;
743 if (*Family == 6 || *Family == 0xf) {
746 *Family += (
EAX >> 20) & 0xff;
752#define testFeature(F) (Features[F / 32] & (1 << (F % 32))) != 0
754static StringRef getIntelProcessorTypeAndSubtype(
unsigned Family,
756 const unsigned *Features,
769 if (testFeature(X86::FEATURE_MMX)) {
785 *
Type = X86::INTEL_CORE2;
794 *
Type = X86::INTEL_CORE2;
803 *
Type = X86::INTEL_COREI7;
804 *Subtype = X86::INTEL_COREI7_NEHALEM;
811 *
Type = X86::INTEL_COREI7;
812 *Subtype = X86::INTEL_COREI7_WESTMERE;
818 *
Type = X86::INTEL_COREI7;
819 *Subtype = X86::INTEL_COREI7_SANDYBRIDGE;
824 *
Type = X86::INTEL_COREI7;
825 *Subtype = X86::INTEL_COREI7_IVYBRIDGE;
834 *
Type = X86::INTEL_COREI7;
835 *Subtype = X86::INTEL_COREI7_HASWELL;
844 *
Type = X86::INTEL_COREI7;
845 *Subtype = X86::INTEL_COREI7_BROADWELL;
856 *
Type = X86::INTEL_COREI7;
857 *Subtype = X86::INTEL_COREI7_SKYLAKE;
863 *
Type = X86::INTEL_COREI7;
864 *Subtype = X86::INTEL_COREI7_ROCKETLAKE;
869 *
Type = X86::INTEL_COREI7;
870 if (testFeature(X86::FEATURE_AVX512BF16)) {
872 *Subtype = X86::INTEL_COREI7_COOPERLAKE;
873 }
else if (testFeature(X86::FEATURE_AVX512VNNI)) {
875 *Subtype = X86::INTEL_COREI7_CASCADELAKE;
877 CPU =
"skylake-avx512";
878 *Subtype = X86::INTEL_COREI7_SKYLAKE_AVX512;
885 *
Type = X86::INTEL_COREI7;
886 *Subtype = X86::INTEL_COREI7_CANNONLAKE;
892 CPU =
"icelake-client";
893 *
Type = X86::INTEL_COREI7;
894 *Subtype = X86::INTEL_COREI7_ICELAKE_CLIENT;
901 *
Type = X86::INTEL_COREI7;
902 *Subtype = X86::INTEL_COREI7_TIGERLAKE;
909 *
Type = X86::INTEL_COREI7;
910 *Subtype = X86::INTEL_COREI7_ALDERLAKE;
916 *
Type = X86::INTEL_COREI7;
917 *Subtype = X86::INTEL_COREI7_ALDERLAKE;
925 *
Type = X86::INTEL_COREI7;
926 *Subtype = X86::INTEL_COREI7_ALDERLAKE;
933 *
Type = X86::INTEL_COREI7;
934 *Subtype = X86::INTEL_COREI7_ALDERLAKE;
942 *
Type = X86::INTEL_COREI7;
943 *Subtype = X86::INTEL_COREI7_ARROWLAKE;
949 *
Type = X86::INTEL_COREI7;
950 *Subtype = X86::INTEL_COREI7_ARROWLAKE_S;
956 *
Type = X86::INTEL_COREI7;
957 *Subtype = X86::INTEL_COREI7_ARROWLAKE_S;
963 *
Type = X86::INTEL_COREI7;
964 *Subtype = X86::INTEL_COREI7_PANTHERLAKE;
969 CPU =
"graniterapids";
970 *
Type = X86::INTEL_COREI7;
971 *Subtype = X86::INTEL_COREI7_GRANITERAPIDS;
976 CPU =
"graniterapids-d";
977 *
Type = X86::INTEL_COREI7;
978 *Subtype = X86::INTEL_COREI7_GRANITERAPIDS_D;
984 CPU =
"icelake-server";
985 *
Type = X86::INTEL_COREI7;
986 *Subtype = X86::INTEL_COREI7_ICELAKE_SERVER;
991 CPU =
"emeraldrapids";
992 *
Type = X86::INTEL_COREI7;
993 *Subtype = X86::INTEL_COREI7_SAPPHIRERAPIDS;
998 CPU =
"sapphirerapids";
999 *
Type = X86::INTEL_COREI7;
1000 *Subtype = X86::INTEL_COREI7_SAPPHIRERAPIDS;
1009 *
Type = X86::INTEL_BONNELL;
1020 *
Type = X86::INTEL_SILVERMONT;
1026 *
Type = X86::INTEL_GOLDMONT;
1029 CPU =
"goldmont-plus";
1030 *
Type = X86::INTEL_GOLDMONT_PLUS;
1037 *
Type = X86::INTEL_TREMONT;
1042 CPU =
"sierraforest";
1043 *
Type = X86::INTEL_SIERRAFOREST;
1049 *
Type = X86::INTEL_GRANDRIDGE;
1054 CPU =
"clearwaterforest";
1055 *
Type = X86::INTEL_CLEARWATERFOREST;
1061 *
Type = X86::INTEL_KNL;
1065 *
Type = X86::INTEL_KNM;
1072 if (testFeature(X86::FEATURE_AVX512VP2INTERSECT)) {
1074 }
else if (testFeature(X86::FEATURE_AVX512VBMI2)) {
1075 CPU =
"icelake-client";
1076 }
else if (testFeature(X86::FEATURE_AVX512VBMI)) {
1078 }
else if (testFeature(X86::FEATURE_AVX512BF16)) {
1080 }
else if (testFeature(X86::FEATURE_AVX512VNNI)) {
1081 CPU =
"cascadelake";
1082 }
else if (testFeature(X86::FEATURE_AVX512VL)) {
1083 CPU =
"skylake-avx512";
1084 }
else if (testFeature(X86::FEATURE_CLFLUSHOPT)) {
1085 if (testFeature(X86::FEATURE_SHA))
1089 }
else if (testFeature(X86::FEATURE_ADX)) {
1091 }
else if (testFeature(X86::FEATURE_AVX2)) {
1093 }
else if (testFeature(X86::FEATURE_AVX)) {
1094 CPU =
"sandybridge";
1095 }
else if (testFeature(X86::FEATURE_SSE4_2)) {
1096 if (testFeature(X86::FEATURE_MOVBE))
1100 }
else if (testFeature(X86::FEATURE_SSE4_1)) {
1102 }
else if (testFeature(X86::FEATURE_SSSE3)) {
1103 if (testFeature(X86::FEATURE_MOVBE))
1107 }
else if (testFeature(X86::FEATURE_64BIT)) {
1109 }
else if (testFeature(X86::FEATURE_SSE3)) {
1111 }
else if (testFeature(X86::FEATURE_SSE2)) {
1113 }
else if (testFeature(X86::FEATURE_SSE)) {
1115 }
else if (testFeature(X86::FEATURE_MMX)) {
1124 if (testFeature(X86::FEATURE_64BIT)) {
1128 if (testFeature(X86::FEATURE_SSE3)) {
1139 CPU =
"diamondrapids";
1140 *
Type = X86::INTEL_COREI7;
1141 *Subtype = X86::INTEL_COREI7_DIAMONDRAPIDS;
1155static const char *getAMDProcessorTypeAndSubtype(
unsigned Family,
1157 const unsigned *Features,
1159 unsigned *Subtype) {
1160 const char *CPU = 0;
1186 if (testFeature(X86::FEATURE_SSE)) {
1193 if (testFeature(X86::FEATURE_SSE3)) {
1202 *
Type = X86::AMDFAM10H;
1205 *Subtype = X86::AMDFAM10H_BARCELONA;
1208 *Subtype = X86::AMDFAM10H_SHANGHAI;
1211 *Subtype = X86::AMDFAM10H_ISTANBUL;
1217 *
Type = X86::AMD_BTVER1;
1221 *
Type = X86::AMDFAM15H;
1222 if (Model >= 0x60 && Model <= 0x7f) {
1224 *Subtype = X86::AMDFAM15H_BDVER4;
1227 if (Model >= 0x30 && Model <= 0x3f) {
1229 *Subtype = X86::AMDFAM15H_BDVER3;
1232 if ((Model >= 0x10 && Model <= 0x1f) || Model == 0x02) {
1234 *Subtype = X86::AMDFAM15H_BDVER2;
1237 if (Model <= 0x0f) {
1238 *Subtype = X86::AMDFAM15H_BDVER1;
1244 *
Type = X86::AMD_BTVER2;
1248 *
Type = X86::AMDFAM17H;
1249 if ((Model >= 0x30 && Model <= 0x3f) || (Model == 0x47) ||
1250 (Model >= 0x60 && Model <= 0x67) || (Model >= 0x68 && Model <= 0x6f) ||
1251 (Model >= 0x70 && Model <= 0x7f) || (Model >= 0x84 && Model <= 0x87) ||
1252 (Model >= 0x90 && Model <= 0x97) || (Model >= 0x98 && Model <= 0x9f) ||
1253 (Model >= 0xa0 && Model <= 0xaf)) {
1264 *Subtype = X86::AMDFAM17H_ZNVER2;
1267 if ((Model >= 0x10 && Model <= 0x1f) || (Model >= 0x20 && Model <= 0x2f)) {
1271 *Subtype = X86::AMDFAM17H_ZNVER1;
1277 *
Type = X86::AMDFAM19H;
1278 if (Model <= 0x0f || (Model >= 0x20 && Model <= 0x2f) ||
1279 (Model >= 0x30 && Model <= 0x3f) || (Model >= 0x40 && Model <= 0x4f) ||
1280 (Model >= 0x50 && Model <= 0x5f)) {
1286 *Subtype = X86::AMDFAM19H_ZNVER3;
1289 if ((Model >= 0x10 && Model <= 0x1f) || (Model >= 0x60 && Model <= 0x6f) ||
1290 (Model >= 0x70 && Model <= 0x77) || (Model >= 0x78 && Model <= 0x7f) ||
1291 (Model >= 0xa0 && Model <= 0xaf)) {
1298 *Subtype = X86::AMDFAM19H_ZNVER4;
1304 *
Type = X86::AMDFAM1AH;
1305 if (Model <= 0x77) {
1316 *Subtype = X86::AMDFAM1AH_ZNVER5;
1330static void getAvailableFeatures(
unsigned ECX,
unsigned EDX,
unsigned MaxLeaf,
1331 unsigned *Features) {
1334 auto setFeature = [&](
unsigned F) {
1335 Features[
F / 32] |= 1U << (
F % 32);
1338 if ((EDX >> 15) & 1)
1339 setFeature(X86::FEATURE_CMOV);
1340 if ((EDX >> 23) & 1)
1341 setFeature(X86::FEATURE_MMX);
1342 if ((EDX >> 25) & 1)
1343 setFeature(X86::FEATURE_SSE);
1344 if ((EDX >> 26) & 1)
1345 setFeature(X86::FEATURE_SSE2);
1348 setFeature(X86::FEATURE_SSE3);
1350 setFeature(X86::FEATURE_PCLMUL);
1352 setFeature(X86::FEATURE_SSSE3);
1353 if ((ECX >> 12) & 1)
1354 setFeature(X86::FEATURE_FMA);
1355 if ((ECX >> 19) & 1)
1356 setFeature(X86::FEATURE_SSE4_1);
1357 if ((ECX >> 20) & 1) {
1358 setFeature(X86::FEATURE_SSE4_2);
1359 setFeature(X86::FEATURE_CRC32);
1361 if ((ECX >> 23) & 1)
1362 setFeature(X86::FEATURE_POPCNT);
1363 if ((ECX >> 25) & 1)
1364 setFeature(X86::FEATURE_AES);
1366 if ((ECX >> 22) & 1)
1367 setFeature(X86::FEATURE_MOVBE);
1372 const unsigned AVXBits = (1 << 27) | (1 << 28);
1373 bool HasAVX = ((
ECX & AVXBits) == AVXBits) && !getX86XCR0(&EAX, &EDX) &&
1374 ((
EAX & 0x6) == 0x6);
1375#if defined(__APPLE__)
1379 bool HasAVX512Save =
true;
1382 bool HasAVX512Save = HasAVX && ((
EAX & 0xe0) == 0xe0);
1386 setFeature(X86::FEATURE_AVX);
1389 MaxLeaf >= 0x7 && !getX86CpuIDAndInfoEx(0x7, 0x0, &EAX, &EBX, &ECX, &EDX);
1391 if (HasLeaf7 && ((EBX >> 3) & 1))
1392 setFeature(X86::FEATURE_BMI);
1393 if (HasLeaf7 && ((EBX >> 5) & 1) && HasAVX)
1394 setFeature(X86::FEATURE_AVX2);
1395 if (HasLeaf7 && ((EBX >> 8) & 1))
1396 setFeature(X86::FEATURE_BMI2);
1397 if (HasLeaf7 && ((EBX >> 16) & 1) && HasAVX512Save) {
1398 setFeature(X86::FEATURE_AVX512F);
1399 setFeature(X86::FEATURE_EVEX512);
1401 if (HasLeaf7 && ((EBX >> 17) & 1) && HasAVX512Save)
1402 setFeature(X86::FEATURE_AVX512DQ);
1403 if (HasLeaf7 && ((EBX >> 19) & 1))
1404 setFeature(X86::FEATURE_ADX);
1405 if (HasLeaf7 && ((EBX >> 21) & 1) && HasAVX512Save)
1406 setFeature(X86::FEATURE_AVX512IFMA);
1407 if (HasLeaf7 && ((EBX >> 23) & 1))
1408 setFeature(X86::FEATURE_CLFLUSHOPT);
1409 if (HasLeaf7 && ((EBX >> 28) & 1) && HasAVX512Save)
1410 setFeature(X86::FEATURE_AVX512CD);
1411 if (HasLeaf7 && ((EBX >> 29) & 1))
1412 setFeature(X86::FEATURE_SHA);
1413 if (HasLeaf7 && ((EBX >> 30) & 1) && HasAVX512Save)
1414 setFeature(X86::FEATURE_AVX512BW);
1415 if (HasLeaf7 && ((EBX >> 31) & 1) && HasAVX512Save)
1416 setFeature(X86::FEATURE_AVX512VL);
1418 if (HasLeaf7 && ((ECX >> 1) & 1) && HasAVX512Save)
1419 setFeature(X86::FEATURE_AVX512VBMI);
1420 if (HasLeaf7 && ((ECX >> 6) & 1) && HasAVX512Save)
1421 setFeature(X86::FEATURE_AVX512VBMI2);
1422 if (HasLeaf7 && ((ECX >> 8) & 1))
1423 setFeature(X86::FEATURE_GFNI);
1424 if (HasLeaf7 && ((ECX >> 10) & 1) && HasAVX)
1425 setFeature(X86::FEATURE_VPCLMULQDQ);
1426 if (HasLeaf7 && ((ECX >> 11) & 1) && HasAVX512Save)
1427 setFeature(X86::FEATURE_AVX512VNNI);
1428 if (HasLeaf7 && ((ECX >> 12) & 1) && HasAVX512Save)
1429 setFeature(X86::FEATURE_AVX512BITALG);
1430 if (HasLeaf7 && ((ECX >> 14) & 1) && HasAVX512Save)
1431 setFeature(X86::FEATURE_AVX512VPOPCNTDQ);
1433 if (HasLeaf7 && ((EDX >> 2) & 1) && HasAVX512Save)
1434 setFeature(X86::FEATURE_AVX5124VNNIW);
1435 if (HasLeaf7 && ((EDX >> 3) & 1) && HasAVX512Save)
1436 setFeature(X86::FEATURE_AVX5124FMAPS);
1437 if (HasLeaf7 && ((EDX >> 8) & 1) && HasAVX512Save)
1438 setFeature(X86::FEATURE_AVX512VP2INTERSECT);
1442 bool HasLeaf7Subleaf1 =
1443 HasLeaf7 &&
EAX >= 1 &&
1444 !getX86CpuIDAndInfoEx(0x7, 0x1, &EAX, &EBX, &ECX, &EDX);
1445 if (HasLeaf7Subleaf1 && ((EAX >> 5) & 1) && HasAVX512Save)
1446 setFeature(X86::FEATURE_AVX512BF16);
1448 unsigned MaxExtLevel;
1449 getX86CpuIDAndInfo(0x80000000, &MaxExtLevel, &EBX, &ECX, &EDX);
1451 bool HasExtLeaf1 = MaxExtLevel >= 0x80000001 &&
1452 !getX86CpuIDAndInfo(0x80000001, &EAX, &EBX, &ECX, &EDX);
1453 if (HasExtLeaf1 && ((ECX >> 6) & 1))
1454 setFeature(X86::FEATURE_SSE4_A);
1455 if (HasExtLeaf1 && ((ECX >> 11) & 1))
1456 setFeature(X86::FEATURE_XOP);
1457 if (HasExtLeaf1 && ((ECX >> 16) & 1))
1458 setFeature(X86::FEATURE_FMA4);
1460 if (HasExtLeaf1 && ((EDX >> 29) & 1))
1461 setFeature(X86::FEATURE_64BIT);
1465 unsigned MaxLeaf = 0;
1467 if (Vendor == VendorSignatures::UNKNOWN)
1471 getX86CpuIDAndInfo(0x1, &EAX, &EBX, &ECX, &EDX);
1473 unsigned Family = 0,
Model = 0;
1475 detectX86FamilyModel(EAX, &Family, &Model);
1476 getAvailableFeatures(ECX, EDX, MaxLeaf, Features);
1481 unsigned Subtype = 0;
1485 if (Vendor == VendorSignatures::GENUINE_INTEL) {
1486 CPU = getIntelProcessorTypeAndSubtype(Family, Model, Features, &
Type,
1488 }
else if (Vendor == VendorSignatures::AUTHENTIC_AMD) {
1489 CPU = getAMDProcessorTypeAndSubtype(Family, Model, Features, &
Type,
1499#elif defined(_M_ARM64) || defined(_M_ARM64EC)
1502 constexpr char CentralProcessorKeyName[] =
1503 "HARDWARE\\DESCRIPTION\\System\\CentralProcessor";
1506 constexpr size_t SubKeyNameMaxSize = ARRAYSIZE(CentralProcessorKeyName) + 10;
1510 char PrimaryPartKeyName[SubKeyNameMaxSize];
1511 DWORD PrimaryPartKeyNameSize = 0;
1512 HKEY CentralProcessorKey;
1513 if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, CentralProcessorKeyName, 0, KEY_READ,
1514 &CentralProcessorKey) == ERROR_SUCCESS) {
1515 for (
unsigned Index = 0;
Index < UINT32_MAX; ++
Index) {
1516 char SubKeyName[SubKeyNameMaxSize];
1517 DWORD SubKeySize = SubKeyNameMaxSize;
1519 if ((RegEnumKeyExA(CentralProcessorKey, Index, SubKeyName, &SubKeySize,
1520 nullptr,
nullptr,
nullptr,
1521 nullptr) == ERROR_SUCCESS) &&
1522 (RegOpenKeyExA(CentralProcessorKey, SubKeyName, 0, KEY_READ,
1523 &SubKey) == ERROR_SUCCESS)) {
1528 DWORD RegValueSize =
sizeof(RegValue);
1529 if ((RegQueryValueExA(SubKey,
"CP 4000",
nullptr, &ActualType,
1531 &RegValueSize) == ERROR_SUCCESS) &&
1532 (ActualType == REG_QWORD) && RegValueSize ==
sizeof(RegValue)) {
1537 if (PrimaryPartKeyNameSize < SubKeySize ||
1538 (PrimaryPartKeyNameSize == SubKeySize &&
1539 ::memcmp(SubKeyName, PrimaryPartKeyName, SubKeySize) > 0)) {
1540 PrimaryCpuInfo = RegValue;
1541 ::memcpy(PrimaryPartKeyName, SubKeyName, SubKeySize + 1);
1542 PrimaryPartKeyNameSize = SubKeySize;
1548 RegCloseKey(SubKey);
1554 RegCloseKey(CentralProcessorKey);
1557 if (Values.
empty()) {
1565 return detail::getHostCPUNameForARM(PrimaryCpuInfo, Values);
1568#elif defined(__APPLE__) && defined(__powerpc__)
1570 host_basic_info_data_t hostInfo;
1571 mach_msg_type_number_t infoCount;
1573 infoCount = HOST_BASIC_INFO_COUNT;
1574 mach_port_t hostPort = mach_host_self();
1575 host_info(hostPort, HOST_BASIC_INFO, (host_info_t)&hostInfo,
1577 mach_port_deallocate(mach_task_self(), hostPort);
1579 if (hostInfo.cpu_type != CPU_TYPE_POWERPC)
1582 switch (hostInfo.cpu_subtype) {
1612#elif defined(__linux__) && defined(__powerpc__)
1616 return detail::getHostCPUNameForPowerPC(
Content);
1618#elif defined(__linux__) && (defined(__arm__) || defined(__aarch64__))
1622 return detail::getHostCPUNameForARM(
Content);
1624#elif defined(__linux__) && defined(__s390x__)
1628 return detail::getHostCPUNameForS390x(
Content);
1630#elif defined(__MVS__)
1635 int *StartToCVTOffset =
reinterpret_cast<int *
>(0x10);
1638 int ReadValue = *StartToCVTOffset;
1640 ReadValue = (ReadValue & 0x7FFFFFFF);
1641 char *CVT =
reinterpret_cast<char *
>(ReadValue);
1646 Id = decodePackedBCD<uint16_t>(Id,
false);
1650 bool HaveVectorSupport = CVT[244] & 0x80;
1651 return getCPUNameFromS390Model(Id, HaveVectorSupport);
1653#elif defined(__APPLE__) && (defined(__arm__) || defined(__aarch64__))
1658#define CPUFAMILY_UNKNOWN 0
1659#define CPUFAMILY_ARM_9 0xe73283ae
1660#define CPUFAMILY_ARM_11 0x8ff620d8
1661#define CPUFAMILY_ARM_XSCALE 0x53b005f5
1662#define CPUFAMILY_ARM_12 0xbd1b0ae9
1663#define CPUFAMILY_ARM_13 0x0cc90e64
1664#define CPUFAMILY_ARM_14 0x96077ef1
1665#define CPUFAMILY_ARM_15 0xa8511bca
1666#define CPUFAMILY_ARM_SWIFT 0x1e2d6381
1667#define CPUFAMILY_ARM_CYCLONE 0x37a09642
1668#define CPUFAMILY_ARM_TYPHOON 0x2c91a47e
1669#define CPUFAMILY_ARM_TWISTER 0x92fb37c8
1670#define CPUFAMILY_ARM_HURRICANE 0x67ceee93
1671#define CPUFAMILY_ARM_MONSOON_MISTRAL 0xe81e7ef6
1672#define CPUFAMILY_ARM_VORTEX_TEMPEST 0x07d34b9f
1673#define CPUFAMILY_ARM_LIGHTNING_THUNDER 0x462504d2
1674#define CPUFAMILY_ARM_FIRESTORM_ICESTORM 0x1b588bb3
1675#define CPUFAMILY_ARM_BLIZZARD_AVALANCHE 0xda33d83d
1676#define CPUFAMILY_ARM_EVEREST_SAWTOOTH 0x8765edea
1677#define CPUFAMILY_ARM_IBIZA 0xfa33415e
1678#define CPUFAMILY_ARM_PALMA 0x72015832
1679#define CPUFAMILY_ARM_COLL 0x2876f5b5
1680#define CPUFAMILY_ARM_LOBOS 0x5f4dea93
1681#define CPUFAMILY_ARM_DONAN 0x6f5129ac
1682#define CPUFAMILY_ARM_BRAVA 0x17d5b93a
1683#define CPUFAMILY_ARM_TAHITI 0x75d4acb9
1684#define CPUFAMILY_ARM_TUPAI 0x204526d0
1688 size_t Length =
sizeof(Family);
1689 sysctlbyname(
"hw.cpufamily", &Family, &
Length, NULL, 0);
1701 case CPUFAMILY_UNKNOWN:
1703 case CPUFAMILY_ARM_9:
1705 case CPUFAMILY_ARM_11:
1706 return "arm1136jf-s";
1707 case CPUFAMILY_ARM_XSCALE:
1709 case CPUFAMILY_ARM_12:
1711 case CPUFAMILY_ARM_13:
1713 case CPUFAMILY_ARM_14:
1715 case CPUFAMILY_ARM_15:
1717 case CPUFAMILY_ARM_SWIFT:
1719 case CPUFAMILY_ARM_CYCLONE:
1721 case CPUFAMILY_ARM_TYPHOON:
1723 case CPUFAMILY_ARM_TWISTER:
1725 case CPUFAMILY_ARM_HURRICANE:
1727 case CPUFAMILY_ARM_MONSOON_MISTRAL:
1729 case CPUFAMILY_ARM_VORTEX_TEMPEST:
1731 case CPUFAMILY_ARM_LIGHTNING_THUNDER:
1733 case CPUFAMILY_ARM_FIRESTORM_ICESTORM:
1735 case CPUFAMILY_ARM_BLIZZARD_AVALANCHE:
1737 case CPUFAMILY_ARM_EVEREST_SAWTOOTH:
1738 case CPUFAMILY_ARM_IBIZA:
1739 case CPUFAMILY_ARM_PALMA:
1740 case CPUFAMILY_ARM_LOBOS:
1742 case CPUFAMILY_ARM_COLL:
1744 case CPUFAMILY_ARM_DONAN:
1745 case CPUFAMILY_ARM_BRAVA:
1746 case CPUFAMILY_ARM_TAHITI:
1747 case CPUFAMILY_ARM_TUPAI:
1756 switch (_system_configuration.implementation) {
1758 if (_system_configuration.version == PV_4_3)
1762 if (_system_configuration.version == PV_5)
1766 if (_system_configuration.version == PV_6_Compat)
1792#elif defined(__loongarch__)
1796 __asm__(
"cpucfg %[prid], $zero\n\t" : [prid]
"=r"(processor_id));
1798 switch (processor_id & 0xf000) {
1809#elif defined(__riscv)
1810#if defined(__linux__)
1812struct RISCVHwProbe {
1819#if defined(__linux__)
1821 RISCVHwProbe Query[]{{0, 0},
1824 int Ret = syscall(258, Query,
1825 std::size(Query), 0,
1842#if __riscv_xlen == 64
1843 return "generic-rv64";
1844#elif __riscv_xlen == 32
1845 return "generic-rv32";
1847#error "Unhandled value of __riscv_xlen"
1850#elif defined(__sparc__)
1851#if defined(__linux__)
1854 ProcCpuinfoContent.
split(Lines,
'\n');
1858 for (
unsigned I = 0, E =
Lines.size();
I != E; ++
I) {
1860 Cpu =
Lines[
I].substr(5).ltrim(
"\t :");
1892#if defined(__linux__)
1895 return detail::getHostCPUNameForSPARC(
Content);
1896#elif defined(__sun__) && defined(__svr4__)
1900 kstat_named_t *brand = NULL;
1904 ksp = kstat_lookup(kc,
const_cast<char *
>(
"cpu_info"), -1, NULL);
1905 if (ksp != NULL && kstat_read(kc, ksp, NULL) != -1 &&
1906 ksp->ks_type == KSTAT_TYPE_NAMED)
1908 (kstat_named_t *)kstat_data_lookup(ksp,
const_cast<char *
>(
"brand"));
1909 if (brand != NULL && brand->data_type == KSTAT_DATA_STRING)
1910 buf = KSTAT_NAMED_STR_PTR(brand);
1915 .
Case(
"TMS390S10",
"supersparc")
1916 .
Case(
"TMS390Z50",
"supersparc")
1919 .
Case(
"MB86904",
"supersparc")
1920 .
Case(
"MB86907",
"supersparc")
1921 .
Case(
"RT623",
"hypersparc")
1922 .
Case(
"RT625",
"hypersparc")
1923 .
Case(
"RT626",
"hypersparc")
1924 .
Case(
"UltraSPARC-I",
"ultrasparc")
1925 .
Case(
"UltraSPARC-II",
"ultrasparc")
1926 .
Case(
"UltraSPARC-IIe",
"ultrasparc")
1927 .
Case(
"UltraSPARC-IIi",
"ultrasparc")
1928 .
Case(
"SPARC64-III",
"ultrasparc")
1929 .
Case(
"SPARC64-IV",
"ultrasparc")
1930 .
Case(
"UltraSPARC-III",
"ultrasparc3")
1931 .
Case(
"UltraSPARC-III+",
"ultrasparc3")
1932 .
Case(
"UltraSPARC-IIIi",
"ultrasparc3")
1933 .
Case(
"UltraSPARC-IIIi+",
"ultrasparc3")
1934 .
Case(
"UltraSPARC-IV",
"ultrasparc3")
1935 .
Case(
"UltraSPARC-IV+",
"ultrasparc3")
1936 .
Case(
"SPARC64-V",
"ultrasparc3")
1937 .
Case(
"SPARC64-VI",
"ultrasparc3")
1938 .
Case(
"SPARC64-VII",
"ultrasparc3")
1939 .
Case(
"UltraSPARC-T1",
"niagara")
1940 .
Case(
"UltraSPARC-T2",
"niagara2")
1941 .
Case(
"UltraSPARC-T2",
"niagara2")
1942 .
Case(
"UltraSPARC-T2+",
"niagara2")
1943 .
Case(
"SPARC-T3",
"niagara3")
1944 .
Case(
"SPARC-T4",
"niagara4")
1945 .
Case(
"SPARC-T5",
"niagara4")
1947 .
Case(
"SPARC-M7",
"niagara4" )
1948 .
Case(
"SPARC-S7",
"niagara4" )
1949 .
Case(
"SPARC-M8",
"niagara4" )
1972#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || \
1973 defined(_M_X64)) && \
1974 !defined(_M_ARM64EC)
1980 if (getX86CpuIDAndInfo(0, &MaxLevel, &EBX, &ECX, &EDX) || MaxLevel < 1)
1983 getX86CpuIDAndInfo(1, &EAX, &EBX, &ECX, &EDX);
1985 Features[
"cx8"] = (
EDX >> 8) & 1;
1986 Features[
"cmov"] = (
EDX >> 15) & 1;
1987 Features[
"mmx"] = (
EDX >> 23) & 1;
1988 Features[
"fxsr"] = (
EDX >> 24) & 1;
1989 Features[
"sse"] = (
EDX >> 25) & 1;
1990 Features[
"sse2"] = (
EDX >> 26) & 1;
1992 Features[
"sse3"] = (
ECX >> 0) & 1;
1993 Features[
"pclmul"] = (
ECX >> 1) & 1;
1994 Features[
"ssse3"] = (
ECX >> 9) & 1;
1995 Features[
"cx16"] = (
ECX >> 13) & 1;
1996 Features[
"sse4.1"] = (
ECX >> 19) & 1;
1997 Features[
"sse4.2"] = (
ECX >> 20) & 1;
1998 Features[
"crc32"] = Features[
"sse4.2"];
1999 Features[
"movbe"] = (
ECX >> 22) & 1;
2000 Features[
"popcnt"] = (
ECX >> 23) & 1;
2001 Features[
"aes"] = (
ECX >> 25) & 1;
2002 Features[
"rdrnd"] = (
ECX >> 30) & 1;
2007 bool HasXSave = ((
ECX >> 27) & 1) && !getX86XCR0(&EAX, &EDX);
2008 bool HasAVXSave = HasXSave && ((
ECX >> 28) & 1) && ((
EAX & 0x6) == 0x6);
2009#if defined(__APPLE__)
2013 bool HasAVX512Save =
true;
2016 bool HasAVX512Save = HasAVXSave && ((
EAX & 0xe0) == 0xe0);
2019 const unsigned AMXBits = (1 << 17) | (1 << 18);
2020 bool HasAMXSave = HasXSave && ((
EAX & AMXBits) == AMXBits);
2022 Features[
"avx"] = HasAVXSave;
2023 Features[
"fma"] = ((
ECX >> 12) & 1) && HasAVXSave;
2025 Features[
"xsave"] = ((
ECX >> 26) & 1) && HasAVXSave;
2026 Features[
"f16c"] = ((
ECX >> 29) & 1) && HasAVXSave;
2028 unsigned MaxExtLevel;
2029 getX86CpuIDAndInfo(0x80000000, &MaxExtLevel, &EBX, &ECX, &EDX);
2031 bool HasExtLeaf1 = MaxExtLevel >= 0x80000001 &&
2032 !getX86CpuIDAndInfo(0x80000001, &EAX, &EBX, &ECX, &EDX);
2033 Features[
"sahf"] = HasExtLeaf1 && ((
ECX >> 0) & 1);
2034 Features[
"lzcnt"] = HasExtLeaf1 && ((
ECX >> 5) & 1);
2035 Features[
"sse4a"] = HasExtLeaf1 && ((
ECX >> 6) & 1);
2036 Features[
"prfchw"] = HasExtLeaf1 && ((
ECX >> 8) & 1);
2037 Features[
"xop"] = HasExtLeaf1 && ((
ECX >> 11) & 1) && HasAVXSave;
2038 Features[
"lwp"] = HasExtLeaf1 && ((
ECX >> 15) & 1);
2039 Features[
"fma4"] = HasExtLeaf1 && ((
ECX >> 16) & 1) && HasAVXSave;
2040 Features[
"tbm"] = HasExtLeaf1 && ((
ECX >> 21) & 1);
2041 Features[
"mwaitx"] = HasExtLeaf1 && ((
ECX >> 29) & 1);
2043 Features[
"64bit"] = HasExtLeaf1 && ((
EDX >> 29) & 1);
2047 bool HasExtLeaf8 = MaxExtLevel >= 0x80000008 &&
2048 !getX86CpuIDAndInfo(0x80000008, &EAX, &EBX, &ECX, &EDX);
2049 Features[
"clzero"] = HasExtLeaf8 && ((
EBX >> 0) & 1);
2050 Features[
"rdpru"] = HasExtLeaf8 && ((
EBX >> 4) & 1);
2051 Features[
"wbnoinvd"] = HasExtLeaf8 && ((
EBX >> 9) & 1);
2054 MaxLevel >= 7 && !getX86CpuIDAndInfoEx(0x7, 0x0, &EAX, &EBX, &ECX, &EDX);
2056 Features[
"fsgsbase"] = HasLeaf7 && ((
EBX >> 0) & 1);
2057 Features[
"sgx"] = HasLeaf7 && ((
EBX >> 2) & 1);
2058 Features[
"bmi"] = HasLeaf7 && ((
EBX >> 3) & 1);
2060 Features[
"avx2"] = HasLeaf7 && ((
EBX >> 5) & 1) && HasAVXSave;
2061 Features[
"bmi2"] = HasLeaf7 && ((
EBX >> 8) & 1);
2062 Features[
"invpcid"] = HasLeaf7 && ((
EBX >> 10) & 1);
2063 Features[
"rtm"] = HasLeaf7 && ((
EBX >> 11) & 1);
2065 Features[
"avx512f"] = HasLeaf7 && ((
EBX >> 16) & 1) && HasAVX512Save;
2066 if (Features[
"avx512f"])
2067 Features[
"evex512"] =
true;
2068 Features[
"avx512dq"] = HasLeaf7 && ((
EBX >> 17) & 1) && HasAVX512Save;
2069 Features[
"rdseed"] = HasLeaf7 && ((
EBX >> 18) & 1);
2070 Features[
"adx"] = HasLeaf7 && ((
EBX >> 19) & 1);
2071 Features[
"avx512ifma"] = HasLeaf7 && ((
EBX >> 21) & 1) && HasAVX512Save;
2072 Features[
"clflushopt"] = HasLeaf7 && ((
EBX >> 23) & 1);
2073 Features[
"clwb"] = HasLeaf7 && ((
EBX >> 24) & 1);
2074 Features[
"avx512cd"] = HasLeaf7 && ((
EBX >> 28) & 1) && HasAVX512Save;
2075 Features[
"sha"] = HasLeaf7 && ((
EBX >> 29) & 1);
2076 Features[
"avx512bw"] = HasLeaf7 && ((
EBX >> 30) & 1) && HasAVX512Save;
2077 Features[
"avx512vl"] = HasLeaf7 && ((
EBX >> 31) & 1) && HasAVX512Save;
2079 Features[
"avx512vbmi"] = HasLeaf7 && ((
ECX >> 1) & 1) && HasAVX512Save;
2080 Features[
"pku"] = HasLeaf7 && ((
ECX >> 4) & 1);
2081 Features[
"waitpkg"] = HasLeaf7 && ((
ECX >> 5) & 1);
2082 Features[
"avx512vbmi2"] = HasLeaf7 && ((
ECX >> 6) & 1) && HasAVX512Save;
2083 Features[
"shstk"] = HasLeaf7 && ((
ECX >> 7) & 1);
2084 Features[
"gfni"] = HasLeaf7 && ((
ECX >> 8) & 1);
2085 Features[
"vaes"] = HasLeaf7 && ((
ECX >> 9) & 1) && HasAVXSave;
2086 Features[
"vpclmulqdq"] = HasLeaf7 && ((
ECX >> 10) & 1) && HasAVXSave;
2087 Features[
"avx512vnni"] = HasLeaf7 && ((
ECX >> 11) & 1) && HasAVX512Save;
2088 Features[
"avx512bitalg"] = HasLeaf7 && ((
ECX >> 12) & 1) && HasAVX512Save;
2089 Features[
"avx512vpopcntdq"] = HasLeaf7 && ((
ECX >> 14) & 1) && HasAVX512Save;
2090 Features[
"rdpid"] = HasLeaf7 && ((
ECX >> 22) & 1);
2091 Features[
"kl"] = HasLeaf7 && ((
ECX >> 23) & 1);
2092 Features[
"cldemote"] = HasLeaf7 && ((
ECX >> 25) & 1);
2093 Features[
"movdiri"] = HasLeaf7 && ((
ECX >> 27) & 1);
2094 Features[
"movdir64b"] = HasLeaf7 && ((
ECX >> 28) & 1);
2095 Features[
"enqcmd"] = HasLeaf7 && ((
ECX >> 29) & 1);
2097 Features[
"uintr"] = HasLeaf7 && ((
EDX >> 5) & 1);
2098 Features[
"avx512vp2intersect"] =
2099 HasLeaf7 && ((
EDX >> 8) & 1) && HasAVX512Save;
2100 Features[
"serialize"] = HasLeaf7 && ((
EDX >> 14) & 1);
2101 Features[
"tsxldtrk"] = HasLeaf7 && ((
EDX >> 16) & 1);
2112 Features[
"pconfig"] = HasLeaf7 && ((
EDX >> 18) & 1);
2113 Features[
"amx-bf16"] = HasLeaf7 && ((
EDX >> 22) & 1) && HasAMXSave;
2114 Features[
"avx512fp16"] = HasLeaf7 && ((
EDX >> 23) & 1) && HasAVX512Save;
2115 Features[
"amx-tile"] = HasLeaf7 && ((
EDX >> 24) & 1) && HasAMXSave;
2116 Features[
"amx-int8"] = HasLeaf7 && ((
EDX >> 25) & 1) && HasAMXSave;
2119 bool HasLeaf7Subleaf1 =
2120 HasLeaf7 &&
EAX >= 1 &&
2121 !getX86CpuIDAndInfoEx(0x7, 0x1, &EAX, &EBX, &ECX, &EDX);
2122 Features[
"sha512"] = HasLeaf7Subleaf1 && ((
EAX >> 0) & 1);
2123 Features[
"sm3"] = HasLeaf7Subleaf1 && ((
EAX >> 1) & 1);
2124 Features[
"sm4"] = HasLeaf7Subleaf1 && ((
EAX >> 2) & 1);
2125 Features[
"raoint"] = HasLeaf7Subleaf1 && ((
EAX >> 3) & 1);
2126 Features[
"avxvnni"] = HasLeaf7Subleaf1 && ((
EAX >> 4) & 1) && HasAVXSave;
2127 Features[
"avx512bf16"] = HasLeaf7Subleaf1 && ((
EAX >> 5) & 1) && HasAVX512Save;
2128 Features[
"amx-fp16"] = HasLeaf7Subleaf1 && ((
EAX >> 21) & 1) && HasAMXSave;
2129 Features[
"cmpccxadd"] = HasLeaf7Subleaf1 && ((
EAX >> 7) & 1);
2130 Features[
"hreset"] = HasLeaf7Subleaf1 && ((
EAX >> 22) & 1);
2131 Features[
"avxifma"] = HasLeaf7Subleaf1 && ((
EAX >> 23) & 1) && HasAVXSave;
2132 Features[
"movrs"] = HasLeaf7Subleaf1 && ((
EAX >> 31) & 1);
2133 Features[
"avxvnniint8"] = HasLeaf7Subleaf1 && ((
EDX >> 4) & 1) && HasAVXSave;
2134 Features[
"avxneconvert"] = HasLeaf7Subleaf1 && ((
EDX >> 5) & 1) && HasAVXSave;
2135 Features[
"amx-complex"] = HasLeaf7Subleaf1 && ((
EDX >> 8) & 1) && HasAMXSave;
2136 Features[
"avxvnniint16"] = HasLeaf7Subleaf1 && ((
EDX >> 10) & 1) && HasAVXSave;
2137 Features[
"prefetchi"] = HasLeaf7Subleaf1 && ((
EDX >> 14) & 1);
2138 Features[
"usermsr"] = HasLeaf7Subleaf1 && ((
EDX >> 15) & 1);
2139 bool HasAVX10 = HasLeaf7Subleaf1 && ((
EDX >> 19) & 1);
2140 bool HasAPXF = HasLeaf7Subleaf1 && ((
EDX >> 21) & 1);
2141 Features[
"egpr"] = HasAPXF;
2142 Features[
"push2pop2"] = HasAPXF;
2143 Features[
"ppx"] = HasAPXF;
2144 Features[
"ndd"] = HasAPXF;
2145 Features[
"ccmp"] = HasAPXF;
2146 Features[
"nf"] = HasAPXF;
2147 Features[
"cf"] = HasAPXF;
2148 Features[
"zu"] = HasAPXF;
2150 bool HasLeafD = MaxLevel >= 0xd &&
2151 !getX86CpuIDAndInfoEx(0xd, 0x1, &EAX, &EBX, &ECX, &EDX);
2154 Features[
"xsaveopt"] = HasLeafD && ((
EAX >> 0) & 1) && HasAVXSave;
2155 Features[
"xsavec"] = HasLeafD && ((
EAX >> 1) & 1) && HasAVXSave;
2156 Features[
"xsaves"] = HasLeafD && ((
EAX >> 3) & 1) && HasAVXSave;
2158 bool HasLeaf14 = MaxLevel >= 0x14 &&
2159 !getX86CpuIDAndInfoEx(0x14, 0x0, &EAX, &EBX, &ECX, &EDX);
2161 Features[
"ptwrite"] = HasLeaf14 && ((
EBX >> 4) & 1);
2164 MaxLevel >= 0x19 && !getX86CpuIDAndInfo(0x19, &EAX, &EBX, &ECX, &EDX);
2165 Features[
"widekl"] = HasLeaf7 && HasLeaf19 && ((
EBX >> 2) & 1);
2167 bool HasLeaf1E = MaxLevel >= 0x1e &&
2168 !getX86CpuIDAndInfoEx(0x1e, 0x1, &EAX, &EBX, &ECX, &EDX);
2169 Features[
"amx-fp8"] = HasLeaf1E && ((
EAX >> 4) & 1) && HasAMXSave;
2170 Features[
"amx-transpose"] = HasLeaf1E && ((
EAX >> 5) & 1) && HasAMXSave;
2171 Features[
"amx-tf32"] = HasLeaf1E && ((
EAX >> 6) & 1) && HasAMXSave;
2172 Features[
"amx-avx512"] = HasLeaf1E && ((
EAX >> 7) & 1) && HasAMXSave;
2173 Features[
"amx-movrs"] = HasLeaf1E && ((
EAX >> 8) & 1) && HasAMXSave;
2176 MaxLevel >= 0x24 && !getX86CpuIDAndInfo(0x24, &EAX, &EBX, &ECX, &EDX);
2178 int AVX10Ver = HasLeaf24 && (
EBX & 0xff);
2179 int Has512Len = HasLeaf24 && ((
EBX >> 18) & 1);
2180 Features[
"avx10.1-256"] = HasAVX10 && AVX10Ver >= 1;
2181 Features[
"avx10.1-512"] = HasAVX10 && AVX10Ver >= 1 && Has512Len;
2182 Features[
"avx10.2-256"] = HasAVX10 && AVX10Ver >= 2;
2183 Features[
"avx10.2-512"] = HasAVX10 && AVX10Ver >= 2 && Has512Len;
2187#elif defined(__linux__) && (defined(__arm__) || defined(__aarch64__))
2195 P->getBuffer().split(Lines,
'\n');
2200 for (
unsigned I = 0, E =
Lines.size();
I != E; ++
I)
2202 Lines[
I].split(CPUFeatures,
' ');
2206#if defined(__aarch64__)
2209 enum { CAP_AES = 0x1, CAP_PMULL = 0x2, CAP_SHA1 = 0x4, CAP_SHA2 = 0x8 };
2213 for (
unsigned I = 0, E = CPUFeatures.
size();
I != E; ++
I) {
2215#if defined(__aarch64__)
2216 .
Case(
"asimd",
"neon")
2217 .
Case(
"fp",
"fp-armv8")
2218 .
Case(
"crc32",
"crc")
2219 .
Case(
"atomics",
"lse")
2220 .
Case(
"sha3",
"sha3")
2223 .
Case(
"sve2",
"sve2")
2224 .
Case(
"sveaes",
"sve-aes")
2225 .
Case(
"svesha3",
"sve-sha3")
2226 .
Case(
"svesm4",
"sve-sm4")
2228 .
Case(
"half",
"fp16")
2229 .
Case(
"neon",
"neon")
2230 .
Case(
"vfpv3",
"vfp3")
2231 .
Case(
"vfpv3d16",
"vfp3d16")
2232 .
Case(
"vfpv4",
"vfp4")
2233 .
Case(
"idiva",
"hwdiv-arm")
2234 .
Case(
"idivt",
"hwdiv")
2238#if defined(__aarch64__)
2241 if (CPUFeatures[
I] ==
"aes")
2243 else if (CPUFeatures[
I] ==
"pmull")
2244 crypto |= CAP_PMULL;
2245 else if (CPUFeatures[
I] ==
"sha1")
2247 else if (CPUFeatures[
I] ==
"sha2")
2251 if (LLVMFeatureStr !=
"")
2252 Features[LLVMFeatureStr] =
true;
2255#if defined(__aarch64__)
2259 uint32_t Aes = CAP_AES | CAP_PMULL;
2260 uint32_t Sha2 = CAP_SHA1 | CAP_SHA2;
2261 Features[
"aes"] = (crypto & Aes) == Aes;
2262 Features[
"sha2"] = (crypto & Sha2) == Sha2;
2267#elif defined(_WIN32) && (defined(__aarch64__) || defined(_M_ARM64) || \
2268 defined(__arm64ec__) || defined(_M_ARM64EC))
2274 IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE);
2276 IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE);
2280 IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE);
2281 Features[
"aes"] = TradCrypto;
2282 Features[
"sha2"] = TradCrypto;
2286#elif defined(__linux__) && defined(__loongarch__)
2287#include <sys/auxv.h>
2289 unsigned long hwcap = getauxval(AT_HWCAP);
2290 bool HasFPU = hwcap & (1UL << 3);
2291 uint32_t cpucfg2 = 0x2, cpucfg3 = 0x3;
2292 __asm__(
"cpucfg %[cpucfg2], %[cpucfg2]\n\t" : [cpucfg2]
"+r"(cpucfg2));
2293 __asm__(
"cpucfg %[cpucfg3], %[cpucfg3]\n\t" : [cpucfg3]
"+r"(cpucfg3));
2297 Features[
"f"] = HasFPU && (cpucfg2 & (1U << 1));
2298 Features[
"d"] = HasFPU && (cpucfg2 & (1U << 2));
2300 Features[
"lsx"] = hwcap & (1UL << 4);
2301 Features[
"lasx"] = hwcap & (1UL << 5);
2302 Features[
"lvz"] = hwcap & (1UL << 9);
2304 Features[
"frecipe"] = cpucfg2 & (1U << 25);
2305 Features[
"div32"] = cpucfg2 & (1U << 26);
2306 Features[
"lam-bh"] = cpucfg2 & (1U << 27);
2307 Features[
"lamcas"] = cpucfg2 & (1U << 28);
2308 Features[
"scq"] = cpucfg2 & (1U << 30);
2310 Features[
"ld-seq-sa"] = cpucfg3 & (1U << 23);
2316#elif defined(__linux__) && defined(__riscv)
2318 RISCVHwProbe Query[]{{3, 0},
2321 int Ret = syscall(258, Query,
2322 std::size(Query), 0,
2328 uint64_t BaseMask = Query[0].Value;
2331 Features[
"i"] =
true;
2332 Features[
"m"] =
true;
2333 Features[
"a"] =
true;
2337 Features[
"f"] = ExtMask & (1 << 0);
2338 Features[
"d"] = ExtMask & (1 << 0);
2339 Features[
"c"] = ExtMask & (1 << 1);
2340 Features[
"v"] = ExtMask & (1 << 2);
2341 Features[
"zba"] = ExtMask & (1 << 3);
2342 Features[
"zbb"] = ExtMask & (1 << 4);
2343 Features[
"zbs"] = ExtMask & (1 << 5);
2344 Features[
"zicboz"] = ExtMask & (1 << 6);
2345 Features[
"zbc"] = ExtMask & (1 << 7);
2346 Features[
"zbkb"] = ExtMask & (1 << 8);
2347 Features[
"zbkc"] = ExtMask & (1 << 9);
2348 Features[
"zbkx"] = ExtMask & (1 << 10);
2349 Features[
"zknd"] = ExtMask & (1 << 11);
2350 Features[
"zkne"] = ExtMask & (1 << 12);
2351 Features[
"zknh"] = ExtMask & (1 << 13);
2352 Features[
"zksed"] = ExtMask & (1 << 14);
2353 Features[
"zksh"] = ExtMask & (1 << 15);
2354 Features[
"zkt"] = ExtMask & (1 << 16);
2355 Features[
"zvbb"] = ExtMask & (1 << 17);
2356 Features[
"zvbc"] = ExtMask & (1 << 18);
2357 Features[
"zvkb"] = ExtMask & (1 << 19);
2358 Features[
"zvkg"] = ExtMask & (1 << 20);
2359 Features[
"zvkned"] = ExtMask & (1 << 21);
2360 Features[
"zvknha"] = ExtMask & (1 << 22);
2361 Features[
"zvknhb"] = ExtMask & (1 << 23);
2362 Features[
"zvksed"] = ExtMask & (1 << 24);
2363 Features[
"zvksh"] = ExtMask & (1 << 25);
2364 Features[
"zvkt"] = ExtMask & (1 << 26);
2365 Features[
"zfh"] = ExtMask & (1 << 27);
2366 Features[
"zfhmin"] = ExtMask & (1 << 28);
2367 Features[
"zihintntl"] = ExtMask & (1 << 29);
2368 Features[
"zvfh"] = ExtMask & (1 << 30);
2369 Features[
"zvfhmin"] = ExtMask & (1ULL << 31);
2370 Features[
"zfa"] = ExtMask & (1ULL << 32);
2371 Features[
"ztso"] = ExtMask & (1ULL << 33);
2372 Features[
"zacas"] = ExtMask & (1ULL << 34);
2373 Features[
"zicond"] = ExtMask & (1ULL << 35);
2374 Features[
"zihintpause"] =
2375 ExtMask & (1ULL << 36);
2376 Features[
"zve32x"] = ExtMask & (1ULL << 37);
2377 Features[
"zve32f"] = ExtMask & (1ULL << 38);
2378 Features[
"zve64x"] = ExtMask & (1ULL << 39);
2379 Features[
"zve64f"] = ExtMask & (1ULL << 40);
2380 Features[
"zve64d"] = ExtMask & (1ULL << 41);
2381 Features[
"zimop"] = ExtMask & (1ULL << 42);
2382 Features[
"zca"] = ExtMask & (1ULL << 43);
2383 Features[
"zcb"] = ExtMask & (1ULL << 44);
2384 Features[
"zcd"] = ExtMask & (1ULL << 45);
2385 Features[
"zcf"] = ExtMask & (1ULL << 46);
2386 Features[
"zcmop"] = ExtMask & (1ULL << 47);
2387 Features[
"zawrs"] = ExtMask & (1ULL << 48);
2393 if (Query[2].Key != -1 &&
2394 Query[2].
Value == 3)
2395 Features[
"unaligned-scalar-mem"] =
true;
2408 T.setArchName(
"arm");
2409#elif defined(__arm64e__)
2411 T.setArchName(
"arm64e");
2412#elif defined(__aarch64__)
2414 T.setArchName(
"arm64");
2415#elif defined(__x86_64h__)
2417 T.setArchName(
"x86_64h");
2418#elif defined(__x86_64__)
2420 T.setArchName(
"x86_64");
2421#elif defined(__i386__)
2423 T.setArchName(
"i386");
2424#elif defined(__powerpc__)
2426 T.setArchName(
"powerpc");
2428# error "Unimplemented host arch fixup"
2435 std::string TargetTripleString = updateTripleOSVersion(LLVM_HOST_TRIPLE);
2441 PT = withHostArch(PT);
2453#if LLVM_VERSION_PRINTER_SHOW_HOST_TARGET_INFO
2455 if (CPU ==
"generic")
2458 <<
" Host CPU: " << CPU <<
'\n';
This file defines the StringMap class.
This file implements methods to test, set and extract typed bits from packed unsigned integers.
Analysis containing CSE Info
#define LLVM_ATTRIBUTE_UNUSED
Given that RA is a live value
static std::unique_ptr< llvm::MemoryBuffer > LLVM_ATTRIBUTE_UNUSED getProcCpuinfoContent()
StringRef getHostCPUNameForARMFromComponents(StringRef Implementer, StringRef Hardware, StringRef Part, ArrayRef< StringRef > Parts, function_ref< unsigned()> GetVariant)
Merge contiguous icmps into a memcmp
This file defines the SmallVector class.
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
Represents either an error or a value T.
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFileAsStream(const Twine &Filename)
Read all of the specified file into a MemoryBuffer as a stream (i.e.
reference emplace_back(ArgTypes &&... Args)
void reserve(size_type N)
iterator erase(const_iterator CI)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
StringRef - Represent a constant reference to a string, i.e.
std::pair< StringRef, StringRef > split(char Separator) const
Split into two substrings around the first occurrence of a separator character.
bool getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
constexpr bool empty() const
empty - Check if the string is empty.
bool ends_with(StringRef Suffix) const
Check if this string ends with the given Suffix.
static constexpr size_t npos
A switch()-like statement whose cases are string literals.
StringSwitch & Case(StringLiteral S, T Value)
StringSwitch & StartsWith(StringLiteral S, T Value)
Triple - Helper class for working with autoconf configuration names.
LLVM_ABI llvm::Triple get32BitArchVariant() const
Form a triple with a 32-bit variant of the current architecture.
LLVM_ABI llvm::Triple get64BitArchVariant() const
Form a triple with a 64-bit variant of the current architecture.
static LLVM_ABI std::string normalize(StringRef Str, CanonicalForm Form=CanonicalForm::ANY)
Turn an arbitrary machine specification into the canonical triple form (or something sensible that th...
const std::string & str() const
LLVM_ABI bool isArch64Bit() const
Test whether the architecture is 64-bit.
LLVM_ABI bool isArch32Bit() const
Test whether the architecture is 32-bit.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
An efficient, type-erasing, non-owning reference to a callable.
This class implements an extremely fast bulk output stream that can only output to a stream.
@ CPU_SUBTYPE_POWERPC_970
@ CPU_SUBTYPE_POWERPC_604e
@ CPU_SUBTYPE_POWERPC_603e
@ CPU_SUBTYPE_POWERPC_7400
@ CPU_SUBTYPE_POWERPC_604
@ CPU_SUBTYPE_POWERPC_750
@ CPU_SUBTYPE_POWERPC_601
@ CPU_SUBTYPE_POWERPC_620
@ CPU_SUBTYPE_POWERPC_603ev
@ CPU_SUBTYPE_POWERPC_603
@ CPU_SUBTYPE_POWERPC_7450
@ CPU_SUBTYPE_POWERPC_602
LLVM_ABI StringRef getCPUNameFromCPUModel(const CPUModel &Model)
Helper functions to extract CPU details from CPUID on x86.
LLVM_ABI VendorSignatures getVendorSignature(unsigned *MaxLeaf=nullptr)
Returns the host CPU's vendor.
LLVM_ABI StringRef getHostCPUNameForSPARC(StringRef ProcCpuinfoContent)
LLVM_ABI StringRef getHostCPUNameForS390x(StringRef ProcCpuinfoContent)
LLVM_ABI StringRef getHostCPUNameForPowerPC(StringRef ProcCpuinfoContent)
Helper functions to extract HostCPUName from /proc/cpuinfo on linux.
LLVM_ABI StringRef getHostCPUNameForBPF()
LLVM_ABI StringRef getHostCPUNameForARM(StringRef ProcCpuinfoContent)
LLVM_ABI StringRef getHostCPUNameForRISCV(StringRef ProcCpuinfoContent)
LLVM_ABI StringMap< bool, MallocAllocator > getHostCPUFeatures()
getHostCPUFeatures - Get the LLVM names for the host CPU features.
LLVM_ABI StringRef getHostCPUName()
getHostCPUName - Get the LLVM name for the host CPU.
LLVM_ABI void printDefaultTargetAndDetectedCPU(raw_ostream &OS)
This is a function compatible with cl::AddExtraVersionPrinter, which adds info about the current targ...
LLVM_ABI std::string getDefaultTargetTriple()
getDefaultTargetTriple() - Return the default target triple the compiler has been configured to produ...
LLVM_ABI std::string getProcessTriple()
getProcessTriple() - Return an appropriate target triple for generating code to be loaded into the cu...
This is an optimization pass for GlobalISel generic memory operations.
auto unique(Range &&R, Predicate P)
void sort(IteratorTy Start, IteratorTy End)
LLVM_ABI raw_fd_ostream & errs()
This returns a reference to a raw_ostream for standard error.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
Describes an element of a Bitfield.