From owner-freebsd-toolchain@FreeBSD.ORG Sun Apr 17 01:09:51 2011 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 76D4C106566B; Sun, 17 Apr 2011 01:09:51 +0000 (UTC) Date: Sun, 17 Apr 2011 01:09:51 +0000 From: Alexander Best To: Dimitry Andric Message-ID: <20110417010951.GA5368@freebsd.org> References: <20110414234106.GA22718@freebsd.org> <4DA874F3.9050101@FreeBSD.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="BOKacYhQ+x31HxR3" Content-Disposition: inline In-Reply-To: <4DA874F3.9050101@FreeBSD.org> Cc: freebsd-toolchain@freebsd.org, cfe-commits@cs.uiuc.edu Subject: Re: clang and 3dnow(a) X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Apr 2011 01:09:51 -0000 --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri Apr 15 11, Dimitry Andric wrote: > On 2011-04-15 01:41, Alexander Best wrote: > >per coincidence i discovered the following contrary behavior between gcc > >and > >clang: > > > >-mno-mmx implies -mno-3dnow under gcc. under clang -mno-mmx will *not* > >imply > >-mno-3dnow! > > > >is this a clang design feature or a bug? fixing it would be trivial (see > >attached patch). > > I don't think it was intentionally designed, nor that it is a bug. It > it just arbitrary what you disable when you specify '-mno-mmx'. > > However, it would probably be nice if clang emulated gcc's behaviour > here. here's an updated patch against clang tot. > > Adding cfe-commits@ in the loop, to see if the clang guys think this is > desirable. > > > diff --git a/contrib/llvm/tools/clang/lib/Basic/Targets.cpp > b/contrib/llvm/tools/clang/lib/Basic/Targets.cpp > index 55321f2..1af7c52 100644 > --- a/contrib/llvm/tools/clang/lib/Basic/Targets.cpp > +++ b/contrib/llvm/tools/clang/lib/Basic/Targets.cpp > @@ -1133,8 +1133,9 @@ bool > X86TargetInfo::setFeatureEnabled(llvm::StringMap &Features, > Features["avx"] = true; > } else { > if (Name == "mmx") > - Features["mmx"] = Features["sse"] = Features["sse2"] = > Features["sse3"] = > - Features["ssse3"] = Features["sse41"] = Features["sse42"] = false; > + Features["mmx"] = Features["3dnow"] = Features["3dnowa"] = > + Features["sse"] = Features["sse2"] = Features["sse3"] = > + Features["ssse3"] = Features["sse41"] = Features["sse42"] = false; > else if (Name == "sse") > Features["sse"] = Features["sse2"] = Features["sse3"] = > Features["ssse3"] = Features["sse41"] = Features["sse42"] = false; -- a13x --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="Targets.cpp.diff" Index: tools/clang/lib/Basic/Targets.cpp =================================================================== --- tools/clang/lib/Basic/Targets.cpp (revision 129652) +++ tools/clang/lib/Basic/Targets.cpp (working copy) @@ -1146,7 +1146,8 @@ Features["avx"] = true; } else { if (Name == "mmx") - Features["mmx"] = Features["sse"] = Features["sse2"] = Features["sse3"] = + Features["mmx"] = Features["3dnow"] = Features["3dnowa"] = + Features["sse"] = Features["sse2"] = Features["sse3"] = Features["ssse3"] = Features["sse41"] = Features["sse42"] = false; else if (Name == "sse") Features["sse"] = Features["sse2"] = Features["sse3"] = @@ -1159,12 +1160,10 @@ Features["sse42"] = false; else if (Name == "ssse3") Features["ssse3"] = Features["sse41"] = Features["sse42"] = false; - else if (Name == "sse4") + else if (Name == "sse4" || Name == "sse4.1") Features["sse41"] = Features["sse42"] = false; else if (Name == "sse4.2") Features["sse42"] = false; - else if (Name == "sse4.1") - Features["sse41"] = Features["sse42"] = false; else if (Name == "3dnow") Features["3dnow"] = Features["3dnowa"] = false; else if (Name == "3dnowa") --BOKacYhQ+x31HxR3--