From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1FyT5T-0005HE-Ua for garchives@archives.gentoo.org; Thu, 06 Jul 2006 12:36:08 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.7/8.13.6) with SMTP id k66CXMH3018541; Thu, 6 Jul 2006 12:33:22 GMT Received: from MIUMMR0MT04.um.ced.h3g.it ([62.13.171.111]) by robin.gentoo.org (8.13.7/8.13.6) with ESMTP id k66CQgZC005133 for ; Thu, 6 Jul 2006 12:26:43 GMT Received: from c1358217.kevquinn.com (miumgu0vp03.um.ced.h3g.it [10.216.57.163]) by MIUMMR0MT04.um.ced.h3g.it (MOS 3.5.5-GR) with ESMTP id APD80210; Thu, 6 Jul 2006 14:26:07 +0200 (CEST) Date: Thu, 6 Jul 2006 14:35:31 +0200 From: "Kevin F. Quinn" To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] Replacing cpu-feature USE flags Message-ID: <20060706143531.1d970d80@c1358217.kevquinn.com> In-Reply-To: <200607061252.33028@enterprise.flameeyes.is-a-geek.org> References: <200607061252.33028@enterprise.flameeyes.is-a-geek.org> X-Mailer: Sylpheed-Claws 2.3.0 (GTK+ 2.8.12; i686-pc-linux-gnu) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@gentoo.org Reply-to: gentoo-dev@lists.gentoo.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary=Sig_XP6cjuRRYDxl6.DtGdOquOX; protocol="application/pgp-signature"; micalg=PGP-SHA1 X-Archives-Salt: 847acdc2-7fe4-469b-9e97-1389f3ca2b51 X-Archives-Hash: 19d9bc46df376eda6ac3a3f875708c2e --Sig_XP6cjuRRYDxl6.DtGdOquOX Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Thu, 6 Jul 2006 12:52:29 +0200 "Diego 'Flameeyes' Petten=F2" wrote: > So, I've been drafting this up in my blog[1], and it is a simple way > to replace the CPU feature useflags. >[...] To paraphrase the idea - use the compiler's knowledge of the target processor to select cpu-specific code. I like the idea a lot. To my mind, the sse/sse2/3dnow etc should be derived from the target arch, which is what you're doing with the compiler's macro definitions. This could easily be done by configure scripts; perhaps it would be a good idea to look into writing some autoconf macros. re. hardened - all we ever need, is to be able to force a package to fall back to it's portable C implementation when the asm code breaks PIC (which is independent of whether it uses mmx, sse etc) or generates code at runtime. I think most packages provide this, as it's useful to the developer to compare the C implementation with accelerated asm versions easily. re. Donnie's point about non-gcc compilers - handling these can be hidden in the has_cpuset() function. They can always be determined from the target arch (combination of ARCH and -march or equivalent CFLAGS). The suggested code already does the worst-case fall-back, as it responds 'no' if the compiler doesn't support -dM or doesn't define the relevant macro. echo | $(tc-getCC) ${CFLAGS} -dM -E - 2>/dev/null | grep -q ${def} ||=20 hasfeat=3D"no" The '2>/dev/null' is the critical element for that. --=20 Kevin F. Quinn --Sig_XP6cjuRRYDxl6.DtGdOquOX Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.4 (GNU/Linux) iD8DBQFErQOX9G2S8dekcG0RAobAAJ9YcmaFKIyJpdkvvlOLOm1Rmbum/wCgpAwi U7GEQ3D2WCFAau95AveOfxI= =mXFf -----END PGP SIGNATURE----- --Sig_XP6cjuRRYDxl6.DtGdOquOX-- -- gentoo-dev@gentoo.org mailing list