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: [RFA/RFT] [x86] Handle SUBREGs in addressing modes


On Tue, Mar 22, 2005 at 04:44:04PM +0100, Paolo Bonzini wrote:
> +  base_reg = base && GET_CODE (base) == SUBREG ? SUBREG_REG (base) : base;
> +  index_reg = index && GET_CODE (index) == SUBREG ? SUBREG_REG (index) : index;
[...]
>        rtx tmp = base;
>        base = index;
>        index = tmp;
> +      base_reg = GET_CODE (base) == SUBREG ? SUBREG_REG (base) : base;
> +      index_reg = GET_CODE (index) == SUBREG ? SUBREG_REG (index) : index;

No need for conditional memory loads; just exchange base_reg and index_reg.

> +      rtx reg;
> +      reason_rtx = index;
> +  
> +      if (GET_CODE (base) == SUBREG)
> +  	reg = SUBREG_REG (base);
> +      else
> +  	reg = base;
>  
> -      if (GET_CODE (base) != REG)
> +      if (GET_CODE (base) != REG
> +	  && (GET_CODE (base) != SUBREG
> +	      || GET_CODE (reg) != REG
> +	      || GET_MODE_SIZE (GET_MODE (reg)) > UNITS_PER_WORD))

I think this is a fairly obscure way to write this code.  Better


	if (GET_CODE (base) == REG)
	  reg = base;
	else if (GET_CODE (base) == SUBREG
		 && GET_CODE (SUBREG_REG (base)) == REG
		 && GET_MODE_SIZE (GET_MODE (SUBREG_REG (base)))
		    > UNITS_PER_WORD)
	  reg = SUBREG_REG (base);
	else
	  ...

>    /* Validate index register.

Similarly.

Ok with those changes.


r~


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