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]

[patch] resending: avoid warnings


Hi all,

This patch has been in my tree for quite a while now. 
I'm resending it because I recall having some cvs conflicts, I did not keep track of those.
The old patch and some discussion can be found here:
http://gcc.gnu.org/ml/gcc-patches/2001-08/msg01404.html
http://gcc.gnu.org/ml/gcc-patches/2001-08/msg00677.html

Bootstrapped and tested on i686-pc-linux-gnu. 


Changelog:
2001-08-11  Jan van Male  <jan.vanmale@fenk.wau.nl>
 
        All these changes are to avoid warnings.
 
        * combine.c (struct undo): Make i and *i signed.
        (do_SUBST_INT): Make arguments signed.
        (find_split_point, case SET): Cast GET_MODE_BITSIZE to HOST_WIDE_INT.
        (combine_simplify_rtx, case NEG): Likewise.
        (simplify_logical, case IOR, XOR): Likewise.
        (expand_field_assignment): Likewise.
        (force_to_mode, case XOR, ASHIFT, LSHIFTRT, ASHIFTRT): Likewise.
        (simplify_shift_const, case ROTATE, TRUNCATE) Likewise.
        (simplify_shift_const): Likewise. Cast INTVAL to 
        unsigned HOST_WIDE_INT.
        (simplify_shift_const, case MINUS): Cast count to HOST_WIDE_INT.
        (simplify_comparison): Cast GET_MODE_BITSIZE to HOST_WIDE_INT.
        (simplify_comparison, case MINUS, ASHIFT, LSHIFTRT) Cast mode_width
        to HOST_WIDE_INT.
        * cse.c (fold_rtx): Cast GET_MODE_BITSIZE to HOST_WIDE_INT.
        * expmed.c (expand_shift): Cast INTVAL to unsigned HOST_WIDE_INT 
        instead of unsigned int
        * fold-const.c (div_and_round_double) Cast num to unsigned
        HOST_WIDE_INT
        (optimize_bit_field_compare): Cast GET_MODE_BITSIZE to HOST_WIDE_INT.

