> -----Original Message----- > From: > [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > org] On Behalf Of Paul Brook > Sent: Saturday, November 18, 2006 9:46 AM > To: gcc@gcc.gnu.org; Shaun Jackman > Cc: avr-gcc-list@nongnu.org > Subject: [avr-gcc-list] Re: AVR byte swap optimization > > > 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.
There's the problem. You can't just glibly say "make sure the AVR backend implements the bswap rtl patterns". There are precious few volunteers who are familiar enough with gcc internals and the avr port in particular to go do just that. AFAIK, there is no bswap rtl pattern in the avr port, at least there doesn't seem to be in 4.1.1. > Future versions of gcc may also be able to recognise these > idioms without > using the builtin, but AFAIK that's not been implemented yet. Plus there is a long lead time between when it is implemented on HEAD, then branched, released from a branch, and then when it shows up in binary distributions. Eric Weddington