This is the mail archive of the gcc-patches@gcc.gnu.org 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: darwin breakage


On Sat, Dec 25, 2004 at 01:27:44AM +1030, Alan Modra wrote:
> Hi Geoff,
> 
> Andrew Pinski tells me that my poking at legitimate_lo_sum_address_p has
> caused regressions on Darwin.  :-(
> 
> I reckon this code in rs6000_legitimize_reload_address
> 
>       /* Don't do this for TFmode, since the result isn't offsettable.  */
>       && mode != TFmode)
> 
> should be extended to exclude DImode too, but I'm just guessing based on

Like this

	* config/rs6000/rs6000.c (rs6000_legitimize_reload_address): Don't
	generate non-offsettable DImode lo_sum addresses.

Index: gcc/config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.768
diff -u -p -r1.768 rs6000.c
--- gcc/config/rs6000/rs6000.c	24 Dec 2004 01:51:04 -0000	1.768
+++ gcc/config/rs6000/rs6000.c	25 Dec 2004 12:11:31 -0000
@@ -3834,8 +3834,10 @@ rs6000_legitimize_reload_address (rtx x,
       && DEFAULT_ABI == ABI_DARWIN
       && !ALTIVEC_VECTOR_MODE (mode)
       && (flag_pic || MACHO_DYNAMIC_NO_PIC_P)
-      /* Don't do this for TFmode, since the result isn't offsettable.  */
-      && mode != TFmode)
+      /* Don't do this for TFmode, since the result isn't offsettable.
+	 The same goes for DImode without 64-bit gprs.  */
+      && mode != TFmode
+      && (mode != DImode || TARGET_POWERPC64))
     {
       if (flag_pic)
 	{

I've tested this with a darwin cross compiler, and it fixes ICEs in the
first dozen or so testcase regressions I compiled by hand.  OK to apply?

> rtl he's shown on irc.  If that doesn't cure the problem, about all I
> can suggest is this:
> 
> Index: gcc/config/rs6000/rs6000.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
> retrieving revision 1.768
> diff -u -p -r1.768 rs6000.c
> --- gcc/config/rs6000/rs6000.c	24 Dec 2004 01:51:04 -0000	1.768
> +++ gcc/config/rs6000/rs6000.c	24 Dec 2004 14:39:34 -0000
> @@ -3326,6 +3326,7 @@ legitimate_lo_sum_address_p (enum machin
>  	return false;
>        if (GET_MODE_BITSIZE (mode) > 64
>  	  || (GET_MODE_BITSIZE (mode) > 32 && !TARGET_POWERPC64
> +	      && DEFAULT_ABI != ABI_DARWIN
>  	      && !(TARGET_HARD_FLOAT && TARGET_FPRS && mode == DFmode)))
>  	return false;
> 
> Which is assuming that you want to allow powerpc-darwin to generate what
> may be risky lo_sum addresses.

Note also that the changes I made here fixed some performance and code
size regressions on powerpc-linux.

long long x;
void f3 (void) { x += 1; }

With legitimate_lo_sum_address_p using
      if (GET_MODE_BITSIZE (mode) > 64)
	return false;

f3:
        lis 9,x@ha
        stwu 1,-16(1)
        la 11,x@l(9)
        lwz 12,4(11)
        lwz 11,0(11)
        addic 8,12,1
        addze 7,11
        stw 7,8(1)
        stw 8,12(1)
        lfd 0,8(1)
        addi 1,1,16
        stfd 0,x@l(9)
        blr

Current legitimate_lo_sum_address_p code

f3:
        lis 9,x@ha
        la 9,x@l(9)
        lwz 11,0(9)
        lwz 12,4(9)
        addic 8,12,1
        addze 7,11
        stw 7,0(9)
        stw 8,4(9)
        blr

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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