[PATCH] powerpc: provide __bswapdi2

David Woodhouse dwmw2 at infradead.org
Tue May 14 16:59:05 EST 2013


On Tue, 2013-05-14 at 11:25 +1000, Michael Neuling wrote:
> 
> > So, if we are just stealing the output of gcc, why not just use the C
> > version (at least for 32 bit)?
> 
> Woodhouse: can we just do this?

Sure, if you don't mind GCC optimising the contents of your C function
by turning it into a call to libgcc's __bswapdi2() :)

OK, you might be able to do some archaeology and determine that the only
compiler that emits calls to __bswapdi2() is GCC 4.4, and furthermore
that the same compiler *doesn't* have the wit to notice that the
contents of the function are a 64-bit byteswap, so it's never going to
happen. But I don't like that approach. I'd feel I have to sacrifice a
goat *anyway*, and I don't have a spare goat.

Although now I come to explicitly explain why I did it that way... it
occurs to me that the libgcc version is just written in C, and the
compiler evidently trusts itself not to optimise that into a recursive
call. Is there a compiler switch which guarantees that, which we could
use without other unwanted side-effects?
 
-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse at intel.com                              Intel Corporation



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5745 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20130514/d5c2bc5a/attachment.bin>


More information about the Linuxppc-dev mailing list