[PATCH] PR middle-end/103059: reload: Also accept ASHIFT with indexed addressing

Hans-Peter Nilsson hp@axis.com
Mon Nov 8 19:55:55 GMT 2021


> From: "Maciej W. Rozycki" <macro@embecosm.com>
> Date: Wed, 3 Nov 2021 14:53:58 +0100

> 	gcc/
> 	PR middle-end/103059
> 	* reload.c (find_reloads_address_1): Also accept the ASHIFT form 
> 	of indexed addressing.
> 	(find_reloads): Adjust accordingly.

> ---
>  gcc/reload.c |    9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> gcc-find-reloads-address-ashift.diff
> Index: gcc/gcc/reload.c
> ===================================================================
> --- gcc.orig/gcc/reload.c
> +++ gcc/gcc/reload.c
> @@ -2846,10 +2846,11 @@ find_reloads (rtx_insn *insn, int replac
>  				    i, operand_type[i], ind_levels, insn);
>  
>  	  /* If we now have a simple operand where we used to have a
> -	     PLUS or MULT, re-recognize and try again.  */
> +	     PLUS or MULT or ASHIFT, re-recognize and try again.  */
>  	  if ((OBJECT_P (*recog_data.operand_loc[i])
>  	       || GET_CODE (*recog_data.operand_loc[i]) == SUBREG)
>  	      && (GET_CODE (recog_data.operand[i]) == MULT
> +		  || GET_CODE (recog_data.operand[i]) == ASHIFT
>  		  || GET_CODE (recog_data.operand[i]) == PLUS))
>  	    {
>  	      INSN_CODE (insn) = -1;
> @@ -5562,7 +5563,8 @@ find_reloads_address_1 (machine_mode mod
>  	    return 1;
>  	  }
>  
> -	if (code0 == MULT || code0 == SIGN_EXTEND || code0 == TRUNCATE
> +	if (code0 == MULT || code0 == ASHIFT
> +	    || code0 == SIGN_EXTEND || code0 == TRUNCATE
>  	    || code0 == ZERO_EXTEND || code1 == MEM)
>  	  {
>  	    find_reloads_address_1 (mode, as, orig_op0, 1, PLUS, SCRATCH,
> @@ -5573,7 +5575,8 @@ find_reloads_address_1 (machine_mode mod
>  				    insn);
>  	  }
>  
> -	else if (code1 == MULT || code1 == SIGN_EXTEND || code1 == TRUNCATE
> +	else if (code1 == MULT || code1 == ASHIFT
> +		 || code1 == SIGN_EXTEND || code1 == TRUNCATE
>  		 || code1 == ZERO_EXTEND || code0 == MEM)
>  	  {
>  	    find_reloads_address_1 (mode, as, orig_op0, 0, PLUS, code1,
> 

I regression-tested this patch for cris-elf at
r12-4987-g14e355df3053.  No regressions compared to
r12-4987-g14e355df3053.  (JFTR, that's at regress-11,
compared to T0=2007-01-05-16:47:21).

brgds, H-P


More information about the Gcc-patches mailing list