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-- From owner-freebsd-toolchain@FreeBSD.ORG Thu Apr 21 17:33:53 2011 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FA13106566C for ; Thu, 21 Apr 2011 17:33:53 +0000 (UTC) (envelope-from damjan.marion@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 9242C8FC1C for ; Thu, 21 Apr 2011 17:33:52 +0000 (UTC) Received: by eyg7 with SMTP id 7so720568eyg.13 for ; Thu, 21 Apr 2011 10:33:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:content-type:content-transfer-encoding :subject:date:message-id:cc:to:mime-version:x-mailer; bh=cul6BnAYNM1R38eyc3nyAipJds/5M6LHPNX/evwnfhw=; b=Ojgf2N+mmvkMva8eBR6L/JlMsicaC2It6OtCMOWFCmm+YbymIDVB6IOwi+jxBSZvsu 9huB2ZW0r2DkRtRyqUEldAlsWL8yJKdsXIGSs5Nsq6ic8lsWIIxRLOE/Cbz1F1mFWbMD B4BAHE+HeGQWdhx0v8R4ONX29MmL+SmIWXl40= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:content-type:content-transfer-encoding:subject:date:message-id :cc:to:mime-version:x-mailer; b=Jwged3blO2Fx3NS8WC7fKuLuZuB63d7Yp5RvkbZ/FgF2jb9GkoDYqY3oUU+2PBLET3 ksJl3uaKS0YyuzHUe50ic8BJT36qzk2A+TEVbgp9N7vLPWh0R0+eIWuOmzTjNKwt9ZY2 zfkFFGYclPEUuPNSLyX/IX4OJ/DWJMt1uSU9s= Received: by 10.213.28.144 with SMTP id m16mr779365ebc.119.1303405879661; Thu, 21 Apr 2011 10:11:19 -0700 (PDT) Received: from [192.168.123.4] (cpe-109-60-66-194.zg3.cable.xnet.hr [109.60.66.194]) by mx.google.com with ESMTPS id y7sm1480957eeh.0.2011.04.21.10.11.18 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 21 Apr 2011 10:11:18 -0700 (PDT) From: Damjan Marion Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Date: Thu, 21 Apr 2011 19:11:16 +0200 Message-Id: <77B4B008-D5A6-48A7-BAF9-E5084BF098DA@gmail.com> To: freebsd-toolchain@freebsd.org, freebsd-arm@freebsd.org Mime-Version: 1.0 (Apple Message framework v1084) X-Mailer: Apple Mail (2.1084) Cc: Ben Gray Subject: kernel cross-compiled with clang for ARM architecture 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: Thu, 21 Apr 2011 17:33:53 -0000 Hi, I managed to cross-compile latest -CURRENT + Ben's patches with clang = and compiled kernel boots on pandaboard. Pandaboard support is still work in progress, but clang compiled kernel = boots up to the same point like gcc version. I used latest clang/llvm from svn with following: CC=3D"/opt/llvm/bin/clang -mcpu=3Dcortex-a9 -ccc-host-triple = arm-unknown-freebsd -mfloat-abi=3Dsoft" WERROR=3D"" This works both on FreeBSD and Mac OS X host. Issues: - integrated assembler for ARM doesn't work properly ( I filled bugs = [1] and [2]) - gnu as works ok but newer version of binutils is needed which = supports ARMv7 instructions - i had to patch [3] clang to invoke cross linker properly (thanks to = guys form #freebsd-clang ) Regards, Damjan [1] http://llvm.org/bugs/show_bug.cgi?id=3D9760 [2] http://llvm.org/bugs/show_bug.cgi?id=3D9762 [3] http://llvm.org/bugs/show_bug.cgi?id=3D9777