[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Gcc branches small comparison.
From: |
David Brown |
Subject: |
Re: [avr-gcc-list] Gcc branches small comparison. |
Date: |
Mon, 24 Jan 2005 08:38:34 +0100 |
> On Sunday 23 January 2005 16:44, Dmitry K. wrote:
> [...]
> > 3.2.3 3.3.5 3.4.3 4.0 4.0-nrr
> >
> > do_random 102+14 91+10 93+10 173+14 173+14
>
> The reason is:
> avr-gcc 4.0 (20050116) replaces multiplication by a constant to a
combination
> of more simple operations. Thus it does not pay attention to efficiency of
> such replacement.
>
> For example:
> int foo (int x) { return 24011 * x; }
> produce 49 words (-mmcu=atmega8 -Os).
> Older GCC branches -- only 11 words in this case.
>
> I have send the bug to gcc-buglist (#19597).
>
This sort of thing should really be controlled by a flag, since you might
want either behaviour. Calling a routine will result in smaller code *if*
it can be used in more than one place in the program, while "unwrapped"
multiplications will be faster.