From owner-svn-src-all@FreeBSD.ORG Tue Mar 20 14:20:27 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 07EFB106567A; Tue, 20 Mar 2012 14:20:27 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay005.isp.belgacom.be (mailrelay005.isp.belgacom.be [195.238.6.171]) by mx1.freebsd.org (Postfix) with ESMTP id EBBAE8FC1F; Tue, 20 Mar 2012 14:20:25 +0000 (UTC) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EAMeQaE9bsV1u/2dsb2JhbABChT+xEoEIggkBAQUjMyMQCw4GBCoCAjkeBoghB6Ugkh6PaIEWBKYGgmg Received: from 110.93-177-91.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([91.177.93.110]) by relay.skynet.be with ESMTP; 20 Mar 2012 15:19:16 +0100 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.14.5/8.14.5) with ESMTP id q2KEJFsh003383; Tue, 20 Mar 2012 15:19:15 +0100 (CET) (envelope-from tijl@freebsd.org) From: Tijl Coosemans To: John Baldwin Date: Tue, 20 Mar 2012 15:19:07 +0100 User-Agent: KMail/1.13.7 (FreeBSD/10.0-CURRENT; KDE/4.7.3; i386; ; ) References: <201203091148.q29BmuIp005151@svn.freebsd.org> <201203200834.10539.jhb@freebsd.org> In-Reply-To: <201203200834.10539.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1437011.eaDneX7VNl"; protocol="application/pgp-signature"; micalg=pgp-sha256 Content-Transfer-Encoding: 7bit Message-Id: <201203201519.12926.tijl@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r232721 - head/sys/x86/include 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: Tue, 20 Mar 2012 14:20:27 -0000 --nextPart1437011.eaDneX7VNl Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Tuesday 20 March 2012 13:34:10 John Baldwin wrote: > On Friday, March 09, 2012 6:48:56 am Tijl Coosemans wrote: >> Author: tijl >> Date: Fri Mar 9 11:48:56 2012 >> New Revision: 232721 >> URL: http://svn.freebsd.org/changeset/base/232721 >>=20 >> Log: >> Clean up x86 endian.h: >> - Remove extern "C". There are no functions with external linkage here= =2E [1] >> - Rename bswapNN_const(x) to bswapNN_gen(x) to indicate that these mac= ros >> are generic implementations that can take non-constant arguments. [1] >> - Split up __GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P and deal wi= th >> each separately. >> - Replace _LP64 with __amd64__ because asm instructions are machine >> dependent, not ABI dependent. >> =20 >> Submitted by: bde [1] >> Reviewed by: bde >=20 > BTW, I think I found an old "bug" in this file. The _gen() variants > should only use the _gen() variants of smaller types rather than using > the version that re-checks __build_constant_p() I think. That is: >=20 > Index: x86/include/endian.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- endian.h (revision 233184) > +++ endian.h (working copy) > @@ -65,9 +65,9 @@ > =20 > #define __bswap16_gen(x) (__uint16_t)((x) << 8 | (x) >> 8) > #define __bswap32_gen(x) \ > - (((__uint32_t)__bswap16(x) << 16) | __bswap16((x) >> 16)) > + (((__uint32_t)__bswap16_gen(x) << 16) | __bswap16_gen((x) >> 16)) > #define __bswap64_gen(x) \ > - (((__uint64_t)__bswap32(x) << 32) | __bswap32((x) >> 32)) > + (((__uint64_t)__bswap32_gen(x) << 32) | __bswap32_gen((x) >> 32)) > =20 > #ifdef __GNUCLIKE_BUILTIN_CONSTANT_P > #define __bswap16(x) \ >=20 > I ran into this while porting the __builtin_constant_p() functionality > over to ia64. No, on i386 bswap64 with a variable argument currently expands to two bswap instructions. With your change it would be many shifts and logical operations. The _gen variants are more like fallback implementations. If bswapNN cannot be implemented directly it is split up. If those smaller problems can be implemented directly, good, if not split it up again and so on. --nextPart1437011.eaDneX7VNl Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iF4EABEIAAYFAk9okeAACgkQfoCS2CCgtivVyQD+N6E+TflHXqi3/3rNpRGKJwSI 5l7S2VYCqb/EQAzZeA0A/0gJ93lZxKzEH77Uwi1Sqi1YWJIIeUtlpUIdpJM/OBaU =ZDYk -----END PGP SIGNATURE----- --nextPart1437011.eaDneX7VNl--