]> granicus.if.org Git - clang/commitdiff
[X86] Make -mavx512f imply -mfma and -mf16c in the frontend like it does in the backend.
authorCraig Topper <craig.topper@intel.com>
Thu, 11 Jan 2018 01:37:59 +0000 (01:37 +0000)
committerCraig Topper <craig.topper@intel.com>
Thu, 11 Jan 2018 01:37:59 +0000 (01:37 +0000)
Similarly, make -mno-fma and -mno-f16c imply -mno-avx512f.

Withou this  "-mno-sse -mavx512f" ends up with avx512f being enabled in the frontend but disabled in the backend.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@322245 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets/X86.cpp

index 268b359011796abe9b78facb70b5e87917193a12..73b52a596a1512b6a2cd66c7b098cb037c9ad452 100644 (file)
@@ -430,7 +430,7 @@ void X86TargetInfo::setSSELevel(llvm::StringMap<bool> &Features,
   if (Enabled) {
     switch (Level) {
     case AVX512F:
-      Features["avx512f"] = true;
+      Features["avx512f"] = Features["fma"] = Features["f16c"] = true;
       LLVM_FALLTHROUGH;
     case AVX2:
       Features["avx2"] = true;
@@ -644,6 +644,8 @@ void X86TargetInfo::setFeatureEnabledImpl(llvm::StringMap<bool> &Features,
   } else if (Name == "fma") {
     if (Enabled)
       setSSELevel(Features, AVX, Enabled);
+    else
+      setSSELevel(Features, AVX512F, Enabled);
   } else if (Name == "fma4") {
     setXOPLevel(Features, FMA4, Enabled);
   } else if (Name == "xop") {
@@ -653,6 +655,8 @@ void X86TargetInfo::setFeatureEnabledImpl(llvm::StringMap<bool> &Features,
   } else if (Name == "f16c") {
     if (Enabled)
       setSSELevel(Features, AVX, Enabled);
+    else
+      setSSELevel(Features, AVX512F, Enabled);
   } else if (Name == "sha") {
     if (Enabled)
       setSSELevel(Features, SSE2, Enabled);