]> gcc.gnu.org Git - gcc.git/commitdiff
fold-const.c (lshift-double): Cast the high word to an unsigned HOST_WIDE_INT when...
authorRoger Sayle <roger@eyesopen.com>
Mon, 6 May 2002 16:59:18 +0000 (16:59 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Mon, 6 May 2002 16:59:18 +0000 (16:59 +0000)
* 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
gcc/fold-const.c

index bb742b6dd88901863b6aa3193a226d8760693511..89afcc7b3cde24aee9131ff085c06985b0ac7ff8 100644 (file)
@@ -1,3 +1,11 @@
+2002-05-06  Roger Sayle  <roger@eyesopen.com>
+
+       * 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  <law@redhat.com>
 
        * pa-protos.h (hppa_fpstore_bypass_p): Declare.
index 084308ec9fa502077144884eca117c86480fc3ea..9142f3d80dc78db5f390e5630094407c2443a724 100644 (file)
@@ -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))))
        {
This page took 0.076143 seconds and 5 git commands to generate.