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: [avr-gcc-list] Re: AVR byte swap optimization


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


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