From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23375 invoked by alias); 22 Mar 2011 13:56:47 -0000 Received: (qmail 23362 invoked by uid 22791); 22 Mar 2011 13:56:45 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-vx0-f175.google.com (HELO mail-vx0-f175.google.com) (209.85.220.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 22 Mar 2011 13:56:38 +0000 Received: by vxd7 with SMTP id 7so5895240vxd.20 for ; Tue, 22 Mar 2011 06:56:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.0.40 with SMTP id 8mr5293607vdb.8.1300802196280; Tue, 22 Mar 2011 06:56:36 -0700 (PDT) Received: by 10.52.158.6 with HTTP; Tue, 22 Mar 2011 06:56:36 -0700 (PDT) In-Reply-To: References: Date: Tue, 22 Mar 2011 13:56:00 -0000 Message-ID: Subject: Re: Hints for backporting gcc 4.5 powerpc fix to gcc 4.4.3? From: David Edelsohn To: Simon Baldwin Cc: gcc@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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/msg00321.txt.bz2 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 jus= t 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. 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