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: [PATCH] Fix combine.c compilation warnings (take 2)


On Wed, Jul 03, 2002 at 11:26:12AM -0600, Roger Sayle wrote:
> Once again this patch fixes all of the compilation warnings in
> combine.c.

Erg.  One thing at a time, please.

> 	* combine.c (struct_undo): Change types of recorded substitutions
> 	to be either "int" or "rtx", instead of "unsigned int" and "rtx".
> 	(do_SUBST_INT): Change types of the substitution from unsigned int
> 	to int, to avoid compilation warning from SUBST_INT's only caller.

Ok.

>   	  && num_sign_bit_copies (XEXP (x, 0), GET_MODE (XEXP (x, 0)))
> - 	     >= GET_MODE_BITSIZE (mode) + 1
> + 	     >= (unsigned int) (GET_MODE_BITSIZE (mode) + 1)

Looks like these were introduced by reducing mode_bitsize
from "unsigned int" to "unsigned short", such that it now
promotes to "int" with arithmetic.

Perhaps a better solution is

- #define GET_MODE_BITSIZE(MODE)  (mode_bitsize[(int) (MODE)])
+ #define GET_MODE_BITSIZE(MODE)  ((unsigned int) mode_bitsize[(int) (MODE)])

> *************** make_extraction (mode, inner, pos, pos_r
> *** 5971,5977 ****
>     else if (GET_CODE (inner) == ASHIFT
>   	   && GET_CODE (XEXP (inner, 1)) == CONST_INT
>   	   && pos_rtx == 0 && pos == 0
> ! 	   && len > INTVAL (XEXP (inner, 1)))
>       {
>         /* We're extracting the least significant bits of an rtx
>   	 (ashift X (const_int C)), where LEN > C.  Extract the
> --- 5972,5978 ----
>     else if (GET_CODE (inner) == ASHIFT
>   	   && GET_CODE (XEXP (inner, 1)) == CONST_INT
>   	   && pos_rtx == 0 && pos == 0
> ! 	   && len > (unsigned HOST_WIDE_INT) INTVAL (XEXP (inner, 1)))
>       {
>         /* We're extracting the least significant bits of an rtx
>   	 (ashift X (const_int C)), where LEN > C.  Extract the

Ok.

> *************** force_to_mode (x, mode, mask, reg, just_
> *** 6814,6820 ****
> 
>   	  if (GET_CODE (x) == AND && GET_CODE (XEXP (x, 1)) == CONST_INT
>   	      && ((INTVAL (XEXP (x, 1)) & GET_MODE_MASK (GET_MODE (x)))
> ! 		  == (HOST_WIDE_INT) mask))
>   	    x = XEXP (x, 0);
> 
>   	  /* If it remains an AND, try making another AND with the bits
> --- 6815,6821 ----
> 
>   	  if (GET_CODE (x) == AND && GET_CODE (XEXP (x, 1)) == CONST_INT
>   	      && ((INTVAL (XEXP (x, 1)) & GET_MODE_MASK (GET_MODE (x)))
> ! 		  == mask))
>   	    x = XEXP (x, 0);
> 
>   	  /* If it remains an AND, try making another AND with the bits

Ok.

> - 	      && INTVAL (XEXP (XEXP (op0, 0), 1)) == mode_width - 1
> + 	      && (unsigned int) INTVAL (XEXP (XEXP (op0, 0), 1))
> + 		 == mode_width - 1

Never narrow the type with a cast.



r~


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