Index: combine.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/combine.c,v
retrieving revision 1.239
diff -c -3 -p -r1.239 combine.c
*** combine.c	2001/10/11 18:48:30	1.239
--- combine.c	2001/10/25 13:11:33
*************** struct undo
*** 314,321 ****
  {
    struct undo *next;
    int is_int;
!   union {rtx r; unsigned int i;} old_contents;
!   union {rtx *r; unsigned int *i;} where;
  };

  /* Record a bunch of changes to be undone, up to MAX_UNDO of them.
--- 314,321 ----
  {
    struct undo *next;
    int is_int;
!   union {rtx r; int i;} old_contents;
!   union {rtx *r; int *i;} where;
  };

  /* Record a bunch of changes to be undone, up to MAX_UNDO of them.
*************** static struct undobuf undobuf;
*** 339,346 ****
  static int n_occurrences;

  static void do_SUBST			PARAMS ((rtx *, rtx));
! static void do_SUBST_INT		PARAMS ((unsigned int *,
! 						 unsigned int));
  static void init_reg_last_arrays	PARAMS ((void));
  static void setup_incoming_promotions   PARAMS ((void));
  static void set_nonzero_bits_and_sign_copies  PARAMS ((rtx, rtx, void *));
--- 339,345 ----
  static int n_occurrences;

  static void do_SUBST			PARAMS ((rtx *, rtx));
! static void do_SUBST_INT		PARAMS ((int *, int));
  static void init_reg_last_arrays	PARAMS ((void));
  static void setup_incoming_promotions   PARAMS ((void));
  static void set_nonzero_bits_and_sign_copies  PARAMS ((rtx, rtx, void *));
*************** do_SUBST (into, newval)
*** 445,454 ****

  static void
  do_SUBST_INT (into, newval)
!      unsigned int *into, newval;
  {
    struct undo *buf;
!   unsigned int oldval = *into;
  
    if (oldval == newval)
      return;
--- 444,453 ----

  static void
  do_SUBST_INT (into, newval)
!      int *into, newval;
  {
    struct undo *buf;
!   int oldval = *into;

    if (oldval == newval)
      return;
*************** find_split_point (loc, insn)
*** 2992,2998 ****
  	  && GET_CODE (SET_SRC (x)) == CONST_INT
  	  && ((INTVAL (XEXP (SET_DEST (x), 1))
  	      + INTVAL (XEXP (SET_DEST (x), 2)))
! 	      <= GET_MODE_BITSIZE (GET_MODE (XEXP (SET_DEST (x), 0))))
  	  && ! side_effects_p (XEXP (SET_DEST (x), 0)))
  	{
  	  HOST_WIDE_INT pos = INTVAL (XEXP (SET_DEST (x), 2));
--- 2991,2998 ----
  	  && GET_CODE (SET_SRC (x)) == CONST_INT
  	  && ((INTVAL (XEXP (SET_DEST (x), 1))
  	      + INTVAL (XEXP (SET_DEST (x), 2)))
! 	      <= (HOST_WIDE_INT) 
! 		 GET_MODE_BITSIZE (GET_MODE (XEXP (SET_DEST (x), 0))))
  	  && ! side_effects_p (XEXP (SET_DEST (x), 0)))
  	{
  	  HOST_WIDE_INT pos = INTVAL (XEXP (SET_DEST (x), 2));
*************** combine_simplify_rtx (x, op0_mode, last,
*** 3945,3951 ****

        if (GET_CODE (temp) == ASHIFTRT
  	  && GET_CODE (XEXP (temp, 1)) == CONST_INT
! 	  && INTVAL (XEXP (temp, 1)) == GET_MODE_BITSIZE (mode) - 1)
  	return simplify_shift_const (temp, LSHIFTRT, mode, XEXP (temp, 0),
  				     INTVAL (XEXP (temp, 1)));
  
--- 3945,3952 ----
  
        if (GET_CODE (temp) == ASHIFTRT
  	  && GET_CODE (XEXP (temp, 1)) == CONST_INT
! 	  && INTVAL (XEXP (temp, 1)) == (HOST_WIDE_INT) 
! 					GET_MODE_BITSIZE (mode) - 1)
  	return simplify_shift_const (temp, LSHIFTRT, mode, XEXP (temp, 0),
  				     INTVAL (XEXP (temp, 1)));

*************** simplify_logical (x, last)
*** 5345,5351 ****
  	  && GET_CODE (XEXP (op0, 1)) == CONST_INT
  	  && GET_CODE (XEXP (op1, 1)) == CONST_INT
  	  && (INTVAL (XEXP (op0, 1)) + INTVAL (XEXP (op1, 1))
! 	      == GET_MODE_BITSIZE (mode)))
  	return gen_rtx_ROTATE (mode, XEXP (op0, 0),
  			       (GET_CODE (op0) == ASHIFT
  				? XEXP (op0, 1) : XEXP (op1, 1)));
--- 5346,5352 ----
  	  && GET_CODE (XEXP (op0, 1)) == CONST_INT
  	  && GET_CODE (XEXP (op1, 1)) == CONST_INT
  	  && (INTVAL (XEXP (op0, 1)) + INTVAL (XEXP (op1, 1))
! 	      == (HOST_WIDE_INT) GET_MODE_BITSIZE (mode)))
  	return gen_rtx_ROTATE (mode, XEXP (op0, 0),
  			       (GET_CODE (op0) == ASHIFT
  				? XEXP (op0, 1) : XEXP (op1, 1)));
*************** simplify_logical (x, last)
*** 5441,5447 ****
  	  && op1 == const1_rtx
  	  && GET_CODE (op0) == LSHIFTRT
  	  && GET_CODE (XEXP (op0, 1)) == CONST_INT
! 	  && INTVAL (XEXP (op0, 1)) == GET_MODE_BITSIZE (mode) - 1)
  	return gen_rtx_GE (mode, XEXP (op0, 0), const0_rtx);
  
        /* (xor (comparison foo bar) (const_int sign-bit))
--- 5442,5449 ----
  	  && op1 == const1_rtx
  	  && GET_CODE (op0) == LSHIFTRT
  	  && GET_CODE (XEXP (op0, 1)) == CONST_INT
! 	  && INTVAL (XEXP (op0, 1)) == (HOST_WIDE_INT) 
! 				       GET_MODE_BITSIZE (mode) - 1)
  	return gen_rtx_GE (mode, XEXP (op0, 0), const0_rtx);

        /* (xor (comparison foo bar) (const_int sign-bit))
*************** expand_field_assignment (x)
*** 5698,5704 ****
  	  /* If the position is constant and spans the width of INNER,
  	     surround INNER  with a USE to indicate this.  */
  	  if (GET_CODE (pos) == CONST_INT
! 	      && INTVAL (pos) + len > GET_MODE_BITSIZE (GET_MODE (inner)))
  	    inner = gen_rtx_USE (GET_MODE (SET_DEST (x)), inner);
  
  	  if (BITS_BIG_ENDIAN)
