[PATCH,rs6000] fix ICE caused by lax rs6000_legitimize_address

Nathan Froyd froydnj@codesourcery.com
Wed Nov 12 17:09:00 GMT 2008


On Wed, Nov 12, 2008 at 08:26:51AM +1030, Alan Modra wrote:
> On Tue, Nov 11, 2008 at 07:19:11AM -0800, Nathan Froyd wrote:
> > --- gcc/config/rs6000/rs6000.c	(revision 141763)
> > +++ gcc/config/rs6000/rs6000.c	(working copy)
> > @@ -3813,6 +3813,12 @@ rs6000_legitimize_address (rtx x, rtx ol
> >        HOST_WIDE_INT high_int, low_int;
> >        rtx sum;
> >        low_int = ((INTVAL (XEXP (x, 1)) & 0xffff) ^ 0x8000) - 0x8000;
> > +      /* Using a REG+CONST 64-bit integer load on 64-bit platforms
> > +	 requires that CONST be word-aligned.  */
> > +      if (TARGET_POWERPC64
> > +	  && (mode == DImode || mode == DDmode)
> > +	  && (low_int & 0x3))
> > +	low_int &= (HOST_WIDE_INT) ~3;
> >        high_int = INTVAL (XEXP (x, 1)) - low_int;
> >        sum = force_operand (gen_rtx_PLUS (Pmode, XEXP (x, 0),
> >  					 GEN_INT (high_int)), 0);
> 
> Is this really worth doing?  How does the generated code compare with
> simply returning NULL from rs6000_legitimize_address for this case?

On a cross powerpc64 toolchain from our 4.3 sources (sorry, building a
native one takes forever here), the diffs between the code generated on
the included testcase looks like (MASK is from above code, NULL is what
I think you are proposing):

--- MASK.asm	2008-11-12 08:39:21.000000000 -0800
+++ NULL.asm	2008-11-12 08:39:06.000000000 -0800
@@ -14,8 +14,8 @@
 	std 0,16(1)
 	stdu 1,-112(1)
 	addis 3,3,0x1
-	addi 3,3,2
-	ld 3,-32768(3)
+	addi 3,3,-32766
+	ld 3,0(3)
 	addi 3,3,32764
 	bl use_ull
 	nop

-Nathan



More information about the Gcc-patches mailing list