This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Detecting and optimising byte swaping operations in words


K.G. wrote:

> I was wondering how difficult it would be to write some code in
> gcc in order to detect and optimise byte swaping operations with host
> processor instructions, like 'bswap' on x86.
>
> Reading the generated assembly code, I see that gcc already detect and
> optimise binary rotation code. Maybe this would be quite similar ?
> Where should I look in gcc to to find the place where this
> optimisation is done ?

This has been already discussed on this mailing list. I suggest you look for
the previous discussions as they contain advices about where to start. I think
the first step would be to implement a builtin function like
__builtin_byteswap().

Giovanni Bajo



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]