--- 5700,5707 ----
  	  /* If the position is constant and spans the width of INNER,
  	     surround INNER  with a USE to indicate this.  */
  	  if (GET_CODE (pos) == CONST_INT
! 	      && INTVAL (pos) + len 
! 		 > (HOST_WIDE_INT) GET_MODE_BITSIZE (GET_MODE (inner)))
  	    inner = gen_rtx_USE (GET_MODE (SET_DEST (x)), inner);

  	  if (BITS_BIG_ENDIAN)
*************** expand_field_assignment (x)
*** 5709,5715 ****
  	      else if (GET_CODE (pos) == MINUS
  		       && GET_CODE (XEXP (pos, 1)) == CONST_INT
  		       && (INTVAL (XEXP (pos, 1))
! 			   == GET_MODE_BITSIZE (GET_MODE (inner)) - len))
  		/* If position is ADJUST - X, new position is X.  */
  		pos = XEXP (pos, 0);
  	      else
--- 5712,5719 ----
  	      else if (GET_CODE (pos) == MINUS
  		       && GET_CODE (XEXP (pos, 1)) == CONST_INT
  		       && (INTVAL (XEXP (pos, 1))
! 			   == (HOST_WIDE_INT) 
! 			      GET_MODE_BITSIZE (GET_MODE (inner)) - len))
  		/* If position is ADJUST - X, new position is X.  */
  		pos = XEXP (pos, 0);
  	      else
