X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=lib%2FSupport%2FHost.cpp;h=da918898e2fd827a2cba283cd8a5cf736db52430;hp=cb1c82b01456baabd9182fc912be87bd52c78f64;hb=8e03ab46f272b691787fcbd85c58717fb34b2aa1;hpb=21a5e4de9b97aebb853b029b4dcbad272f2f824e diff --git a/lib/Support/Host.cpp b/lib/Support/Host.cpp index cb1c82b0145..da918898e2f 100644 --- a/lib/Support/Host.cpp +++ b/lib/Support/Host.cpp @@ -769,6 +769,7 @@ bool sys::getHostCPUFeatures(StringMap &Features) { Features["movbe"] = (ECX >> 22) & 1; Features["popcnt"] = (ECX >> 23) & 1; Features["aes"] = (ECX >> 25) & 1; + Features["xsave"] = (ECX >> 26) & 1; Features["rdrnd"] = (ECX >> 30) & 1; // If CPUID indicates support for XSAVE, XRESTORE and AVX, and XGETBV @@ -819,6 +820,14 @@ bool sys::getHostCPUFeatures(StringMap &Features) { Features["avx512bw"] = HasLeaf7 && ((EBX >> 30) & 1) && HasAVX512Save; Features["avx512vl"] = HasLeaf7 && ((EBX >> 31) & 1) && HasAVX512Save; + + bool HasLeafD = MaxLevel >= 0xd && + !GetX86CpuIDAndInfoEx(0xd, 0x1, &EAX, &EBX, &ECX, &EDX); + + Features["xsaveopt"] = Features["xsave"] && HasLeafD && ((EAX >> 0) & 1); + Features["xsavec"] = Features["xsave"] && HasLeafD && ((EAX >> 1) & 1); + Features["xsaves"] = Features["xsave"] && HasLeafD && ((EAX >> 3) & 1); + return true; } #elif defined(__linux__) && (defined(__arm__) || defined(__aarch64__))