This is the mail archive of the 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: gcc port to StarCore

----- Original Message -----
From: Richard Henderson <>
To: David Livshin <>
Cc: Alan Lehotsky <>; <>
Sent: Thursday, May 02, 2002 8:22 AM
Subject: Re: gcc port to StarCore

> On Thu, May 02, 2002 at 08:38:23AM +0200, David Livshin wrote:
> > However this doesn't seem to be the reason for the problem I have
> > the pattern:
> >
> > ( define_expand "cmpsi"
> No, the define_expand is irrelevant.  It's the define_insn
> that matters here.
> r~

Are you saying that in order to benefit from constant propagation in the:

x = 10;
y = 100;
if ( x > y )

'define_expand "cmpsi"' may not be used?

Would you please direct me to a material ( source code and/or document )
that may clarify the way this optimization is implemented by the GNU
compiler. Right now I even cant guess what it might be. For example I tried
in md:

( define_insn "addsi3"
  [ ( set
      ( match_operand:SI 0 "register_operand"             "" )
      ( plus:SI ( match_operand:SI 1 "general_operand"   "" )
                ( match_operand:SI 2 "general_operand" "" )

and then compiled:

x = 10;
y = 100;
z = x + y;

It seems from the resulting code:

 moveu.l #10,d0
 move.l d0,_x
 moveu.l #100,d2
 move.l d2,_y
 add #10,d2,d2
 move.l d2,_z

that compiler understands that 'x' is equal to 10 but misses the fact that
'y' is also a constant and 'z' is always equal to 110( or something inside
the compiler forces the generation of the add instruction ). Just in-case
you are wondering: description of "movsi"  in my md file allows load of any
constant to any register.

Thank you,


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