This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How avoid bad optimization in gcc >= 4.3?


Georg-Johann Lay wrote:

> is there a way to prevent gcc 4.3.x from doing bad optimizations?

We don't have a -fno-bad-optimizations flag; patches welcome!

> I attached an example that shows the performance degradation for
> a source compiled with -Os (-O2 is similar) for target avr.
> 
> The code from the new compiler increased by at about 30%
> with respect to good old 3.4.6 and needs more as double
> of stack slots (13 instead of 6).
> 
>    text    data     bss     dec     hex filename
>     156       0       0     156      9c foo-3.4.6.o
>     206       0       0     206      ce foo-4.3.2.o
> 
> Moreover, it expands a rather trivial address computation into a
> multiplication on a target without hardware multiplier, so
> there is additional, unacceptable time and code penalty
> caused by a call to __mulhi3 from libgcc2.
> 
> The multiplication is by -2, i.e. trivial

This is strange.  Can you provide an example of that address
computation as a test case?

Make it just a few lines long, please.

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]