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]

Re: Bug Report, egcs_ss_19990623 ARM (fwd)



I think it was fixed.  IIRC Nick checked in a change for it.

The testsuite entry compile/990829-1.c was added as a result of this, and 
it certainly doesn't seem to be failing now.

Do you still have an example which fails?

R.

Fri Nov  5 10:07:25 1999  Nick Clifton  <nickc@cygnus.com>

        * function.c (is_addressof): New function.  Returns true if
        the given piece of RTL is an ADDRESSOF.
        (purge_addressof_1): Make boolean.  Return false if the
        ADDRESSOFs could not be purged.
        (purge_addressof): If ADDRESSOFs could not be purged from the
        notes attached to an insn, remove the offending note(s),
        unless they are attached to a libcall.



> I never had any feedback on the patch below.  As far as I know it is still 
> necessary for ARM.  Could somebody please approve or reject it?
> 
> Thanks
> 
> p.
> 
> ------- Forwarded Message
> 
> To: richard.earnshaw@arm.com
> cc: guinan@bluebutton.com, egcs-bugs@egcs.cygnus.com
> Subject: Re: Bug Report, egcs_ss_19990623 ARM 
> In-reply-to: Your message of "Thu, 24 Jun 1999 15:26:49 BST."
>              <199906241426.PAA23055@sun52.NIS.cambridge> 
> Mime-Version: 1.0
> Content-Type: text/plain; charset=us-ascii
> Date: Tue, 27 Jul 1999 14:30:09 +0100
> From: Philip Blundell <pb@fountain.nexus.co.uk>
> 
> >The problem occurs because of the way the ARM has to handle short ints 
> >(for which it has no memory access instructions before ARM architecture 
> >4).  The accesss to y.a gets sign-extended, generating the sequence of 
> >insns
> >
> >(insn 24 6 8 (set (reg:SI 41)
> >        (mem/s:SI (addressof:SI (reg/v:DI 40) 32) 0)) -1 (nil)
> >    (nil))
> >
> >(insn 8 24 9 (set (reg:SI 35)
> >        (ashift:SI (reg:SI 41)
> >            (const_int 16 [0x10]))) -1 (nil)
> >    (nil))
> >
> >(insn 9 8 10 (set (reg:SI 34)
> >        (ashiftrt:SI (reg:SI 35)
> >            (const_int 16 [0x10]))) -1 (nil)
> >    (expr_list:REG_EQUAL (sign_extend:SI (mem/s:HI (addressof:SI (reg/v:DI 
> >40) 3
> >2) 0))
> >        (nil)))
> >
> >Note that insn 24 has (mem:SI (addressof:SI (reg:DI))), but the note  on 
> >insn 9 is (mem:HI (...)).  Thus when purge_addressof_1 tries to find the 
> >existing replacement for the note, there isn't one since the replacement 
> >generated was for something else.
> 
> I thought about this a few weeks ago.  The best solution I could come up with 
> was to have purge_addressof_1 ignore the mode of MEM expressions and treat 
> (mem:SI (...)) and (mem:HI (...)) as being the same.  Here's the patch I used; 
> it doesn't appear to have had any ill effects thus far, though I'm not 
> completely sure it's safe.
> 
> Any opinions?
> 
> p.
> 
> Fri Jul 16 10:29:48 1999  Philip Blundell  <pb@nexus.co.uk>
> 
> 	* function.c (rtx_equal_for_addressof_p): New function.
> 	(purge_addressof_1): Use it instead of rtx_equal_p.
> 
> --- gcc/function.c	1999/05/20 22:26:35	1.90.4.1
> +++ gcc/function.c	1999/07/16 09:30:04
> @@ -3042,6 +3042,105 @@
>     extracted by usage MEM with narrower mode. */
>  static rtx purge_addressof_replacements;
>  
> +/* Return 1 if X and Y are identical-looking rtx's.
> +   This is the Lisp function EQUAL for rtx arguments.  */
> +
> +int
> +rtx_equal_for_addressof_p (x, y)
> +     rtx x, y;
> +{
> +  register int i;
> +  register int j;
> +  register enum rtx_code code;
> +  register char *fmt;
> +
> +  if (x == y)
> +    return 1;
> +  if (x == 0 || y == 0)
> +    return 0;
> +
> +  code = GET_CODE (x);
> +  /* Rtx's of different codes cannot be equal.  */
> +  if (code != GET_CODE (y))
> +    return 0;
> +
> +  /* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent.
> +     (REG:SI x) and (REG:HI x) are NOT equivalent. 
> +     But (MEM:SI x) and (MEM:HI x) are equivalent for our purposes.  */
> +
> +  if (code != MEM && (GET_MODE (x) != GET_MODE (y)))
> +    return 0;
> +
> +  /* REG, LABEL_REF, and SYMBOL_REF can be compared nonrecursively.  */
> +
> +  if (code == REG)
> +    return REGNO (x) == REGNO (y);
> +  else if (code == LABEL_REF)
> +    return XEXP (x, 0) == XEXP (y, 0);
> +  else if (code == SYMBOL_REF)
> +    return XSTR (x, 0) == XSTR (y, 0);
> +  else if (code == SCRATCH || code == CONST_DOUBLE)
> +    return 0;
> +
> +  /* Compare the elements.  If any pair of corresponding elements
> +     fail to match, return 0 for the whole things.  */
> +
> +  fmt = GET_RTX_FORMAT (code);
> +  for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
> +    {
> +      switch (fmt[i])
> +	{
> +	case 'w':
> +	  if (XWINT (x, i) != XWINT (y, i))
> +	    return 0;
> +	  break;
> +
> +	case 'n':
> +	case 'i':
> +	  if (XINT (x, i) != XINT (y, i))
> +	    return 0;
> +	  break;
> +
> +	case 'V':
> +	case 'E':
> +	  /* Two vectors must have the same length.  */
> +	  if (XVECLEN (x, i) != XVECLEN (y, i))
> +	    return 0;
> +
> +	  /* And the corresponding elements must match.  */
> +	  for (j = 0; j < XVECLEN (x, i); j++)
> +	    if (rtx_equal_p (XVECEXP (x, i, j), XVECEXP (y, i, j)) == 0)
> +	      return 0;
> +	  break;
> +
> +	case 'e':
> +	  if (rtx_equal_p (XEXP (x, i), XEXP (y, i)) == 0)
> +	    return 0;
> +	  break;
> +
> +	case 'S':
> +	case 's':
> +	  if (strcmp (XSTR (x, i), XSTR (y, i)))
> +	    return 0;
> +	  break;
> +
> +	case 'u':
> +	  /* These are just backpointers, so they don't matter.  */
> +	  break;
> +
> +	case '0':
> +	  break;
> +
> +	  /* It is believed that rtx's at this level will never
> +	     contain anything but integers and other rtx's,
> +	     except for within LABEL_REFs and SYMBOL_REFs.  */
> +	default:
> +	  abort ();
> +	}
> +    }
> +  return 1;
> +}
> +
>  /* Helper function for purge_addressof.  See if the rtx expression at *LOC
>     in INSN needs to be changed.  If FORCE, always put any ADDRESSOFs into
>     the stack.  */
> @@ -3122,7 +3221,7 @@
>  	      for (tem = purge_bitfield_addressof_replacements;
>  		   tem != NULL_RTX;
>  		   tem = XEXP (XEXP (tem, 1), 1))
> -		if (rtx_equal_p (x, XEXP (tem, 0)))
> +		if (rtx_equal_for_addressof_p (x, XEXP (tem, 0)))
>  		  {
>  		    *loc = XEXP (XEXP (tem, 1), 0);
>  		    return;
> @@ -3132,7 +3231,7 @@
>  	      for (tem = purge_addressof_replacements;
>  		   tem != NULL_RTX;
>  		   tem = XEXP (XEXP (tem, 1), 1))
> -		if (rtx_equal_p (XEXP (x, 0), XEXP (tem, 0)))
> +		if (rtx_equal_for_addressof_p (XEXP (x, 0), XEXP (tem, 0)))
>  		  {
>  		    rtx z = XEXP (XEXP (tem, 1), 0);
>  
> 
> 
> ------- End of Forwarded Message
> 
> 
> 



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