Date: Wed, 24 Sep 2003 12:03:50 +0200 From: Bernd Walter <ticso@cicely12.cicely.de> To: Peter Wemm <peter@wemm.org> Cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/i386/include endian.h Message-ID: <20030924100349.GR21665@cicely12.cicely.de> In-Reply-To: <20030923164531.6AC882A8DA@canning.wemm.org> References: <Pine.NEB.3.96L.1030923103120.82831A-100000@fledge.watson.org> <20030923164531.6AC882A8DA@canning.wemm.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Sep 23, 2003 at 09:45:31AM -0700, Peter Wemm wrote: > Robert Watson wrote: > > > > On Mon, 22 Sep 2003, Peter Wemm wrote: > > > > > Microoptimization to allow the compiler to evaluate ntohl() etc on > > > known constants at compile time rather than at run time. We have a numbe > r > > > of nasty hacks around the place to cache ntohl() of constants (eg: nfs). > > > This change allows the compiler to compile-time evaluate ntohl(1) as > > > 0x01000000 rather than having to emit assembler code to do it. This > > > has other smaller flow-on effects because the compiler can see that > > > ntohl(constant) itself has a constant value now and can propagate the > > > compile time evaluation. > > > > So should we now be doing a sweep through the tree to remove instances of > > this? I.e.: > > > > /* > > * To avoid byte-swapping the same value over and over again. > > */ > > igmp_all_hosts_group = htonl(INADDR_ALLHOSTS_GROUP); > > igmp_all_rtrs_group = htonl(INADDR_ALLRTRS_GROUP); > > > > Etc? > > It is probably premature to do that just yet (only 2 of 5 or so platforms > handled), but that was the kind of "optimization" that prompted this. > NFS is also riddled with this. 2 platforms is already much - considered that ppc and sparc64 are big endian and therefor not influenced. But I think the above assignment can be optimized away by the compiler in many cases now. Nevertheless - having alpha done first would be fine ;-) -- B.Walter BWCT http://www.bwct.de ticso@bwct.de info@bwct.de
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030924100349.GR21665>