[PATCH] powerpc: provide __bswapdi2

Joakim Tjernlund joakim.tjernlund at transmode.se
Mon May 13 20:51:59 EST 2013


"Linuxppc-dev" 
<linuxppc-dev-bounces+joakim.tjernlund=transmode.se at lists.ozlabs.org> 
wrote 2013/05/13 12:38:13:
> 
> On Mon, 2013-05-13 at 11:33 +0100, David Woodhouse wrote:
> > 
> > On Mon, 2013-05-13 at 09:33 +0200, Gabriel Paubert wrote:
> > > Actually, I'd swap the two mr instructions to never
> > > have an instruction that uses the result from the
> > > previous one. 
> > 
> > Bad GCC. No biscuit.
> > 
> > Should we file a PR? 
> 
> Maybe not. If you tell it to tune for an in-order machine like Cell, it
> swaps them round. Although now I'm confused about which of POWER[567]
> were in-order:
> 
> [dwmw2 at i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32  | grep 
-B1 mr
>    rlwimi 11,3,24,16,23
>    mr 4,11
>    mr 3,10
> [dwmw2 at i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32 
-mtune=cell | grep -B1 mr
>    rlwimi 11,3,24,16,23
>    mr 3,10
>    mr 4,11
> [dwmw2 at i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32 
-mtune=power5 | grep -B1 mr
>    rlwimi 11,3,24,16,23
>    mr 3,10
>    mr 4,11
> [dwmw2 at i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32 
-mtune=power6 | grep -B1 mr
>    rlwimi 11,3,24,16,23
>    mr 4,11
>    mr 3,10
> [dwmw2 at i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32 
-mtune=power7 | grep -B1 mr
>    rlwimi 11,3,24,16,23
>    mr 4,11
>    mr 3,10

A bit rusty on the ppc asm but can you not remove the mr completely:
                 rlwimi 10,4,24,16,23
                 rlwimi 11,3,24,16,23
                 mr 4,11
                 mr 3,10
to
                 rlwimi 4,4,24,16,23
                 rlwimi 3,3,24,16,23

 Jocke


More information about the Linuxppc-dev mailing list