This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: AVR byte swap optimization
- From: Paul Brook <paul at codesourcery dot com>
- To: gcc at gcc dot gnu dot org, "Shaun Jackman" <sjackman at gmail dot com>
- Cc: avr-gcc-list at nongnu dot org
- Date: Sat, 18 Nov 2006 16:46:26 +0000
- Subject: Re: AVR byte swap optimization
- References: <7f45d9390611171530g4c12f68dua3ade87a8b4147b0@mail.gmail.com>
> Ideally, this macro would expand to three mov instructions and a ret.
> Is there anything I can do to help GCC along here? I'm using GCC 4.1.0
> with -O2.
>
> I won't bother to show bswap_32 here, which produces a real disaster!
> Think 47 instructions, for what should be 6.
Use gcc head, __builtin_bswap and make sure the AVR backend implements the
bswap rtl patterns.
Future versions of gcc may also be able to recognise these idioms without
using the builtin, but AFAIK that's not been implemented yet.
Paul