On 2011-10-30 17:55, David Marec wrote:
Le 30.10.2011 08:52, Roman Divacky a écrit :


On Sun, Oct 30, 2011 at 08:28:42AM +0100, Roman Divacky wrote:
This is a bug in clang, llvm supports "amdfam10" but the clang counterpart
wasnt updated. Thank you for the report!

fwiw, I fixed it in clang r143305, so in the next import this will work just
fine :)

Thank you for getting involved.

I pulled Roman's fixes into head in r226951.  This will be merged to
stable/9 later, but if you want to try it out in the meantime, please
use the attached diff.
Index: contrib/llvm/tools/clang/lib/Basic/Targets.cpp
===================================================================
--- contrib/llvm/tools/clang/lib/Basic/Targets.cpp	(revision 226948)
+++ contrib/llvm/tools/clang/lib/Basic/Targets.cpp	(working copy)
@@ -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 @@ class X86TargetInfo : public TargetInfo {
       .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 @@ class X86TargetInfo : public TargetInfo {
     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(llvm::Strin
   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(llvm::Strin
     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(llvm::String
     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(llvm::String
       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(const LangOpt
     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__");
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to