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: fix PR 10730


> The problem here is an out-of-range access to a constant pool.  It comes
> about because the arith_adjacentmem pattern is trying to output "add rN,
> rN, #BIGCONST"; this gets split into multiple smaller adds, and hence we
> end up with more instructions than the length attribute is admitting to.
> 
> Winding up the advertised length would be one option, but it seems
> better just to suppress use of this pattern in those cases.
> 
> p.
> 
> 
> 2003-05-11  Philip Blundell  <philb@gnu.org>
> 
> 	* config/arm/arm.c (adjacent_mem_locations): Reject offsets
> 	involving invalid constants.  [PR 10730]
> 
> Index: config/arm/arm.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.c,v
> retrieving revision 1.271
> diff -u -p -r1.271 arm.c
> --- config/arm/arm.c	10 May 2003 13:10:46 -0000	1.271
> +++ config/arm/arm.c	11 May 2003 12:30:31 -0000
> @@ -4567,6 +4571,12 @@ adjacent_mem_locations (a, b)
>        else
>  	reg1 = REGNO (XEXP (b, 0));
>  
> +      /* Don't accept any offset that will require multiple instructions to handle,
> +	 since this would cause the arith_adjacentmem pattern to output an overlong
> +	 sequence.  */
> +      if (!const_ok_for_arm (val0) || !const_ok_for_arm (val1))
> +	return 0;
> +      
>        return (reg0 == reg1) && ((val1 - val0) == 4 || (val0 - val1) == 4);
>      }
>    return 0;
> 

This is overly restrictive: a subtract-immediate instruction can be used, 
so the test should be const_ok_for_op (PLUS, val).

R.



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