New function: simplify_subreg

Jan Hubicka jh@suse.cz
Tue May 15 10:06:00 GMT 2001


> --- 3776,3805 ----
>   	  && (GET_MODE_SIZE (mode)
>   	      <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))))
>   	{
> ! 	  rtx temp;
> ! 	  temp = simplify_subreg (mode, SUBREG_REG (x), op0_mode,
> ! 				  SUBREG_BYTE (x));
> ! 	  if (temp)
> ! 	    return temp;
>   	}
>   
>         /* If we are in a SET_DEST, these other cases can't apply.  */
>         if (in_dest)
>   	return x;
>   
> !       /* An SIMPLIFY_SUBREG is able to handle this case as well, but
> !          we want to go throught gen_lowpart_for_combine.  */
>         if (CONSTANT_P (SUBREG_REG (x))
> ! 	  && subreg_lowpart_parts_p (mode, op0_mode, SUBREG_BYTE (x)))
>   	return gen_lowpart_for_combine (mode, SUBREG_REG (x));
>   
> !       {
> ! 	rtx temp;
> ! 	temp = simplify_subreg (mode, SUBREG_REG (x), op0_mode,
> ! 		       		SUBREG_BYTE (x));
> ! 	if (temp)
> ! 	  return temp;
> !       }
> 
> I don't understand the above.  It seems to be calling simplify_subreg
I was just trying to be curefull:
      /* If we are in a SET_DEST, these other cases can't apply.  */
      if (in_dest)
	return x;
So I was trying to avoid calling simplify_subreg in dest for more cases
than the simplification was done previously, as simplify_subreg is designed
to simplify src expressions.

Thinking about this, it may not be needed.  Would be the patch OK if
I simply remove the first part:
>   	  && (GET_MODE_SIZE (mode)
>   	      <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))))
>   	{
> ! 	  rtx temp;
> ! 	  temp = simplify_subreg (mode, SUBREG_REG (x), op0_mode,
> ! 				  SUBREG_BYTE (x));
> ! 	  if (temp)
> ! 	    return temp;
>   	}
>   
>         /* If we are in a SET_DEST, these other cases can't apply.  */
>         if (in_dest)
>   	return x;

And fix comment?
> !       /* An simplify_subreg can't use gen_lowpart_for_combine.  */

Honza

> in the same way twice.  If correct, there needs to be more comments
> saying why.  Also, the comment above isn't gramattically correct and 
> you shouldn't capitalize the function name in the comment.



More information about the Gcc-patches mailing list