public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* alpha regression on 920625-1
@ 1998-04-27  0:33 Richard Henderson
  1998-04-27 11:10 ` Joern Rennecke
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Henderson @ 1998-04-27  0:33 UTC (permalink / raw)
  To: egcs

   typedef struct{double x,y;}point;
   point pts[]={{1.0,2.0},{3.0,4.0},{5.0,6.0},{7.0,8.0}};
   static int va1(int nargs,...)
   {
     va_list args;
     int i;
     point pi;
     va_start(args,nargs);
     for(i=0;i<nargs;i++){
       pi=va_arg(args,point);
       if(pts[i].x!=pi.x||pts[i].y!=pi.y)abort();
     }
     va_end(args);
   }

`pi' is initially allocated to a TImode register, and when comes reload
time, we find that we must drop the register to memory.  It so happens
that the copy from varargs is done in DImode, while the comparison must
of course be done in DFmode.

The problem arose with jfc's recent mode-dependant aliasing changes.  
Because the memory block created for the TImode register is not marked
as a structure, and we have two different modes manipulating the memory,
the DFmode load gets scheduled before the DImode store.

The simplest solution is probably to change MAX_FIXED_MODE_SIZE from
TImode to prevent the struct from being mistreated.

Another is to get registers that contained structures to have
MEM_IN_STRUCT_P set out of alter_reg.  This solutiion is also
applicable to complex values, something that jfc warns about
in mode_alias_check.  A patch to do this follows.

Does this seem the correct approach?


r~



Sun Apr 26 21:29:06 1998  Richard Henderson  <rth@cygnus.com>

	* machmode.h (COMPLEX_MODE_P): New.
	* reload1.c (alter_reg): Set MEM_IN_STRUCT_P when assigning storage
	to a pseudo larger than word size.


Index: machmode.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/machmode.h,v
retrieving revision 1.2
diff -c -p -d -r1.2 machmode.h
*** machmode.h	1998/04/03 16:36:11	1.2
--- machmode.h	1998/04/27 04:28:36
*************** extern enum mode_class mode_class[];
*** 164,169 ****
--- 164,174 ----
    (GET_MODE_CLASS (MODE) == MODE_FLOAT	\
     || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT)
  
+ /* Nonzero if MODE is a complex mode.  */
+ #define COMPLEX_MODE_P(MODE)			\
+   (GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT	\
+    || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT)
+ 
  /* Get the size in bytes of an object of mode MODE.  */
  
  extern int mode_size[];
Index: reload1.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/reload1.c,v
retrieving revision 1.19
diff -c -p -d -r1.19 reload1.c
*** reload1.c	1998/04/03 16:36:46	1.19
--- reload1.c	1998/04/27 04:28:36
*************** alter_reg (i, from_reg)
*** 2525,2530 ****
--- 2525,2537 ----
  	    adjust = inherent_size - total_size;
  
  	  RTX_UNCHANGING_P (x) = RTX_UNCHANGING_P (regno_reg_rtx[i]);
+ 
+ 	  /* ??? If this register is larger than the host native word, it
+ 	     is likely that this is a structure being held in registers,
+ 	     and so should have the /s bit set.  The same goes for complex.  */
+ 	  if (total_size > UNITS_PER_WORD
+ 	      || COMPLEX_MODE_P (GET_MODE (regno_reg_rtx[i])))
+ 	    MEM_IN_STRUCT_P (x) = 1;
  	}
        /* Reuse a stack slot if possible.  */
        else if (spill_stack_slot[from_reg] != 0

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

* Re: alpha regression on 920625-1
  1998-04-27  0:33 alpha regression on 920625-1 Richard Henderson
@ 1998-04-27 11:10 ` Joern Rennecke
  1998-04-27 13:59   ` Richard Henderson
  0 siblings, 1 reply; 5+ messages in thread
From: Joern Rennecke @ 1998-04-27 11:10 UTC (permalink / raw)
  To: rth; +Cc: egcs

>    typedef struct{double x,y;}point;
>    point pts[]={{1.0,2.0},{3.0,4.0},{5.0,6.0},{7.0,8.0}};
>    static int va1(int nargs,...)
>    {
>      va_list args;
>      int i;
>      point pi;
>      va_start(args,nargs);
>      for(i=0;i<nargs;i++){
>        pi=va_arg(args,point);
>        if(pts[i].x!=pi.x||pts[i].y!=pi.y)abort();
>      }
>      va_end(args);
>    }
> 
> `pi' is initially allocated to a TImode register, and when comes reload
> time, we find that we must drop the register to memory.  It so happens
> that the copy from varargs is done in DImode, while the comparison must
> of course be done in DFmode.
> 
> The problem arose with jfc's recent mode-dependant aliasing changes.  
> Because the memory block created for the TImode register is not marked
> as a structure, and we have two different modes manipulating the memory,
> the DFmode load gets scheduled before the DImode store.

Everything that gets read via varargs should be treated as part of a
structure; this is already necessary to treat the writing to the varargs
area properly.
You can archive this with a suitable definitions of va_arg.

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

* Re: alpha regression on 920625-1
  1998-04-27 11:10 ` Joern Rennecke
@ 1998-04-27 13:59   ` Richard Henderson
  1998-04-28 19:14     ` Jim Wilson
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Henderson @ 1998-04-27 13:59 UTC (permalink / raw)
  To: Joern Rennecke; +Cc: rth, egcs

On Mon, Apr 27, 1998 at 05:03:26PM +0100, Joern Rennecke wrote:
> Everything that gets read via varargs should be treated as part of a
> structure; this is already necessary to treat the writing to the varargs
> area properly.

No, the problem is after this.  The read from varargs is fine.  The
problem comes when the struct must be spilled from the registers it
was read into.


r~

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

* Re: alpha regression on 920625-1
  1998-04-27 13:59   ` Richard Henderson
@ 1998-04-28 19:14     ` Jim Wilson
  1998-04-28 21:59       ` Richard Henderson
  0 siblings, 1 reply; 5+ messages in thread
From: Jim Wilson @ 1998-04-28 19:14 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Joern Rennecke, egcs

	No, the problem is after this.  The read from varargs is fine.  The
	problem comes when the struct must be spilled from the registers it
	was read into.

This is the same problem that is causing Ulrich's glibc builds to fail,
except that it is happening with a union in this case.

Your patch doesn't entirely fix the problem, since structs/unions of 1 word
will still fail.

I think we need to consider reverting some of the recent alias changes,
as they are causing too much trouble.

Jim

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

* Re: alpha regression on 920625-1
  1998-04-28 19:14     ` Jim Wilson
@ 1998-04-28 21:59       ` Richard Henderson
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 1998-04-28 21:59 UTC (permalink / raw)
  To: Jim Wilson; +Cc: Richard Henderson, Joern Rennecke, egcs

On Tue, Apr 28, 1998 at 07:14:00PM -0700, Jim Wilson wrote:
> Your patch doesn't entirely fix the problem, since structs/unions of 1 word
> will still fail.

Hm.  I suspected it might, but combine was smarter than I in
constructing a test case.


r~

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

end of thread, other threads:[~1998-04-28 21:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-04-27  0:33 alpha regression on 920625-1 Richard Henderson
1998-04-27 11:10 ` Joern Rennecke
1998-04-27 13:59   ` Richard Henderson
1998-04-28 19:14     ` Jim Wilson
1998-04-28 21:59       ` Richard Henderson

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).