David McNab wrote:
On Mon, 2007-02-26 at 13:22 -0700, Eric Weddington wrote:
The line that you have above does some pretty needles math. You should be
able to just simply do:

    fptr = (FuncPtr)pgm_read_word(&funcs_table[i]);

Does that make any difference in the size of your code? It would be
interesting to know one way or the other...

The above option generates a whole lot more code.

I posted my code earlier because I found that while it's not the most
elegant C, it does generate the smallest code with gcc-avr at -O3

It might not make a difference here, but you keep saying things like "but caused severe code bloat, even at -O3."

-O3 is supposed to be _fast_, not _small_. For small code you should use -Os.

For a good size / speed compromise, just use -O2. With -O3 the compiler is allowed to do whatever it needs to do to increase performance, including loop unswitching, more agressive inlining, etc., even if it costs a lot of code size.

As for your particular problem, check the simple code from Joerg Wunsch as it seems to give the most optimal assembly possible for your problem.

--
Paulo Marques
Software Development Department - Grupo PIE, S.A.
Phone: +351 252 290600, Fax: +351 252 290601
Web: www.grupopie.com

"The face of a child can say it all, especially the
mouth part of the face."


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to