summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorAmjad Aboud <amjad.aboud@intel.com>2015-10-12 11:47:46 +0000
committerAmjad Aboud <amjad.aboud@intel.com>2015-10-12 11:47:46 +0000
commit1db6d7af46276ff65dc267e7bf2d424993b95d6b (patch)
tree96e84e53a625a320e1f81aca30658f1e4b8ea206 /llvm/lib/Support
parent9b278a16958c7d1526eea23cdcd8f603b308ae0b (diff)
downloadbcm5719-llvm-1db6d7af46276ff65dc267e7bf2d424993b95d6b.tar.gz
bcm5719-llvm-1db6d7af46276ff65dc267e7bf2d424993b95d6b.zip
[X86] Add XSAVE intrinsic family
Add intrinsics for the XSAVE instructions (XSAVE/XSAVE64/XRSTOR/XRSTOR64) XSAVEOPT instructions (XSAVEOPT/XSAVEOPT64) XSAVEC instructions (XSAVEC/XSAVEC64) XSAVES instructions (XSAVES/XSAVES64/XRSTORS/XRSTORS64) Differential Revision: http://reviews.llvm.org/D13012 llvm-svn: 250029
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/Host.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Support/Host.cpp b/llvm/lib/Support/Host.cpp
index cb1c82b0145..da918898e2f 100644
--- a/llvm/lib/Support/Host.cpp
+++ b/llvm/lib/Support/Host.cpp
@@ -769,6 +769,7 @@ bool sys::getHostCPUFeatures(StringMap<bool> &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<bool> &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__))
OpenPOWER on IntegriCloud