This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [avr-gcc-list] Re: AVR byte swap optimization
- From: "Shaun Jackman" <sjackman at gmail dot com>
- To: "David VanHorn" <dvanhorn at microbrix dot com>
- Cc: "Anton Erasmus" <antone at sentechsa dot com>, avr-gcc-list at nongnu dot org, gcc at gcc dot gnu dot org
- Date: Mon, 18 Dec 2006 15:05:19 -0700
- Subject: Re: [avr-gcc-list] Re: AVR byte swap optimization
- References: <7f45d9390611171530g4c12f68dua3ade87a8b4147b0@mail.gmail.com> <200611270219.56427.vda.linux@googlemail.com> <7f45d9390612181028o21f8d1eo2fc3e01b5802c695@mail.gmail.com> <45871F64.11998.3280E3E@antone.sentechsa.com> <25b178740612181311i2d3933b4u48b02fbaecf06f00@mail.gmail.com>
- Reply-to: "Shaun Jackman" <sjackman at gmail dot com>
On 12/18/06, David VanHorn <dvanhorn@microbrix.com> wrote:
Am I missing something here?
Why not pop to assembler, push the high, push the low, pop the high, pop the
low?
* Inline assembler cannot be used at compile time, for example to
initialize a static variable.
* If the swap function is called on a constant, the compiler cannot
remove the inline assembler. In general, any inline assembler tends to
handcuff the optimizer to some degree.
* Push and pop take two cycles since they access memory. Three mov
instructions are faster than one push and one pop.
Cheers,
Shaun