This is the mail archive of the
mailing list for the GCC project.
Re: problems with optimisation
Ãngel GonzÃlez wrote:
> I got good results (code apparently better) using -O3 in avr instead of
> -Os. Just the skipped instructions in the prologue and epiloques may be
> worth it. It may that since on avr you have one cycle per instruction
> (except branches), when optimizing for speed, you indirectly also
> optimize the number of instructions. However, I was using C, not C++, so
> the different way of coding could lead to worse optimizations.
> I recommend giving gcc as much information as possible, and watch the
> generated code. I got gcc to perform a few tricky optimizations, and in
> one case, I manually unrolled a loop for him (otherwise, it didn't
> notice it could be optimized). If you see a very bad instance of code
> generation, open a bug. :)
> What difference do you have from -Os to -O3 ?
Very often I also prefer O3 over Os, but this time Os seems to generate beter
That's probably because I leart how to program on avr using c++ (templates
rules ;) ) and my program is almost always perfectly optimized. Only sometimes
I get some weird behaviour when code becomes bigger.