Re: swap instruction generation

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

 



naga raj <gnuuser.raj@xxxxxxxxx> writes:

>   I need to emit a swap instruction from a embedded target which is
> using Gcc-4.1.2.
>
>   I am trying to emit a instruction which will perform following operation
>
>   R0=0x12345678;
>
>   swap R1,R0
>
>   Then after this R1 should contain R1= 0x00007856;

Not 0x78563421?

>  As there is no bswap rtl expression in Gcc-4.1.2 I have tried various
> alternatives like:
>
>  1. Used rotate rtl expression
>
>   2. ashift,ashiftrt and or to generate the above instruction
>
>
>  but compiler is not generating(emitting) swap instruction.

Current gcc has a bswap RTL pattern which swaps bytes in a word.  It was
added in gcc 4.3.  That's the thing to use if your instruction actually
swaps bytes in a word.  For versions of gcc before that you will have to
use an intrinsic function.

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