*************** force_to_mode (x, mode, mask, reg, just_
*** 6830,6836 ****
  	  && GET_CODE (XEXP (x, 1)) == CONST_INT
  	  && ((INTVAL (XEXP (XEXP (x, 0), 1))
  	       + floor_log2 (INTVAL (XEXP (x, 1))))
! 	      < GET_MODE_BITSIZE (GET_MODE (x)))
  	  && (INTVAL (XEXP (x, 1))
  	      & ~nonzero_bits (XEXP (x, 0), GET_MODE (x))) == 0)
  	{
--- 6834,6840 ----
  	  && GET_CODE (XEXP (x, 1)) == CONST_INT
  	  && ((INTVAL (XEXP (XEXP (x, 0), 1))
  	       + floor_log2 (INTVAL (XEXP (x, 1))))
! 	      < (HOST_WIDE_INT) GET_MODE_BITSIZE (GET_MODE (x)))
  	  && (INTVAL (XEXP (x, 1))
  	      & ~nonzero_bits (XEXP (x, 0), GET_MODE (x))) == 0)
  	{
*************** force_to_mode (x, mode, mask, reg, just_
*** 6875,6881 ****
  
        if (! (GET_CODE (XEXP (x, 1)) == CONST_INT
  	     && INTVAL (XEXP (x, 1)) >= 0
! 	     && INTVAL (XEXP (x, 1)) < GET_MODE_BITSIZE (mode))
  	  && ! (GET_MODE (XEXP (x, 1)) != VOIDmode
  		&& (nonzero_bits (XEXP (x, 1), GET_MODE (XEXP (x, 1)))
  		    < (unsigned HOST_WIDE_INT) GET_MODE_BITSIZE (mode))))
--- 6879,6885 ----
  
        if (! (GET_CODE (XEXP (x, 1)) == CONST_INT
  	     && INTVAL (XEXP (x, 1)) >= 0
! 	     && INTVAL (XEXP (x, 1)) < (HOST_WIDE_INT) GET_MODE_BITSIZE (mode))
  	  && ! (GET_MODE (XEXP (x, 1)) != VOIDmode
  		&& (nonzero_bits (XEXP (x, 1), GET_MODE (XEXP (x, 1)))
  		    < (unsigned HOST_WIDE_INT) GET_MODE_BITSIZE (mode))))
*************** force_to_mode (x, mode, mask, reg, just_
*** 6886,6892 ****
  	 conservative form of the mask.  */
        if (GET_CODE (XEXP (x, 1)) == CONST_INT
  	  && INTVAL (XEXP (x, 1)) >= 0
! 	  && INTVAL (XEXP (x, 1)) < GET_MODE_BITSIZE (op_mode)
  	  && GET_MODE_BITSIZE (op_mode) <= HOST_BITS_PER_WIDE_INT)
  	mask >>= INTVAL (XEXP (x, 1));
        else
--- 6890,6896 ----
  	 conservative form of the mask.  */
        if (GET_CODE (XEXP (x, 1)) == CONST_INT
  	  && INTVAL (XEXP (x, 1)) >= 0
! 	  && INTVAL (XEXP (x, 1)) < (HOST_WIDE_INT) GET_MODE_BITSIZE (op_mode)
  	  && GET_MODE_BITSIZE (op_mode) <= HOST_BITS_PER_WIDE_INT)
  	mask >>= INTVAL (XEXP (x, 1));
        else
*************** force_to_mode (x, mode, mask, reg, just_
*** 6943,6949 ****
  	  /* Number of bits left after the shift must be more than the mask
  	     needs.  */
  	  && ((INTVAL (XEXP (x, 1)) + exact_log2 (mask + 1))
! 	      <= GET_MODE_BITSIZE (GET_MODE (x)))
  	  /* Must be more sign bit copies than the mask needs.  */
  	  && ((int) num_sign_bit_copies (XEXP (x, 0), GET_MODE (XEXP (x, 0)))
  	      >= exact_log2 (mask + 1)))
--- 6947,6953 ----
  	  /* Number of bits left after the shift must be more than the mask
  	     needs.  */
  	  && ((INTVAL (XEXP (x, 1)) + exact_log2 (mask + 1))
! 	      <= (HOST_WIDE_INT) GET_MODE_BITSIZE (GET_MODE (x)))
  	  /* Must be more sign bit copies than the mask needs.  */
  	  && ((int) num_sign_bit_copies (XEXP (x, 0), GET_MODE (XEXP (x, 0)))
  	      >= exact_log2 (mask + 1)))
*************** force_to_mode (x, mode, mask, reg, just_
*** 7004,7010 ****
  	      x = simplify_shift_const
  		(x, LSHIFTRT, GET_MODE (x), XEXP (x, 0),
  		 i < 0 ? INTVAL (XEXP (x, 1))
! 		 : GET_MODE_BITSIZE (GET_MODE (x)) - 1 - i);

  	      if (GET_CODE (x) != ASHIFTRT)
  		return force_to_mode (x, mode, mask, reg, next_select);
--- 7008,7014 ----
  	      x = simplify_shift_const
  		(x, LSHIFTRT, GET_MODE (x), XEXP (x, 0),
  		 i < 0 ? INTVAL (XEXP (x, 1))
! 		 : (HOST_WIDE_INT) GET_MODE_BITSIZE (GET_MODE (x)) - 1 - i);

  	      if (GET_CODE (x) != ASHIFTRT)
  		return force_to_mode (x, mode, mask, reg, next_select);
*************** force_to_mode (x, mode, mask, reg, just_
*** 7026,7032 ****
  	  && GET_CODE (XEXP (x, 1)) == CONST_INT
  	  && INTVAL (XEXP (x, 1)) >= 0
  	  && (INTVAL (XEXP (x, 1))
! 	      <= GET_MODE_BITSIZE (GET_MODE (x)) - (floor_log2 (mask) + 1))
  	  && GET_CODE (XEXP (x, 0)) == ASHIFT
  	  && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
  	  && INTVAL (XEXP (XEXP (x, 0), 1)) == INTVAL (XEXP (x, 1)))
--- 7030,7037 ----
  	  && GET_CODE (XEXP (x, 1)) == CONST_INT
  	  && INTVAL (XEXP (x, 1)) >= 0
  	  && (INTVAL (XEXP (x, 1))
! 	      <= (HOST_WIDE_INT) GET_MODE_BITSIZE (GET_MODE (x)) 
! 		 - (floor_log2 (mask) + 1))
  	  && GET_CODE (XEXP (x, 0)) == ASHIFT
  	  && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
  	  && INTVAL (XEXP (XEXP (x, 0), 1)) == INTVAL (XEXP (x, 1)))
*************** force_to_mode (x, mode, mask, reg, just_
*** 7075,7081 ****
  	  && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
  	  && INTVAL (XEXP (XEXP (x, 0), 1)) >= 0
  	  && (INTVAL (XEXP (XEXP (x, 0), 1)) + floor_log2 (mask)
! 	      < GET_MODE_BITSIZE (GET_MODE (x)))
  	  && INTVAL (XEXP (XEXP (x, 0), 1)) < HOST_BITS_PER_WIDE_INT)
  	{
  	  temp = GEN_INT (mask << INTVAL (XEXP (XEXP (x, 0), 1)));
--- 7080,7086 ----
  	  && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
  	  && INTVAL (XEXP (XEXP (x, 0), 1)) >= 0
  	  && (INTVAL (XEXP (XEXP (x, 0), 1)) + floor_log2 (mask)
! 	      < (HOST_WIDE_INT) GET_MODE_BITSIZE (GET_MODE (x)))
  	  && INTVAL (XEXP (XEXP (x, 0), 1)) < HOST_BITS_PER_WIDE_INT)
  	{
  	  temp = GEN_INT (mask << INTVAL (XEXP (XEXP (x, 0), 1)));
*************** simplify_shift_const (x, code, result_mo
*** 8830,8836 ****
    /* If we were given an invalid count, don't do anything except exactly
       what was requested.  */
  
!   if (input_count < 0 || input_count >= (int) GET_MODE_BITSIZE (mode))
      {
        if (x)
  	return x;
--- 8835,8841 ----
    /* If we were given an invalid count, don't do anything except exactly
       what was requested.  */
  
!   if (input_count < 0 || input_count > (HOST_WIDE_INT) GET_MODE_BITSIZE (mode))
      {
        if (x)
  	return x;
*************** simplify_shift_const (x, code, result_mo
*** 9061,9067 ****
  	     AND of a new shift with a mask.  We compute the result below.  */
  	  if (GET_CODE (XEXP (varop, 1)) == CONST_INT
  	      && INTVAL (XEXP (varop, 1)) >= 0
! 	      && INTVAL (XEXP (varop, 1)) < GET_MODE_BITSIZE (GET_MODE (varop))
  	      && GET_MODE_BITSIZE (result_mode) <= HOST_BITS_PER_WIDE_INT
  	      && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT)
  	    {
--- 9066,9073 ----
  	     AND of a new shift with a mask.  We compute the result below.  */
  	  if (GET_CODE (XEXP (varop, 1)) == CONST_INT
  	      && INTVAL (XEXP (varop, 1)) >= 0
! 	      && INTVAL (XEXP (varop, 1))
! 		 < (HOST_WIDE_INT) GET_MODE_BITSIZE (GET_MODE (varop))
  	      && GET_MODE_BITSIZE (result_mode) <= HOST_BITS_PER_WIDE_INT
  	      && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT)
  	    {
*************** simplify_shift_const (x, code, result_mo
*** 9401,9407 ****
  	      && count == GET_MODE_BITSIZE (GET_MODE (varop)) - 1
  	      && (code == LSHIFTRT || code == ASHIFTRT)
  	      && GET_CODE (XEXP (XEXP (varop, 0), 1)) == CONST_INT
! 	      && INTVAL (XEXP (XEXP (varop, 0), 1)) == count
  	      && rtx_equal_p (XEXP (XEXP (varop, 0), 0), XEXP (varop, 1)))
  	    {
  	      count = 0;
--- 9407,9413 ----
  	      && count == GET_MODE_BITSIZE (GET_MODE (varop)) - 1
  	      && (code == LSHIFTRT || code == ASHIFTRT)
  	      && GET_CODE (XEXP (XEXP (varop, 0), 1)) == CONST_INT
! 	      && INTVAL (XEXP (XEXP (varop, 0), 1)) == (HOST_WIDE_INT) count
  	      && rtx_equal_p (XEXP (XEXP (varop, 0), 0), XEXP (varop, 1)))
  	    {
  	      count = 0;
*************** simplify_shift_const (x, code, result_mo
*** 9422,9428 ****
  	      && GET_CODE (XEXP (varop, 0)) == LSHIFTRT
  	      && GET_CODE (XEXP (XEXP (varop, 0), 1)) == CONST_INT
  	      && (INTVAL (XEXP (XEXP (varop, 0), 1))
! 		  >= (GET_MODE_BITSIZE (GET_MODE (XEXP (varop, 0)))
  		      - GET_MODE_BITSIZE (GET_MODE (varop)))))
  	    {
  	      rtx varop_inner = XEXP (varop, 0);
--- 9428,9435 ----
  	      && GET_CODE (XEXP (varop, 0)) == LSHIFTRT
  	      && GET_CODE (XEXP (XEXP (varop, 0), 1)) == CONST_INT
  	      && (INTVAL (XEXP (XEXP (varop, 0), 1))
! 		  >= (HOST_WIDE_INT)
! 		     (GET_MODE_BITSIZE (GET_MODE (XEXP (varop, 0)))
  		      - GET_MODE_BITSIZE (GET_MODE (varop)))))
  	    {
  	      rtx varop_inner = XEXP (varop, 0);
*************** simplify_shift_const (x, code, result_mo
*** 9465,9471 ****
  
    if (x && GET_RTX_CLASS (GET_CODE (x)) == '2'
        && GET_CODE (XEXP (x, 1)) == CONST_INT
!       && INTVAL (XEXP (x, 1)) == count)
      const_rtx = XEXP (x, 1);
    else
      const_rtx = GEN_INT (count);
--- 9472,9479 ----
  
    if (x && GET_RTX_CLASS (GET_CODE (x)) == '2'
        && GET_CODE (XEXP (x, 1)) == CONST_INT
!       && INTVAL (XEXP (x, 1)) >= 0
!       && (unsigned HOST_WIDE_INT) INTVAL (XEXP (x, 1)) == count)
      const_rtx = XEXP (x, 1);
    else
      const_rtx = GEN_INT (count);
*************** simplify_comparison (code, pop0, pop1)
*** 9851,9857 ****
  	  && INTVAL (XEXP (op0, 1)) == INTVAL (XEXP (XEXP (op0, 0), 1))
  	  && INTVAL (XEXP (op0, 1)) == INTVAL (XEXP (XEXP (op1, 0), 1))
  	  && (INTVAL (XEXP (op0, 1))
! 	      == (GET_MODE_BITSIZE (GET_MODE (op0))
  		  - (GET_MODE_BITSIZE
  		     (GET_MODE (SUBREG_REG (XEXP (XEXP (op0, 0), 0))))))))
  	{
--- 9859,9866 ----
  	  && INTVAL (XEXP (op0, 1)) == INTVAL (XEXP (XEXP (op0, 0), 1))
  	  && INTVAL (XEXP (op0, 1)) == INTVAL (XEXP (XEXP (op1, 0), 1))
  	  && (INTVAL (XEXP (op0, 1))
! 	      == (HOST_WIDE_INT)
! 		 (GET_MODE_BITSIZE (GET_MODE (op0))
  		  - (GET_MODE_BITSIZE
  		     (GET_MODE (SUBREG_REG (XEXP (XEXP (op0, 0), 0))))))))
  	{
*************** simplify_comparison (code, pop0, pop1)
*** 10460,10466 ****
  	     of bits in X minus 1, is one iff X > 0.  */
  	  if (sign_bit_comparison_p && GET_CODE (XEXP (op0, 0)) == ASHIFTRT
  	      && GET_CODE (XEXP (XEXP (op0, 0), 1)) == CONST_INT
! 	      && INTVAL (XEXP (XEXP (op0, 0), 1)) == mode_width - 1
  	      && rtx_equal_p (XEXP (XEXP (op0, 0), 0), XEXP (op0, 1)))
  	    {
  	      op0 = XEXP (op0, 1);
--- 10469,10476 ----
  	     of bits in X minus 1, is one iff X > 0.  */
  	  if (sign_bit_comparison_p && GET_CODE (XEXP (op0, 0)) == ASHIFTRT
  	      && GET_CODE (XEXP (XEXP (op0, 0), 1)) == CONST_INT
! 	      && INTVAL (XEXP (XEXP (op0, 0), 1))
! 		 == (HOST_WIDE_INT) mode_width - 1
  	      && rtx_equal_p (XEXP (XEXP (op0, 0), 0), XEXP (op0, 1)))
  	    {
  	      op0 = XEXP (op0, 1);
*************** simplify_comparison (code, pop0, pop1)
*** 10718,10724 ****
  	     low-order bit.  */
  	  if (const_op == 0 && equality_comparison_p
  	      && GET_CODE (XEXP (op0, 1)) == CONST_INT
! 	      && INTVAL (XEXP (op0, 1)) == mode_width - 1)
  	    {
  	      op0 = simplify_and_const_int (NULL_RTX, mode, XEXP (op0, 0),
  					    (HOST_WIDE_INT) 1);
--- 10728,10734 ----
  	     low-order bit.  */
  	  if (const_op == 0 && equality_comparison_p
  	      && GET_CODE (XEXP (op0, 1)) == CONST_INT
! 	      && INTVAL (XEXP (op0, 1)) == (HOST_WIDE_INT) mode_width - 1)
  	    {
  	      op0 = simplify_and_const_int (NULL_RTX, mode, XEXP (op0, 0),
  					    (HOST_WIDE_INT) 1);
*************** simplify_comparison (code, pop0, pop1)
*** 10794,10800 ****
  		  & (((HOST_WIDE_INT) 1 << INTVAL (XEXP (op0, 1))) - 1)) == 0
  	      && (const_op == 0
  		  || (floor_log2 (const_op) + INTVAL (XEXP (op0, 1))
! 		      < mode_width)))
  	    {
  	      const_op <<= INTVAL (XEXP (op0, 1));
  	      op1 = GEN_INT (const_op);
--- 10804,10810 ----
  		  & (((HOST_WIDE_INT) 1 << INTVAL (XEXP (op0, 1))) - 1)) == 0
  	      && (const_op == 0
  		  || (floor_log2 (const_op) + INTVAL (XEXP (op0, 1))
! 		      < (HOST_WIDE_INT) mode_width)))
  	    {
  	      const_op <<= INTVAL (XEXP (op0, 1));
  	      op1 = GEN_INT (const_op);
*************** simplify_comparison (code, pop0, pop1)
*** 10807,10813 ****
  	  if (const_op == 0
  	      && (equality_comparison_p || sign_bit_comparison_p)
  	      && GET_CODE (XEXP (op0, 1)) == CONST_INT
! 	      && INTVAL (XEXP (op0, 1)) == mode_width - 1)
  	    {
  	      op0 = XEXP (op0, 0);
  	      code = (code == NE || code == GT ? LT : GE);
--- 10817,10823 ----
  	  if (const_op == 0
  	      && (equality_comparison_p || sign_bit_comparison_p)
  	      && GET_CODE (XEXP (op0, 1)) == CONST_INT
! 	      && INTVAL (XEXP (op0, 1)) == (HOST_WIDE_INT) mode_width - 1)
  	    {
  	      op0 = XEXP (op0, 0);
  	      code = (code == NE || code == GT ? LT : GE);
Index: cse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cse.c,v
retrieving revision 1.209
diff -c -3 -p -r1.209 cse.c
*** cse.c	2001/10/11 03:15:26	1.209
--- cse.c	2001/10/25 13:11:35
*************** fold_rtx (x, insn)
*** 3495,3503 ****
  		  if (op0 && op1
  		      && GET_CODE (elt->exp) == ASHIFT
  		      && GET_CODE (op1) == CONST_INT
! 		      && INTVAL (op1) >= GET_MODE_BITSIZE (mode))
  		    {
! 		      if (INTVAL (op1) < GET_MODE_BITSIZE (GET_MODE (elt->exp)))
  
  			/* If the count fits in the inner mode's width,
  			   but exceeds the outer mode's width,
--- 3495,3505 ----
  		  if (op0 && op1
  		      && GET_CODE (elt->exp) == ASHIFT
  		      && GET_CODE (op1) == CONST_INT
! 		      && INTVAL (op1) >= (HOST_WIDE_INT)
! 					 GET_MODE_BITSIZE (mode))
  		    {
! 		      if (INTVAL (op1) < (HOST_WIDE_INT)
! 					 GET_MODE_BITSIZE (GET_MODE (elt->exp)))
  
  			/* If the count fits in the inner mode's width,
  			   but exceeds the outer mode's width,
*************** fold_rtx (x, insn)
*** 3629,3635 ****
  		rtx table = PATTERN (table_insn);

  		if (offset >= 0
! 		    && (offset / GET_MODE_SIZE (GET_MODE (table))
  			< XVECLEN (table, 0)))
  		  return XVECEXP (table, 0,
  				  offset / GET_MODE_SIZE (GET_MODE (table)));
--- 3631,3637 ----
  		rtx table = PATTERN (table_insn);

  		if (offset >= 0
! 		    && (offset / (int) GET_MODE_SIZE (GET_MODE (table))
  			< XVECLEN (table, 0)))
  		  return XVECEXP (table, 0,
  				  offset / GET_MODE_SIZE (GET_MODE (table)));
*************** fold_rtx (x, insn)
*** 3640,3646 ****
  		rtx table = PATTERN (table_insn);

  		if (offset >= 0
! 		    && (offset / GET_MODE_SIZE (GET_MODE (table))
  			< XVECLEN (table, 1)))
  		  {
  		    offset /= GET_MODE_SIZE (GET_MODE (table));
--- 3642,3648 ----
  		rtx table = PATTERN (table_insn);

  		if (offset >= 0
! 		    && (offset / (int) GET_MODE_SIZE (GET_MODE (table))
  			< XVECLEN (table, 1)))
  		  {
  		    offset /= GET_MODE_SIZE (GET_MODE (table));
*************** fold_rtx (x, insn)
*** 4248,4254 ****
  		 of shifts.  */
  
  	      if (is_shift && GET_CODE (new_const) == CONST_INT
! 		  && INTVAL (new_const) >= GET_MODE_BITSIZE (mode))
  		{
  		  /* As an exception, we can turn an ASHIFTRT of this
  		     form into a shift of the number of bits - 1.  */
--- 4250,4257 ----
  		 of shifts.  */
  
  	      if (is_shift && GET_CODE (new_const) == CONST_INT
! 		  && INTVAL (new_const) >= (HOST_WIDE_INT)
! 					   GET_MODE_BITSIZE (mode))
  		{
  		  /* As an exception, we can turn an ASHIFTRT of this
  		     form into a shift of the number of bits - 1.  */
Index: expmed.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expmed.c,v
retrieving revision 1.92
diff -c -3 -p -r1.92 expmed.c
*** expmed.c	2001/10/11 03:15:33	1.92
--- expmed.c	2001/10/25 13:11:37
*************** expand_shift (code, mode, shifted, amoun
*** 2025,2031 ****
  
  	  if (temp == 0 && GET_CODE (op1) == CONST_INT
  	      && INTVAL (op1) > 0
! 	      && (unsigned int) INTVAL (op1) < GET_MODE_BITSIZE (mode))
  	    temp = expand_binop (mode,
  				 left ? rotr_optab : rotl_optab,
  				 shifted, 
--- 2025,2031 ----
  
  	  if (temp == 0 && GET_CODE (op1) == CONST_INT
  	      && INTVAL (op1) > 0
! 	      && (unsigned HOST_WIDE_INT) INTVAL (op1) < GET_MODE_BITSIZE (mode))
  	    temp = expand_binop (mode,
  				 left ? rotr_optab : rotl_optab,
  				 shifted, 
Index: fold-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.172
diff -c -3 -p -r1.172 fold-const.c
*** fold-const.c	2001/10/21 21:31:59	1.172
--- fold-const.c	2001/10/25 13:11:39
*************** div_and_round_double (code, uns,
*** 683,689 ****
  
  	  /* If quo_est was high by one, then num[i] went negative and
  	     we need to correct things.  */
! 	  if (num[num_hi_sig] < carry)
  	    {
  	      quo_est--;
  	      carry = 0;		/* add divisor back in */
--- 683,690 ----
  
  	  /* If quo_est was high by one, then num[i] went negative and
  	     we need to correct things.  */
! 	  if (num[num_hi_sig] < 0
! 	      || (unsigned HOST_WIDE_INT) num[num_hi_sig] < carry)
  	    {
  	      quo_est--;
  	      carry = 0;		/* add divisor back in */
*************** optimize_bit_field_compare (code, compar
*** 2996,3003 ****
       then will no longer be able to replace it.  */
    linner = get_inner_reference (lhs, &lbitsize, &lbitpos, &offset, &lmode,
  				&lunsignedp, &lvolatilep, &alignment);
!   if (linner == lhs || lbitsize == GET_MODE_BITSIZE (lmode) || lbitsize < 0
!       || offset != 0 || TREE_CODE (linner) == PLACEHOLDER_EXPR)
      return 0;

   if (!const_p)
--- 2997,3007 ----
       then will no longer be able to replace it.  */
    linner = get_inner_reference (lhs, &lbitsize, &lbitpos, &offset, &lmode,
  				&lunsignedp, &lvolatilep, &alignment);
!   if (linner == lhs
!       || lbitsize == (HOST_WIDE_INT) GET_MODE_BITSIZE (lmode)
!       || lbitsize < 0
!       || offset != 0
!       || TREE_CODE (linner) == PLACEHOLDER_EXPR)
      return 0;

   if (!const_p)


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