From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22299 invoked by alias); 24 Mar 2011 09:12:20 -0000 Received: (qmail 22282 invoked by uid 22791); 24 Mar 2011 09:12:18 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 24 Mar 2011 09:12:13 +0000 Received: from kpbe11.cbf.corp.google.com (kpbe11.cbf.corp.google.com [172.25.105.75]) by smtp-out.google.com with ESMTP id p2O9CBYX029615 for ; Thu, 24 Mar 2011 02:12:11 -0700 Received: from iyb26 (iyb26.prod.google.com [10.241.49.90]) by kpbe11.cbf.corp.google.com with ESMTP id p2O9BUHI017993 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Thu, 24 Mar 2011 02:12:09 -0700 Received: by iyb26 with SMTP id 26so12245419iyb.34 for ; Thu, 24 Mar 2011 02:12:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.43.53.136 with SMTP id vq8mr9896722icb.275.1300957929353; Thu, 24 Mar 2011 02:12:09 -0700 (PDT) Received: by 10.231.37.132 with HTTP; Thu, 24 Mar 2011 02:12:09 -0700 (PDT) In-Reply-To: References: Date: Thu, 24 Mar 2011 09:42:00 -0000 Message-ID: Subject: Re: Hints for backporting gcc 4.5 powerpc fix to gcc 4.4.3? From: Simon Baldwin To: David Edelsohn Cc: gcc@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2011-03/txt/msg00370.txt.bz2 On 22 March 2011 14:56, David Edelsohn wrote: > > On Tue, Mar 22, 2011 at 9:25 AM, Simon Baldwin wrote: > > I'm currently trying to backport a small part of gcc 4.5 r151729 to > > gcc 4.4.3. =A0This 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 j= ust this: > > > > Index: gcc/config/rs6000/rs6000.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- gcc/config/rs6000/rs6000.c =A0(revision 151728) > > +++ gcc/config/rs6000/rs6000.c =A0(revision 151729) > > @@ -18033,7 +18033,8 @@ static bool > > =A0no_global_regs_above (int first, bool gpr) > > =A0{ > > =A0 int i; > > - =A0for (i =3D first; i < gpr ? 32 : 64 ; i++) > > + =A0int last =3D gpr ? 32 : 64; > > + =A0for (i =3D first; i < last; i++) > > =A0 =A0 if (global_regs[i]) > > =A0 =A0 =A0 return false; > > =A0 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. =A0Unfortunately it also has bad > > codegen elsewhere. =A0So it seems I need more than just this little > > piece of r151729. =A0Unfortunately, r151729 is a fairly large patch that > > seems to do a number of jobs and which does not apply readily to gcc > > 4.4. =A0At 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? =A0Anyone 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. =A0One > needs the additional patches to the save/restore strategy routines and > prologue/epilogue. =A0This 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