From 0316d49bf1e8f3e829bea90f911116bfb4bcf62f Mon Sep 17 00:00:00 2001 From: Roger Sayle Date: Mon, 6 May 2002 16:59:18 +0000 Subject: [PATCH] fold-const.c (lshift-double): Cast the high word to an unsigned HOST_WIDE_INT when... * fold-const.c (lshift-double): Cast the high word to an unsigned HOST_WIDE_INT when extracting sign bit to avoid compiler warning. (div_and_round_double): Cast carry to a signed HOST_WIDE_INT to avoid compiler warning. (fold): Remove redundant code from BIT_AND_EXPR as integer operands are canonicalized to be arg1. From-SVN: r53228 --- gcc/ChangeLog | 8 ++++++++ gcc/fold-const.c | 16 +++------------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bb742b6..89afcc7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2002-05-06 Roger Sayle + + * fold-const.c (lshift-double): Cast the high word to an unsigned + HOST_WIDE_INT when extracting sign bit to avoid compiler warning. + (div_and_round_double): Cast carry to a signed HOST_WIDE_INT to + avoid compiler warning. (fold): Remove redundant code from + BIT_AND_EXPR as integer operands are canonicalized to be arg1. + 2002-05-06 Jeff Law * pa-protos.h (hppa_fpstore_bypass_p): Declare. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 084308e..9142f3d 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -411,7 +411,8 @@ lshift_double (l1, h1, count, prec, lv, hv, arith) /* Sign extend all bits that are beyond the precision. */ signmask = -((prec > HOST_BITS_PER_WIDE_INT - ? (*hv >> (prec - HOST_BITS_PER_WIDE_INT - 1)) + ? ((unsigned HOST_WIDE_INT) *hv + >> (prec - HOST_BITS_PER_WIDE_INT - 1)) : (*lv >> (prec - 1))) & 1); if (prec >= 2 * HOST_BITS_PER_WIDE_INT) @@ -717,7 +718,7 @@ div_and_round_double (code, uns, /* If quo_est was high by one, then num[i] went negative and we need to correct things. */ - if (num[num_hi_sig] < carry) + if (num[num_hi_sig] < (HOST_WIDE_INT) carry) { quo_est--; carry = 0; /* add divisor back in */ @@ -5339,17 +5340,6 @@ fold (expr) if (t1 != NULL_TREE) return t1; /* Simplify ((int)c & 0x377) into (int)c, if c is unsigned char. */ - if (TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == NOP_EXPR - && TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (arg1, 0)))) - { - unsigned int prec - = TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (arg1, 0))); - - if (prec < BITS_PER_WORD && prec < HOST_BITS_PER_WIDE_INT - && (~TREE_INT_CST_LOW (arg0) - & (((HOST_WIDE_INT) 1 << prec) - 1)) == 0) - return build1 (NOP_EXPR, type, TREE_OPERAND (arg1, 0)); - } if (TREE_CODE (arg1) == INTEGER_CST && TREE_CODE (arg0) == NOP_EXPR && TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (arg0, 0)))) { -- 2.7.4