[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] optimization and interrupt

From: Joerg Wunsch
Subject: Re: [avr-gcc-list] optimization and interrupt
Date: Wed, 9 Mar 2005 17:38:37 +0100 (MET)

Jörg Krein <address@hidden> wrote:

> avr-gcc behaves strange when optimizing interrupt code.

No, it only optimizes in a clever way. ;-)  A typical example
where you'd probably not optimize that way when writing
assembler directly.

> In my interrupt routine I compare a variable against two constants.
> I added the code at the end of this posting.  After compiling I
> found only one comparison (113) in the assembler code:

Sure.  It actually implements it as

        actcapt = ICR1;

        diffcapt = actcapt - lastcapt;
        lastcapt = actcapt;

        diffcapt -= 113;
        if (diffcapt >= 0 && diffcapt <= 24)
        { ... }

(or something like that -- I'm a bit in a hurry right now)

J"org Wunsch                                           Unix support engineer
address@hidden        http://www.interface-systems.de/~j/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]