[openib-general] [PATCH] libmthca: optimize calls to htonl with constant parameter

Jason Gunthorpe jgunthorpe at obsidianresearch.com
Thu Feb 22 23:00:55 PST 2007


On Thu, Feb 22, 2007 at 10:09:28PM -0800, Roland Dreier wrote:

> (BTW, one thing I did notice while looking at the i386 assembly is
> that one micro-optimization that might make sense to use something
> like __attribute__((regparm(3))) for internal function calls within
> libibverbs and libmthca on i386, since otherwise we waste instructions
> pushing stuff on the stack for no reason other than compliance with
> the crufty old i386 ABI.  Something like a FASTCALL macro in
> <infiniband/arch.h> perhaps... if anyone really cares about 32-bit
> i386 performance any more)

Newer gccs have the -fwhole-program --combine options that address
this and more. One of the things that happens is that all internal
functions are made 'static' and all compilation units are optimized in
one go.

gcc will optimize calling convention and alot of other things for
static functions. That should provide an across the board
micro-improvement even on x86-64.

Jason




More information about the general mailing list