diff options
| -rw-r--r-- | gcc/ChangeLog | 5 | ||||
| -rw-r--r-- | gcc/fold-const.c | 20 |
2 files changed, 15 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c181bd7..de4b9fc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2002-01-23 Richard Henderson <rth@redhat.com> + + * fold-const.c (fold): Change UINT_MAX test to check vs precision + rather than TYPE_MAX_VALUE. Fix indentation and a bogus negation. + 2002-01-24 Alexandre Oliva <aoliva@redhat.com> * config/sh/sh.md (symGOT_load, sym2GOT, sym2GOTOFF): New expands. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index dec382d..2f0d4ac 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -6703,7 +6703,7 @@ fold (expr) } else if (TREE_INT_CST_HIGH (arg1) == -1 - && (- TREE_INT_CST_LOW (arg1) + && (TREE_INT_CST_LOW (arg1) == ((unsigned HOST_WIDE_INT) 1 << (width - 1))) && ! TREE_UNSIGNED (TREE_TYPE (arg1))) switch (TREE_CODE (t)) @@ -6729,12 +6729,11 @@ fold (expr) } else if (TREE_INT_CST_HIGH (arg1) == 0 - && (TREE_INT_CST_LOW (arg1) - == ((unsigned HOST_WIDE_INT) 1 << (width - 1)) - 1) - && TREE_UNSIGNED (TREE_TYPE (arg1)) - /* signed_type does not work on pointer types. */ - && INTEGRAL_TYPE_P (TREE_TYPE (arg1))) - + && (TREE_INT_CST_LOW (arg1) + == ((unsigned HOST_WIDE_INT) 1 << (width - 1)) - 1) + && TREE_UNSIGNED (TREE_TYPE (arg1)) + /* signed_type does not work on pointer types. */ + && INTEGRAL_TYPE_P (TREE_TYPE (arg1))) switch (TREE_CODE (t)) { case LE_EXPR: @@ -6754,9 +6753,10 @@ fold (expr) break; } - else if (TREE_UNSIGNED (TREE_TYPE (arg1)) - && tree_int_cst_equal (TYPE_MAX_VALUE (TREE_TYPE (arg1)), - arg1)) + else if (TREE_INT_CST_HIGH (arg1) == 0 + && (TREE_INT_CST_LOW (arg1) + == ((unsigned HOST_WIDE_INT) 2 << (width - 1)) - 1) + && TREE_UNSIGNED (TREE_TYPE (arg1))) switch (TREE_CODE (t)) { case GT_EXPR: |
