avr-libc-dev
[Top][All Lists]
Advanced

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

Re: [avr-libc-dev] I just noticed OPTIMIZE_SPEED


From: George Spelvin
Subject: Re: [avr-libc-dev] I just noticed OPTIMIZE_SPEED
Date: 6 Dec 2016 18:26:22 -0500

>> Perhaps the two different reduction-mod-5 schemes should depend on
>> OPTIMIZE_SPEED?

> Doesn't really matter much.  Since the library is pre-compiled, you
> cannot map it to the user's -Ox compiler option anyway.

Er... AFAICT, that option has nothing to do with -O compiler
flags, but is set as part of library compilation.

I assumed it was set based on the amount of flash on the target
processor.  4K flash?  Turn off.  128K flash?  Turn on.  32K
flash?  Not sure.

> As Johann already explained, most AVR users care for saved flash
> and RAM more than for saving a few CPU cycles.

RAM, I understand, but flash is either "enough" or "not enough", and if
you have enough, spending a few bytes of it for speed isn't a horrible
thing.

To quote libc/string/memcpy.S:

#if OPTIMIZE_SPEED
; 15 words, (14 + len * 6 - (len & 1)) cycles
        (Unrolled code, copies 2 bytes per loop iteration)
#else
; 11 words, (13 + len * 8) cycles
        (Rolled code)
#endif



reply via email to

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