public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Hints for backporting gcc 4.5 powerpc fix to gcc 4.4.3?
@ 2011-03-22 13:25 Simon Baldwin
  2011-03-22 13:56 ` David Edelsohn
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Baldwin @ 2011-03-22 13:25 UTC (permalink / raw)
  To: gcc

I'm currently trying to backport a small part of gcc 4.5 r151729 to
gcc 4.4.3.  This revision fixes a problem in powerpc code generation
that leads to gcc not using lmw/stmw instructions in function prologue
and epilogues, where it could otherwise validly use them.

On the face of things, the central piece of r151729 I seem to want is just this:

Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c  (revision 151728)
+++ gcc/config/rs6000/rs6000.c  (revision 151729)
@@ -18033,7 +18033,8 @@ static bool
 no_global_regs_above (int first, bool gpr)
 {
   int i;
-  for (i = first; i < gpr ? 32 : 64 ; i++)
+  int last = gpr ? 32 : 64;
+  for (i = first; i < last; i++)
     if (global_regs[i])
       return false;
   return true;

Taking only that and leaving out all of the rest of r151729 lets me
build a powerpc gcc that does use lmw/stmw instructions in function
prologue and epilogues as hoped.  Unfortunately it also has bad
codegen elsewhere.  So it seems I need more than just this little
piece of r151729.  Unfortunately, r151729 is a fairly large patch that
seems to do a number of jobs and which does not apply readily to gcc
4.4.  At the moment it's not clear to me what other parts of it I
might need.

Can anyone here offer any hints or pointers on how to extract from the
r151729 diff just the few pieces needed to fix this single powerpc
codegen bug in gcc 4.4.3?  Anyone recognize this issue and already
dealt with it in isolation?

Thanks.

--
Google UK Limited | Registered Office: Belgrave House, 76 Buckingham
Palace Road, London SW1W 9TQ | Registered in England Number: 3977902

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Hints for backporting gcc 4.5 powerpc fix to gcc 4.4.3?
  2011-03-22 13:25 Hints for backporting gcc 4.5 powerpc fix to gcc 4.4.3? Simon Baldwin
@ 2011-03-22 13:56 ` David Edelsohn
  2011-03-24  9:42   ` Simon Baldwin
  0 siblings, 1 reply; 3+ messages in thread
From: David Edelsohn @ 2011-03-22 13:56 UTC (permalink / raw)
  To: Simon Baldwin; +Cc: gcc

On Tue, Mar 22, 2011 at 9:25 AM, Simon Baldwin <simonb@google.com> wrote:
> I'm currently trying to backport a small part of gcc 4.5 r151729 to
> gcc 4.4.3.  This revision fixes a problem in powerpc code generation
> that leads to gcc not using lmw/stmw instructions in function prologue
> and epilogues, where it could otherwise validly use them.
>
> On the face of things, the central piece of r151729 I seem to want is just this:
>
> Index: gcc/config/rs6000/rs6000.c
> ===================================================================
> --- gcc/config/rs6000/rs6000.c  (revision 151728)
> +++ gcc/config/rs6000/rs6000.c  (revision 151729)
> @@ -18033,7 +18033,8 @@ static bool
>  no_global_regs_above (int first, bool gpr)
>  {
>   int i;
> -  for (i = first; i < gpr ? 32 : 64 ; i++)
> +  int last = gpr ? 32 : 64;
> +  for (i = first; i < last; i++)
>     if (global_regs[i])
>       return false;
>   return true;
>
> Taking only that and leaving out all of the rest of r151729 lets me
> build a powerpc gcc that does use lmw/stmw instructions in function
> prologue and epilogues as hoped.  Unfortunately it also has bad
> codegen elsewhere.  So it seems I need more than just this little
> piece of r151729.  Unfortunately, r151729 is a fairly large patch that
> seems to do a number of jobs and which does not apply readily to gcc
> 4.4.  At the moment it's not clear to me what other parts of it I
> might need.
>
> Can anyone here offer any hints or pointers on how to extract from the
> r151729 diff just the few pieces needed to fix this single powerpc
> codegen bug in gcc 4.4.3?  Anyone recognize this issue and already
> dealt with it in isolation?

The change to no_global_regs_above() is one of the key pieces, but
that change exposed other latent bugs, as you have encountered.  One
needs the additional patches to the save/restore strategy routines and
prologue/epilogue.  This is why the entire patch was committed in one
piece.

- David

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Hints for backporting gcc 4.5 powerpc fix to gcc 4.4.3?
  2011-03-22 13:56 ` David Edelsohn
@ 2011-03-24  9:42   ` Simon Baldwin
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Baldwin @ 2011-03-24  9:42 UTC (permalink / raw)
  To: David Edelsohn; +Cc: gcc

On 22 March 2011 14:56, David Edelsohn <dje.gcc@gmail.com> wrote:
>
> On Tue, Mar 22, 2011 at 9:25 AM, Simon Baldwin <simonb@google.com> wrote:
> > I'm currently trying to backport a small part of gcc 4.5 r151729 to
> > gcc 4.4.3.  This revision fixes a problem in powerpc code generation
> > that leads to gcc not using lmw/stmw instructions in function prologue
> > and epilogues, where it could otherwise validly use them.
> >
> > On the face of things, the central piece of r151729 I seem to want is just this:
> >
> > Index: gcc/config/rs6000/rs6000.c
> > ===================================================================
> > --- gcc/config/rs6000/rs6000.c  (revision 151728)
> > +++ gcc/config/rs6000/rs6000.c  (revision 151729)
> > @@ -18033,7 +18033,8 @@ static bool
> >  no_global_regs_above (int first, bool gpr)
> >  {
> >   int i;
> > -  for (i = first; i < gpr ? 32 : 64 ; i++)
> > +  int last = gpr ? 32 : 64;
> > +  for (i = first; i < last; i++)
> >     if (global_regs[i])
> >       return false;
> >   return true;
> >
> > Taking only that and leaving out all of the rest of r151729 lets me
> > build a powerpc gcc that does use lmw/stmw instructions in function
> > prologue and epilogues as hoped.  Unfortunately it also has bad
> > codegen elsewhere.  So it seems I need more than just this little
> > piece of r151729.  Unfortunately, r151729 is a fairly large patch that
> > seems to do a number of jobs and which does not apply readily to gcc
> > 4.4.  At the moment it's not clear to me what other parts of it I
> > might need.
> >
> > Can anyone here offer any hints or pointers on how to extract from the
> > r151729 diff just the few pieces needed to fix this single powerpc
> > codegen bug in gcc 4.4.3?  Anyone recognize this issue and already
> > dealt with it in isolation?
>
> The change to no_global_regs_above() is one of the key pieces, but
> that change exposed other latent bugs, as you have encountered.  One
> needs the additional patches to the save/restore strategy routines and
> prologue/epilogue.  This is why the entire patch was committed in one
> piece.

Thanks for the reply, David.  I'll take another look and see if I can
abstract out just the required pieces.  In practice, though, it looks
like it may be easier for me to just upgrade to gcc 4.5 or 4.6.
Certainly safer.

--
Google UK Limited | Registered Office: Belgrave House, 76 Buckingham
Palace Road, London SW1W 9TQ | Registered in England Number: 3977902

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-03-24  9:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-22 13:25 Hints for backporting gcc 4.5 powerpc fix to gcc 4.4.3? Simon Baldwin
2011-03-22 13:56 ` David Edelsohn
2011-03-24  9:42   ` Simon Baldwin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).