svn commit: r227025 - stable/9/contrib/llvm/tools/clang/lib/Basic

Dimitry Andric dim at FreeBSD.org
Wed Nov 2 18:55:27 UTC 2011


Author: dim
Date: Wed Nov  2 18:55:26 2011
New Revision: 227025
URL: http://svn.freebsd.org/changeset/base/227025

Log:
  MFC r226951:
  
  Pull in r143305 and r143312 from upstream clang trunk, so using "clang
  -march=native" on AMD K10 family processors no longer errors out with
  "unknown target CPU 'amdfam10'".  This also enables use of SSE4A.
  
  Reported by:	David Marec <david.marec at davenulle.org>
  Approved by:	re (kib)

Modified:
  stable/9/contrib/llvm/tools/clang/lib/Basic/Targets.cpp
Directory Properties:
  stable/9/contrib/llvm/tools/clang/   (props changed)

Modified: stable/9/contrib/llvm/tools/clang/lib/Basic/Targets.cpp
==============================================================================
--- stable/9/contrib/llvm/tools/clang/lib/Basic/Targets.cpp	Wed Nov  2 18:08:30 2011	(r227024)
+++ stable/9/contrib/llvm/tools/clang/lib/Basic/Targets.cpp	Wed Nov  2 18:55:26 2011	(r227025)
@@ -1282,6 +1282,7 @@ class X86TargetInfo : public TargetInfo 
     CK_K8SSE3,
     CK_Opteron,
     CK_OpteronSSE3,
+    CK_AMDFAM10,
 
     /// This specification is deprecated and will be removed in the future.
     /// Users should prefer \see CK_K8.
@@ -1381,6 +1382,7 @@ public:
       .Case("k8-sse3", CK_K8SSE3)
       .Case("opteron", CK_Opteron)
       .Case("opteron-sse3", CK_OpteronSSE3)
+      .Case("amdfam10", CK_AMDFAM10)
       .Case("x86-64", CK_x86_64)
       .Case("geode", CK_Geode)
       .Default(CK_Generic);
@@ -1441,6 +1443,7 @@ public:
     case CK_K8SSE3:
     case CK_Opteron:
     case CK_OpteronSSE3:
+    case CK_AMDFAM10:
     case CK_x86_64:
       return true;
     }
@@ -1459,12 +1462,10 @@ void X86TargetInfo::getDefaultFeatures(l
   Features["ssse3"] = false;
   Features["sse41"] = false;
   Features["sse42"] = false;
+  Features["sse4a"] = false;
   Features["aes"] = false;
   Features["avx"] = false;
 
-  // LLVM does not currently recognize this.
-  // Features["sse4a"] = false;
-
   // FIXME: This *really* should not be here.
 
   // X86_64 always has SSE2.
@@ -1561,6 +1562,11 @@ void X86TargetInfo::getDefaultFeatures(l
     setFeatureEnabled(Features, "sse3", true);
     setFeatureEnabled(Features, "3dnowa", true);
     break;
+  case CK_AMDFAM10:
+    setFeatureEnabled(Features, "sse3", true);
+    setFeatureEnabled(Features, "sse4a", true);
+    setFeatureEnabled(Features, "3dnowa", true);
+    break;
   case CK_C3_2:
     setFeatureEnabled(Features, "mmx", true);
     setFeatureEnabled(Features, "sse", true);
@@ -1604,6 +1610,8 @@ bool X86TargetInfo::setFeatureEnabled(ll
     else if (Name == "avx")
       Features["avx"] = Features["sse"] = Features["sse2"] = Features["sse3"] =
         Features["ssse3"] = Features["sse41"] = Features["sse42"] = true;
+    else if (Name == "sse4a")
+      Features["sse4a"] = true;
   } else {
     if (Name == "mmx")
       Features["mmx"] = Features["3dnow"] = Features["3dnowa"] = false;
@@ -1630,6 +1638,8 @@ bool X86TargetInfo::setFeatureEnabled(ll
       Features["aes"] = false;
     else if (Name == "avx")
       Features["avx"] = false;
+    else if (Name == "sse4a")
+      Features["sse4a"] = false;
   }
 
   return true;
@@ -1826,6 +1836,11 @@ void X86TargetInfo::getTargetDefines(con
     Builder.defineMacro("__k8__");
     Builder.defineMacro("__tune_k8__");
     break;
+  case CK_AMDFAM10:
+    Builder.defineMacro("__amdfam10");
+    Builder.defineMacro("__amdfam10__");
+    Builder.defineMacro("__tune_amdfam10__");
+    break;
   case CK_Geode:
     Builder.defineMacro("__geode");
     Builder.defineMacro("__geode__");


More information about the svn-src-stable-9 mailing list