[PATCH 1/6] make byte swapping macros less opaque to the optimizer

Daniel Stone daniel at fooishbar.org
Thu Apr 28 04:36:16 PDT 2011


On Wed, Apr 27, 2011 at 07:33:01PM -0400, Matt Turner wrote:
> Text size reduction of ~33k (1.8%):
>    text	   data	    bss	    dec	    hex	filename
> 1879739	  72212	  55328	2007279	 1ea0ef	hw/xfree86/Xorg.before
> 1845291	  72212	  55328	1972831	 1e1a5f	hw/xfree86/Xorg
> 
> On x86[-64], the number of bswap instructions goes up from 5 to 1006.
> 
> By defining lswapl as gcc's builtin bswap32, the number of bswap
> instructions used goes up to 1025, but the text and binary sizes stay
> the same. This tells me that either gcc is
> 	- dumb, and unable to optimize away __builtin_bswap32 when it should
> 	- smart, and able to optimize away the open-coded bswap
> 
> Either way, it doesn't matter much.
> 
> Signed-off-by: Matt Turner <mattst88 at gmail.com>

I like this so much.  For the series:
Reviewed-by: Daniel Stone <daniel at fooishbar.org>

Well done to Fabs() for turning 0.0 into -0.0 too.

Cheers,
Daniel


More information about the xorg-devel mailing list