Date: Mon, 12 Mar 2012 21:07:22 +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: r232894 - head/contrib/llvm/tools/clang/lib/Basic Message-ID: <201203122107.q2CL7MYo086974@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Mon Mar 12 21:07:22 2012 New Revision: 232894 URL: http://svn.freebsd.org/changeset/base/232894 Log: Pull in r145194 from upstream clang trunk: Make our handling of MMX x SSE closer to what gcc does: * Enabling sse enables mmx. * Disabling (-mno-mmx) mmx, doesn't disable sse (we got this right already). * The order in not important. -msse -mno-mmx is the same as -mno-mmx -msse. Some configure scripts depend on this. PR: i386/165968 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 Mon Mar 12 20:59:18 2012 (r232893) +++ head/contrib/llvm/tools/clang/lib/Basic/Targets.cpp Mon Mar 12 21:07:22 2012 (r232894) @@ -1583,23 +1583,26 @@ bool X86TargetInfo::setFeatureEnabled(ll (Name != "sse4" && Name != "sse4.2" && Name != "sse4.1")) return false; + // FIXME: this should probably use a switch with fall through. + if (Enabled) { if (Name == "mmx") Features["mmx"] = true; else if (Name == "sse") - Features["sse"] = true; + Features["mmx"] = Features["sse"] = true; else if (Name == "sse2") - Features["sse"] = Features["sse2"] = true; + Features["mmx"] = Features["sse"] = Features["sse2"] = true; else if (Name == "sse3") - Features["sse"] = Features["sse2"] = Features["sse3"] = true; + Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] = + true; else if (Name == "ssse3") - Features["sse"] = Features["sse2"] = Features["sse3"] = + Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] = Features["ssse3"] = true; else if (Name == "sse4" || Name == "sse4.2") - Features["sse"] = Features["sse2"] = Features["sse3"] = + Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] = Features["ssse3"] = Features["sse41"] = Features["sse42"] = true; else if (Name == "sse4.1") - Features["sse"] = Features["sse2"] = Features["sse3"] = + Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] = Features["ssse3"] = Features["sse41"] = true; else if (Name == "3dnow") Features["mmx"] = Features["3dnow"] = true; @@ -1608,10 +1611,11 @@ bool X86TargetInfo::setFeatureEnabled(ll else if (Name == "aes") Features["aes"] = true; else if (Name == "avx") - Features["avx"] = Features["sse"] = Features["sse2"] = Features["sse3"] = - Features["ssse3"] = Features["sse41"] = Features["sse42"] = true; + Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] = + Features["ssse3"] = Features["sse41"] = Features["sse42"] = + Features["avx"] = true; else if (Name == "sse4a") - Features["sse4a"] = true; + Features["mmx"] = Features["sse4a"] = true; } else { if (Name == "mmx") Features["mmx"] = Features["3dnow"] = Features["3dnowa"] = false; @@ -3779,13 +3783,32 @@ TargetInfo *TargetInfo::CreateTargetInfo Target->getDefaultFeatures(Features); // Apply the user specified deltas. + // First the enables. for (std::vector<std::string>::const_iterator it = Opts.Features.begin(), ie = Opts.Features.end(); it != ie; ++it) { const char *Name = it->c_str(); + if (Name[0] != '+') + continue; + + // Apply the feature via the target. + if (!Target->setFeatureEnabled(Features, Name + 1, true)) { + Diags.Report(diag::err_target_invalid_feature) << Name; + return 0; + } + } + + // Then the disables. + for (std::vector<std::string>::const_iterator it = Opts.Features.begin(), + ie = Opts.Features.end(); it != ie; ++it) { + const char *Name = it->c_str(); + + if (Name[0] == '+') + continue; + // Apply the feature via the target. - if ((Name[0] != '-' && Name[0] != '+') || - !Target->setFeatureEnabled(Features, Name + 1, (Name[0] == '+'))) { + if (Name[0] != '-' || + !Target->setFeatureEnabled(Features, Name + 1, false)) { Diags.Report(diag::err_target_invalid_feature) << Name; return 0; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203122107.q2CL7MYo086974>