Supporting 'MAC' instruction on gcc v4.1.1

Rahul rah.v.ragh@gmail.com
Wed May 16 07:01:00 GMT 2007


On 5/12/07, Paul Brook <paul@codesourcery.com> wrote:
> > But for the following example
> >   int a = 1;
> >   int b = 2;
> >   int c = 3;
> >   c = c + a * b;
> > the MAC pattern is not getting recognized, instead it is still using
> > PLUS and MULT patterns.
>
> Your example is bogus. This is optimized to "c = 5" well before we get to RTL.

Thank you for the responses.

Yes, my example was wrong. I was hoping that the combining of related
instructions, by the combiner, will be taking place when no
optimization (-O0) is enabled.

When i changed my example to:
   	int a, b, c;
	scanf ("%d", &a);
	scanf ("%d", &b);
	scanf ("%d", &c);
	c = c + a * b;
	printf("c = %d\n", c);

and compiled with optimization (-O1 to -O3, -Os), the MAC pattern got
recognized.

But for -O0 optimization, even the 'progname.c.*.combine file' is
*not* getting generated for '-fdump-rtl-all / -fdump-rtl-combine'
options.

Please tell me whether the combining of related instructions, by the
combiner, will be taking place only when optimization is enabled? if
that is the case, is there any way to make gcc recognize the 'MAC"
pattern for  -O0 optimisation?

>
> Paul
>

Regards,
Rahul



More information about the Gcc mailing list