[PATCH] powerpc: provide __bswapdi2

Michael Neuling mikey at neuling.org
Tue May 14 11:25:00 EST 2013


On 14 May 2013 11:09, "Stephen Rothwell" <sfr at canb.auug.org.au> wrote:
>
> 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)?

Woodhouse: can we just do this?

Mikey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20130514/b4ab3cc3/attachment.html>


More information about the Linuxppc-dev mailing list