Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Oct 2011 22:20:17 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r226951 - head/contrib/llvm/tools/clang/lib/Basic
Message-ID:  <201110302220.p9UMKHD9087326@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Sun Oct 30 22:20:17 2011
New Revision: 226951
URL: http://svn.freebsd.org/changeset/base/226951

Log:
  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@davenulle.org>
  MFC after:	3 days

Modified:
  head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp

Modified: head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp
==============================================================================
--- head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp	Sun Oct 30 21:45:36 2011	(r226950)
+++ head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp	Sun Oct 30 22:20:17 2011	(r226951)
@@ -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__");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201110302220.p9UMKHD9087326>