From owner-svn-src-all@FreeBSD.ORG Mon Mar 19 08:10:24 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A808106564A; Mon, 19 Mar 2012 08:10:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73CFF8FC16; Mon, 19 Mar 2012 08:10:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J8AO2e058320; Mon, 19 Mar 2012 08:10:24 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J8AON4058317; Mon, 19 Mar 2012 08:10:24 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201203190810.q2J8AON4058317@svn.freebsd.org> From: Dimitry Andric Date: Mon, 19 Mar 2012 08:10:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233166 - in stable/9: contrib/llvm/tools/clang/lib/Basic sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 08:10:24 -0000 Author: dim Date: Mon Mar 19 08:10:23 2012 New Revision: 233166 URL: http://svn.freebsd.org/changeset/base/233166 Log: MFC r232894: 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 r232933: Update comments and CFLAGS in sys/conf/kern.mk, introduced in r221879, to match reality: clang does _not_ disable SSE automatically when -mno-mmx is used, you have to specify -mno-sse explicitly. Note this was the case even before r232894, which only makes a change in the 'positive' flag case; e.g. when you specify -msse, MMX gets enabled too. Modified: stable/9/contrib/llvm/tools/clang/lib/Basic/Targets.cpp stable/9/sys/conf/kern.mk Directory Properties: stable/9/contrib/llvm/ (props changed) stable/9/contrib/llvm/tools/clang/ (props changed) stable/9/sys/ (props changed) stable/9/sys/conf/ (props changed) Modified: stable/9/contrib/llvm/tools/clang/lib/Basic/Targets.cpp ============================================================================== --- stable/9/contrib/llvm/tools/clang/lib/Basic/Targets.cpp Mon Mar 19 07:34:09 2012 (r233165) +++ stable/9/contrib/llvm/tools/clang/lib/Basic/Targets.cpp Mon Mar 19 08:10:23 2012 (r233166) @@ -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::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::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; } Modified: stable/9/sys/conf/kern.mk ============================================================================== --- stable/9/sys/conf/kern.mk Mon Mar 19 07:34:09 2012 (r233165) +++ stable/9/sys/conf/kern.mk Mon Mar 19 08:10:23 2012 (r233166) @@ -46,16 +46,16 @@ CWARNEXTRA?= -Wno-error-tautological-com # Setting -mno-sse implies -mno-sse2, -mno-sse3 and -mno-ssse3 # # clang: -# Setting -mno-mmx implies -mno-3dnow, -mno-3dnowa, -mno-sse, -mno-sse2, -# -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42 +# Setting -mno-mmx implies -mno-3dnow and -mno-3dnowa +# Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42 # .if ${MACHINE_CPUARCH} == "i386" .if ${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang" -CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-sse +CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2 .else CFLAGS+= -mno-aes -mno-avx .endif -CFLAGS+= -mno-mmx -msoft-float +CFLAGS+= -mno-mmx -mno-sse -msoft-float INLINE_LIMIT?= 8000 .endif @@ -93,17 +93,15 @@ INLINE_LIMIT?= 15000 # Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3 and -mfpmath=387 # # clang: -# Setting -mno-mmx implies -mno-3dnow, -mno-3dnowa, -mno-sse, -mno-sse2, -# -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42 +# Setting -mno-mmx implies -mno-3dnow and -mno-3dnowa +# Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42 # (-mfpmath= is not supported) # .if ${MACHINE_CPUARCH} == "amd64" -.if ${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang" -CFLAGS+= -mno-sse -.else +.if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang" CFLAGS+= -mno-aes -mno-avx .endif -CFLAGS+= -mcmodel=kernel -mno-red-zone -mno-mmx -msoft-float \ +CFLAGS+= -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float \ -fno-asynchronous-unwind-tables INLINE_LIMIT?= 8000 .endif