[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Re: AVR byte swap optimization
From: |
Shaun Jackman |
Subject: |
Re: [avr-gcc-list] Re: AVR byte swap optimization |
Date: |
Mon, 18 Dec 2006 15:05:19 -0700 |
On 12/18/06, David VanHorn <address@hidden> 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