[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: Ben Jackson
Subject: Re: [avr-gcc-list] multiply by constant always expands to int
Date: Tue, 6 Dec 2005 12:36:28 -0800
User-agent: Mutt/1.5.6i

On Tue, Dec 06, 2005 at 07:33:51PM +0000, Paulo Marques wrote:
> I thought this would just happen with any multiply operation, and tried 
> to build a simple test case, and to my surprise everything was just fine.

I just did the same thing.  Turns out there are at least two things
required for my version:  one of the operands has to be `const', and
you must use `-Os':

                extern char f(char);
                const char y = 20;
                char x, z;

                z = f(x * y);

Turn off `const' or `-Os' and you get __mulqi3, else __mulhi3

You can probably also just move the literal '20' in for y;

Ben Jackson

reply via email to

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