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: Endian swapping with C code on ARM


Richard Earnshaw <rearnsha@gcc.gnu.org> writes:

> On Fri, 2004-07-09 at 01:47, chicken george wrote:
>> The ARM architecture is capable of endian swapping a 32bit value with 4
>> instructions. I've tried to coax gcc to do so with the following C code,
>> but so far without luck.
>
> What's really needed is a way of telling the compiler that the preferred
> canonicalization of rotate is ROR, but that's quite invasive in the
> middle-end and I've never felt sufficiently bothered by the issue to
> spend the time on fixing it.

I have an old patch lying around which introduces a builtin and RTL
for byte swapping. This would allow to simply make a pattern in the
machine description which reliably generates optimal code, and also
might enable extra tricks for example for byte swapping words in
memory on some targets.

I am, however, not sure anymore whether it's worth adding yet another
RTL.  If people think it is, I could try to revive it.

-- 
	Falk


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