diff options
author | Craig Topper <craig.topper@gmail.com> | 2015-03-30 06:31:14 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2015-03-30 06:31:14 +0000 |
commit | 5d28b900ac57100bea04b63056f682a09e11bb29 (patch) | |
tree | 91b6aa6cfbd47df1084c131b5a9c0e9d70ab6dd7 /llvm/lib/Support/Host.cpp | |
parent | 3611d9bc0196677e11212e62433c1a07b2905496 (diff) | |
download | llvm-5d28b900ac57100bea04b63056f682a09e11bb29.zip llvm-5d28b900ac57100bea04b63056f682a09e11bb29.tar.gz llvm-5d28b900ac57100bea04b63056f682a09e11bb29.tar.bz2 |
[X86] In getHostCPUFeatures, disable xop, f16c, fma, and fma4 if OS does not support saving ymm state.
llvm-svn: 233518
Diffstat (limited to 'llvm/lib/Support/Host.cpp')
-rw-r--r-- | llvm/lib/Support/Host.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Support/Host.cpp b/llvm/lib/Support/Host.cpp index 1038236..119cb09 100644 --- a/llvm/lib/Support/Host.cpp +++ b/llvm/lib/Support/Host.cpp @@ -709,12 +709,10 @@ bool sys::getHostCPUFeatures(StringMap<bool> &Features) { Features["sse4.2"] = (ECX >> 20) & 1; Features["pclmul"] = (ECX >> 1) & 1; - Features["fma"] = (ECX >> 12) & 1; Features["cx16"] = (ECX >> 13) & 1; Features["movbe"] = (ECX >> 22) & 1; Features["popcnt"] = (ECX >> 23) & 1; Features["aes"] = (ECX >> 25) & 1; - Features["f16c"] = (ECX >> 29) & 1; Features["rdrnd"] = (ECX >> 30) & 1; // If CPUID indicates support for XSAVE, XRESTORE and AVX, and XGETBV @@ -723,6 +721,8 @@ bool sys::getHostCPUFeatures(StringMap<bool> &Features) { bool HasAVX = ((ECX >> 27) & 1) && ((ECX >> 28) & 1) && !GetX86XCR0(&EAX, &EDX) && ((EAX & 0x6) == 0x6); Features["avx"] = HasAVX; + Features["fma"] = HasAVX && (ECX >> 12) & 1; + Features["f16c"] = HasAVX && (ECX >> 29) & 1; // AVX512 requires additional context to be saved by the OS. bool HasAVX512Save = HasAVX && ((EAX & 0xe0) == 0xe0); @@ -735,8 +735,8 @@ bool sys::getHostCPUFeatures(StringMap<bool> &Features) { Features["lzcnt"] = HasExtLeaf1 && ((ECX >> 5) & 1); Features["sse4a"] = HasExtLeaf1 && ((ECX >> 6) & 1); Features["prfchw"] = HasExtLeaf1 && ((ECX >> 8) & 1); - Features["xop"] = HasExtLeaf1 && ((ECX >> 11) & 1); - Features["fma4"] = HasExtLeaf1 && ((ECX >> 16) & 1); + Features["xop"] = HasAVX && HasExtLeaf1 && ((ECX >> 11) & 1); + Features["fma4"] = HasAVX && HasExtLeaf1 && ((ECX >> 16) & 1); Features["tbm"] = HasExtLeaf1 && ((ECX >> 21) & 1); bool HasLeaf7 = MaxLevel >= 7 && |