Re: swap instruction generation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



naga raj <gnuuser.raj@xxxxxxxxx> writes:

>  I have tried with all the possibilities that you have mentioned but
> swaph instruction was not generated.
> Instead of swaph compiler is generating
>
>  1f0:   64640408        bslli   r3, r4, 8   (left shift )
>
>  1f4:   64840008        bsrli   r4, r4, 8  (right shift)
>
>  1f8:   80632000        or      r3, r3, r4 (or operation)

I have no other suggestions.  I do see bswap:HI used on x86_64 for this
input file.

int swapb(int n)
{
  return ((((n) & 0xff000000) >> 24)
            | (((n) & 0x00ff0000) >>  8)
            | (((n) & 0x0000ff00) <<  8)
            | (((n) & 0x000000ff) << 24));

}
short int swaph(unsigned short int n)
{
return  ((((n) & 0xff00) >>  8)
            | (((n) & 0xff) <<  8));
}
int main(int a, unsigned short b)
{
  a=swapb(a);
  b=swaph(b);
  return a + b;
}

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux