[Top][All Lists]

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

Re: [avr-gcc-list] multiply by constant always expands to int

From: Paulo Marques
Subject: Re: [avr-gcc-list] multiply by constant always expands to int
Date: Tue, 06 Dec 2005 14:27:06 +0000
User-agent: Mozilla Thunderbird 1.0.6 (X11/20050716)

Eric Weddington wrote:
I can't say why you are seeing what you describe above. But I know that the vast majority of new development work (especially in the AVR port) is being done in 4.x and specifically in the GCC SVN HEAD which will become GCC 4.1 upon release.

Björn Hasse could probably better answer your question about GCC internals.

I had a somewhat similar problem with gcc 4.0.2.

The following code:

unsigned char a, b;
unsigned short w;

w = a * b;

correctly translates into a single "mul" instruction under gcc 3.4.3 (modulo the register moves) but promotes "a" and "b" to 2-byte integers under gcc 4.0.2, generating a bunch of mul's and add's.

Compiling with -mint8 and changing the "unsigned short" to "unsigned long" is even worse as the multiply is done with an 8 bit result, explicitly zeroing the upper byte.

I did checkout the latest gcc, using subversion, but since I know little about gcc internals, I got lost before reaching any useful conclusion.

Is there any documentation (good or bad) about the gcc internals that I could use as a starting point? Or is this a "use the source, Luke" kind of scenario? :)

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

Pointy-Haired Boss: I don't see anything that could stand in our way.
           Dilbert: Sanity? Reality? The laws of physics?

reply via email to

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