From c30448222a1315b7965ec856c07e62dc55ab08d6 Mon Sep 17 00:00:00 2001 From: "Michael J. Spencer" Date: Tue, 3 May 2011 04:35:54 +0000 Subject: [PATCH] Make the mno flags match GCC. Patch by Alexander Best! llvm-svn: 130750 --- clang/lib/Basic/Targets.cpp | 74 ++++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 29 deletions(-) diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 97109caf1237..f38e1a4dab42 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -1164,23 +1164,31 @@ void X86TargetInfo::getDefaultFeatures(const std::string &CPU, ; else if (CPU == "pentium-mmx" || CPU == "pentium2") setFeatureEnabled(Features, "mmx", true); - else if (CPU == "pentium3") + else if (CPU == "pentium3" || CPU == "pentium3m") { + setFeatureEnabled(Features, "mmx", true); setFeatureEnabled(Features, "sse", true); - else if (CPU == "pentium-m" || CPU == "pentium4" || CPU == "x86-64") + } else if (CPU == "pentium-m" || CPU == "pentium4" || CPU == "pentium4m" || + CPU == "x86-64") { + setFeatureEnabled(Features, "mmx", true); setFeatureEnabled(Features, "sse2", true); - else if (CPU == "yonah" || CPU == "prescott" || CPU == "nocona") + } else if (CPU == "yonah" || CPU == "prescott" || CPU == "nocona") { + setFeatureEnabled(Features, "mmx", true); setFeatureEnabled(Features, "sse3", true); - else if (CPU == "core2") + } else if (CPU == "core2") { + setFeatureEnabled(Features, "mmx", true); setFeatureEnabled(Features, "ssse3", true); - else if (CPU == "penryn") { - setFeatureEnabled(Features, "sse4", true); - Features["sse42"] = false; - } else if (CPU == "atom") + } else if (CPU == "penryn") { + setFeatureEnabled(Features, "mmx", true); + setFeatureEnabled(Features, "sse4.1", true); + } else if (CPU == "atom") { + setFeatureEnabled(Features, "mmx", true); setFeatureEnabled(Features, "sse3", true); - else if (CPU == "corei7") { + } else if (CPU == "corei7") { + setFeatureEnabled(Features, "mmx", true); setFeatureEnabled(Features, "sse4", true); setFeatureEnabled(Features, "aes", true); } else if (CPU == "sandybridge") { + setFeatureEnabled(Features, "mmx", true); setFeatureEnabled(Features, "sse4", true); setFeatureEnabled(Features, "aes", true); // setFeatureEnabled(Features, "avx", true); @@ -1191,16 +1199,20 @@ void X86TargetInfo::getDefaultFeatures(const std::string &CPU, setFeatureEnabled(Features, "mmx", true); setFeatureEnabled(Features, "3dnow", true); } else if (CPU == "athlon-4" || CPU == "athlon-xp" || CPU == "athlon-mp") { + setFeatureEnabled(Features, "mmx", true); setFeatureEnabled(Features, "sse", true); setFeatureEnabled(Features, "3dnowa", true); } else if (CPU == "k8" || CPU == "opteron" || CPU == "athlon64" || CPU == "athlon-fx") { + setFeatureEnabled(Features, "mmx", true); setFeatureEnabled(Features, "sse2", true); setFeatureEnabled(Features, "3dnowa", true); } else if (CPU == "k8-sse3") { + setFeatureEnabled(Features, "mmx", true); setFeatureEnabled(Features, "sse3", true); setFeatureEnabled(Features, "3dnowa", true); } else if (CPU == "c3-2") + setFeatureEnabled(Features, "mmx", true); setFeatureEnabled(Features, "sse", true); } @@ -1217,49 +1229,53 @@ bool X86TargetInfo::setFeatureEnabled(llvm::StringMap &Features, if (Name == "mmx") Features["mmx"] = true; else if (Name == "sse") - Features["mmx"] = Features["sse"] = true; + Features["sse"] = true; else if (Name == "sse2") - Features["mmx"] = Features["sse"] = Features["sse2"] = true; + Features["sse"] = Features["sse2"] = true; else if (Name == "sse3") - Features["mmx"] = Features["sse"] = Features["sse2"] = - Features["sse3"] = true; + Features["sse"] = Features["sse2"] = Features["sse3"] = true; else if (Name == "ssse3") - Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] = + Features["sse"] = Features["sse2"] = Features["sse3"] = Features["ssse3"] = true; else if (Name == "sse4" || Name == "sse4.2") - Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] = + Features["sse"] = Features["sse2"] = Features["sse3"] = Features["ssse3"] = Features["sse41"] = Features["sse42"] = true; else if (Name == "sse4.1") - Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] = + Features["sse"] = Features["sse2"] = Features["sse3"] = Features["ssse3"] = Features["sse41"] = true; else if (Name == "3dnow") - Features["3dnowa"] = true; + Features["mmx"] = Features["3dnow"] = true; else if (Name == "3dnowa") - Features["3dnow"] = Features["3dnowa"] = true; + Features["mmx"] = Features["3dnow"] = Features["3dnowa"] = true; + // FIXME: AES requires SSE2's xmm registers else if (Name == "aes") - Features["aes"] = true; + Features["sse"] = Features["sse2"] = Features["aes"] = true; else if (Name == "avx") - Features["avx"] = true; + // FIXME: AVX requires a or some SSE4.2 feature(s) + Features["sse"] = Features["sse2"] = Features["sse3"] = + Features["ssse3"] = Features["sse41"] = Features["sse42"] = + Features["avx"] = true; } else { if (Name == "mmx") - Features["mmx"] = Features["3dnow"] = Features["3dnowa"] = - Features["sse"] = Features["sse2"] = Features["sse3"] = - Features["ssse3"] = Features["sse41"] = Features["sse42"] = false; + Features["mmx"] = Features["3dnow"] = Features["3dnowa"] = false; else if (Name == "sse") Features["sse"] = Features["sse2"] = Features["sse3"] = - Features["ssse3"] = Features["sse41"] = Features["sse42"] = false; + Features["ssse3"] = Features["sse41"] = Features["sse42"] = + Features["aes"] = Features["avx"] = false; else if (Name == "sse2") Features["sse2"] = Features["sse3"] = Features["ssse3"] = - Features["sse41"] = Features["sse42"] = false; + Features["sse41"] = Features["sse42"] = Features["aes"] = + Features["avx"] = false; else if (Name == "sse3") Features["sse3"] = Features["ssse3"] = Features["sse41"] = - Features["sse42"] = false; + Features["sse42"] = Features["avx"] = false; else if (Name == "ssse3") - Features["ssse3"] = Features["sse41"] = Features["sse42"] = false; + Features["ssse3"] = Features["sse41"] = Features["sse42"] = + Features["avx"] = false; else if (Name == "sse4" || Name == "sse4.1") - Features["sse41"] = Features["sse42"] = false; + Features["sse41"] = Features["sse42"] = Features["avx"] = false; else if (Name == "sse4.2") - Features["sse42"] = false; + Features["sse42"] = Features["avx"] = false; else if (Name == "3dnow") Features["3dnow"] = Features["3dnowa"] = false; else if (Name == "3dnowa")