[PATCH] powerpc: provide __bswapdi2

Stephen Rothwell sfr at canb.auug.org.au
Tue May 14 11:09:24 EST 2013


Hi Mikey,

On Mon, 13 May 2013 17:09:59 +1000 Michael Neuling <mikey at neuling.org> wrote:
>
> This doesn't work for me but the below does:
> 
> _GLOBAL(__bswapdi2)
> 	rotlwi  r9,r4,8
> 	rotlwi  r10,r3,8
> 	rlwimi  r9,r4,24,0,7
> 	rlwimi  r10,r3,24,0,7
> 	rlwimi  r9,r4,24,16,23
> 	rlwimi  r10,r3,24,16,23
> 	mr      r4,r10
> 	mr      r3,r9
> 	blr
> 
> stolen from GCC -02 output of:
>   unsigned long long __bswapdi2(unsigned long long x)
>   {
> 	 return ((x & 0x00000000000000ffULL) << 56) |
> 		((x & 0x000000000000ff00ULL) << 40) |
> 		((x & 0x0000000000ff0000ULL) << 24) |
> 		((x & 0x00000000ff000000ULL) <<  8) |
> 		((x & 0x000000ff00000000ULL) >>  8) |
> 		((x & 0x0000ff0000000000ULL) >> 24) |
> 		((x & 0x00ff000000000000ULL) >> 40) |
> 		((x & 0xff00000000000000ULL) >> 56);
>   }

So, if we are just stealing the output of gcc, why not just use the C
version (at least for 32 bit)?

-- 
Cheers,
Stephen Rothwell                    sfr at canb.auug.org.au
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20130514/b8771ab6/attachment.sig>


More information about the Linuxppc-dev mailing list