public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* One bug in unroll.c
@ 1997-08-24  3:43 H.J. Lu
  0 siblings, 0 replies; 7+ messages in thread
From: H.J. Lu @ 1997-08-24  3:43 UTC (permalink / raw)
  To: egcs

After applying this patch, 920625-1.c seems ok now. I have no
idea how the new alias code works. But I believe something is
wrong. I think if the current aliase code is released in
egcs as is, the egcs project may start on a wrong foot. To the
least, the first public release of egcs should not be worse
than gcc2 ss-970802, which is egcs based upon.


Thanks.


-- 
H.J. Lu (hjl@gnu.ai.mit.edu)
---
--- unroll.c.orig	Sat Aug 23 14:51:27 1997
+++ unroll.c	Sat Aug 23 15:00:22 1997
@@ -2860,9 +2860,13 @@
 		     register to hold the split value of the DEST_ADDR giv.
 		     Emit insn to initialize its value before loop start.  */
 
+#if 0
 		  rtx tem = gen_reg_rtx (v->mode);
-		  record_base_value (REGNO (tem), v->add_val);
 		  v->unrolled = 1;
+#else
+		  tem = gen_reg_rtx (v->mode);
+#endif
+		  record_base_value (REGNO (tem), v->add_val);
 
 		  /* If the address giv has a constant in its new_reg value,
 		     then this constant can be pulled out and put in value,

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: One bug in unroll.c
@ 1997-08-24 12:16 Toon Moene
  0 siblings, 0 replies; 7+ messages in thread
From: Toon Moene @ 1997-08-24 12:16 UTC (permalink / raw)
  To: egcs

>  Try this patch, which was in my version of the alias code
>  but not egcs.  As far as I know the bug fixed by this
>  patch does not affect RISC machines; it was discovered
>  several months ago in Fortran testing on (I think) m68k.

Close, but no cigar :-)  The code that exposed this bug circulated  
on g77-dev, but was C code.  Furthermore, one of the distingiushing  
facts about this bug was that it *could never have been found on an  
m68k*, because config/m68k/m68k.h doesn't define ADDRESS_COST.

This is what I wrote to g77-dev on the 11th of April, in reply to  
Craig's request to look into his solution of this problem:

QUOTE
	* unroll.c (find_splittable_givs): Must create a new
	register if the mult_val and add_val fields don't
	agree.

Aaah, I finally see why I couldn't reproduce this problem - "same"  
in the sense used in unroll.c means "combined" by combine_givs in  
loop.c - and it will only do that if the GIVs are *identical* _or_  
the macro ADDRESS_COST is defined, which is used to determine  
"expensive" in:

/* If G2 can be expressed as a function of G1 and that function is valid
   as an address and no more expensive than using a register for G2,
   the expression of G2 in terms of G1 can be used.  */

Well, ADDRESS_COST is not defined for m68k systems, but is for i386  
and alpha ...

check on mult_val and add_val in unroll.c:  Both GIVs are not  
necessary the "same" as implied by this test (i.e. identical), but  
one is computable from the other (in a cheap way).
UNQUOTE

In fact, this points out that using a member of a struct called  
"same" in this case is highly misleading and should be corrected (or  
ADDRESS_COST should be eliminated).

Cheers,
Toon.

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: One bug in unroll.c
@ 1997-08-24  3:43 John Carr
  0 siblings, 0 replies; 7+ messages in thread
From: John Carr @ 1997-08-24  3:43 UTC (permalink / raw)
  To: egcs

> BTW, how different is your my version of the alias code from
> the one in egcs? What other bug fixes should I know?

I think that was the only bug fix missing from the egcs version (there
have been only one or two bug fixes total).  There are some missing
features -- "restrict" is the most interesting one -- which I will be
merging soon.

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: One bug in unroll.c
@ 1997-08-24  3:43 H.J. Lu
  0 siblings, 0 replies; 7+ messages in thread
From: H.J. Lu @ 1997-08-24  3:43 UTC (permalink / raw)
  To: egcs

> 
> 
> Try this patch, which was in my version of the alias code but not egcs.  As
> far as I know the bug fixed by this patch does not affect RISC machines; it
> was discovered several months ago in Fortran testing on (I think) m68k.
> 
> 

Yes. That fixes 920625-1.c. I will try it on other test cases. Thanks
a lot.

BTW, how different is your my version of the alias code from
the one in egcs? What other bug fixes should I know?

Thanks.


H.J.

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: One bug in unroll.c
@ 1997-08-24  3:43 John Carr
  0 siblings, 0 replies; 7+ messages in thread
From: John Carr @ 1997-08-24  3:43 UTC (permalink / raw)
  To: egcs

Try this patch, which was in my version of the alias code but not egcs.  As
far as I know the bug fixed by this patch does not affect RISC machines; it
was discovered several months ago in Fortran testing on (I think) m68k.


Sat Aug 23 18:19:40 1997  John F. Carr  <jfc@mit.edu>

	* unroll.c (find_splittable_givs): If ADDRESS_COST is defined
	combine_givs_p may return true for registers which are different
	but related.  Check that mult_val and add_val are equal before
	sharing registers.

*** ../gcc/unroll.c	Sat Jun 28 16:19:03 1997
--- unroll.c	Thu Aug 21 18:49:09 1997
***************
*** 2830,2845 ****
  	      else if (unroll_type != UNROLL_COMPLETELY
  		       && v->giv_type == DEST_ADDR
  		       && v->same && v->same->giv_type == DEST_ADDR
! 		       && v->same->unrolled
! #ifdef ADDRESS_COST
! 		       /* combine_givs_p may return true when ADDRESS_COST
! 			  is defined even if the multiply and add values
! 			  are not equal.  To share a register here the
! 			  values must be equal, not only related.  */
! 		       && rtx_equal_p (v->same->mult_val, v->mult_val)
! 		       && rtx_equal_p (v->same->add_val, v->add_val)
! #endif
! 		       )
  		{
  		  v->dest_reg = v->same->dest_reg;
  		  v->shared = 1;
--- 2849,2855 ----
  	      else if (unroll_type != UNROLL_COMPLETELY
  		       && v->giv_type == DEST_ADDR
  		       && v->same && v->same->giv_type == DEST_ADDR
! 		       && v->same->unrolled)
  		{
  		  v->dest_reg = v->same->dest_reg;
  		  v->shared = 1;

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: This can't be right...
@ 1997-08-24  3:43 Jeffrey A Law
  1997-08-24  3:43 ` One bug in unroll.c Jim Wilson
  1997-08-24  3:43 ` Jeffrey A Law
  0 siblings, 2 replies; 7+ messages in thread
From: Jeffrey A Law @ 1997-08-24  3:43 UTC (permalink / raw)
  To: egcs

  In message <199708231701.MAA16067@monolith.solon.com>you write:
  > Well, it's right.  'unsigned short' as an old-style parameter is
  > really int, and cannot match 'unsigned short' in a prototype earlier
  > in the file.
Thanks.  I've checked in a fix for this (just make the args
unsigned ints).  It'll be in the next snapshot.

Jeff

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

end of thread, other threads:[~1997-08-24 12:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-08-24  3:43 One bug in unroll.c H.J. Lu
  -- strict thread matches above, loose matches on Subject: below --
1997-08-24 12:16 Toon Moene
1997-08-24  3:43 John Carr
1997-08-24  3:43 H.J. Lu
1997-08-24  3:43 John Carr
1997-08-24  3:43 This can't be right Jeffrey A Law
1997-08-24  3:43 ` One bug in unroll.c Jim Wilson
1997-08-24  3:43 ` Jeffrey A Law

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