diff options
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 6506ae7..1e0e7e5 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -3740,8 +3740,7 @@ sign_bit_p (tree exp, const_tree val) hi = (unsigned HOST_WIDE_INT) 1 << (width - HOST_BITS_PER_WIDE_INT - 1); lo = 0; - mask_hi = ((unsigned HOST_WIDE_INT) -1 - >> (HOST_BITS_PER_DOUBLE_INT - width)); + mask_hi = (HOST_WIDE_INT_M1U >> (HOST_BITS_PER_DOUBLE_INT - width)); mask_lo = -1; } else @@ -3750,8 +3749,7 @@ sign_bit_p (tree exp, const_tree val) lo = (unsigned HOST_WIDE_INT) 1 << (width - 1); mask_hi = 0; - mask_lo = ((unsigned HOST_WIDE_INT) -1 - >> (HOST_BITS_PER_WIDE_INT - width)); + mask_lo = (HOST_WIDE_INT_M1U >> (HOST_BITS_PER_WIDE_INT - width)); } /* We mask off those bits beyond TREE_TYPE (exp) so that we can @@ -4325,7 +4323,7 @@ build_range_check (location_t loc, tree type, tree exp, int in_p, else { hi = ((HOST_WIDE_INT) 1 << (prec - HOST_BITS_PER_WIDE_INT - 1)) - 1; - lo = (unsigned HOST_WIDE_INT) -1; + lo = HOST_WIDE_INT_M1U; } if (TREE_INT_CST_HIGH (high) == hi && TREE_INT_CST_LOW (high) == lo) @@ -8096,7 +8094,7 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0) unsigned HOST_WIDE_INT cst; cst = tree_low_cst (and1, 1); - cst &= (HOST_WIDE_INT) -1 + cst &= HOST_WIDE_INT_M1U << (TYPE_PRECISION (TREE_TYPE (and1)) - 1); change = (cst == 0); #ifdef LOAD_EXTEND_OP @@ -11277,7 +11275,7 @@ fold_binary_loc (location_t loc, w <<= 1) { unsigned HOST_WIDE_INT mask - = (unsigned HOST_WIDE_INT) -1 >> (HOST_BITS_PER_WIDE_INT - w); + = HOST_WIDE_INT_M1U >> (HOST_BITS_PER_WIDE_INT - w); if (((c1.low | c2.low) & mask) == mask && (c1.low & ~mask) == 0 && c1.high == 0) { @@ -12297,7 +12295,7 @@ fold_binary_loc (location_t loc, /* X / -1 is -X. */ if (!TYPE_UNSIGNED (type) && TREE_CODE (arg1) == INTEGER_CST - && TREE_INT_CST_LOW (arg1) == (unsigned HOST_WIDE_INT) -1 + && TREE_INT_CST_LOW (arg1) == HOST_WIDE_INT_M1U && TREE_INT_CST_HIGH (arg1) == -1) return fold_convert_loc (loc, type, negate_expr (arg0)); @@ -12380,7 +12378,7 @@ fold_binary_loc (location_t loc, /* X % -1 is zero. */ if (!TYPE_UNSIGNED (type) && TREE_CODE (arg1) == INTEGER_CST - && TREE_INT_CST_LOW (arg1) == (unsigned HOST_WIDE_INT) -1 + && TREE_INT_CST_LOW (arg1) == HOST_WIDE_INT_M1U && TREE_INT_CST_HIGH (arg1) == -1) return omit_one_operand_loc (loc, type, integer_zero_node, arg0); @@ -13535,7 +13533,7 @@ fold_binary_loc (location_t loc, else { max_lo = signed_max_lo; - min_lo = ((unsigned HOST_WIDE_INT) -1 << (width - 1)); + min_lo = (HOST_WIDE_INT_M1U << (width - 1)); min_hi = -1; } } @@ -13556,7 +13554,7 @@ fold_binary_loc (location_t loc, else { max_hi = signed_max_hi; - min_hi = ((unsigned HOST_WIDE_INT) -1 << (width - 1)); + min_hi = (HOST_WIDE_INT_M1U << (width - 1)); } } @@ -14175,24 +14173,24 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type, if (outer_width > HOST_BITS_PER_WIDE_INT) { - mask_hi = ((unsigned HOST_WIDE_INT) -1 + mask_hi = (HOST_WIDE_INT_M1U >> (HOST_BITS_PER_DOUBLE_INT - outer_width)); mask_lo = -1; } else { mask_hi = 0; - mask_lo = ((unsigned HOST_WIDE_INT) -1 + mask_lo = (HOST_WIDE_INT_M1U >> (HOST_BITS_PER_WIDE_INT - outer_width)); } if (inner_width > HOST_BITS_PER_WIDE_INT) { - mask_hi &= ~((unsigned HOST_WIDE_INT) -1 + mask_hi &= ~(HOST_WIDE_INT_M1U >> (HOST_BITS_PER_WIDE_INT - inner_width)); mask_lo = 0; } else - mask_lo &= ~((unsigned HOST_WIDE_INT) -1 + mask_lo &= ~(HOST_WIDE_INT_M1U >> (HOST_BITS_PER_WIDE_INT - inner_width)); if ((TREE_INT_CST_HIGH (arg1) & mask_hi) == mask_hi |