diff options
| author | aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-05-06 19:51:19 +0000 |
|---|---|---|
| committer | aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-05-06 19:51:19 +0000 |
| commit | 9c3da43679ff7a148bb3c0f5c3df5ef04aea31e7 (patch) | |
| tree | d1e8dd7125f97466a3b431c8620b350ef00f92f6 | |
| parent | 0dc08e9712c7516030972d73a473b4d477edbbdd (diff) | |
| download | ppe42-gcc-9c3da43679ff7a148bb3c0f5c3df5ef04aea31e7.tar.gz ppe42-gcc-9c3da43679ff7a148bb3c0f5c3df5ef04aea31e7.zip | |
* unroll.c (loop_iterations): Don't sign-extend abs_diff;
zero-extend it. Make abs_inc unsigned.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@41886 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 3 | ||||
| -rw-r--r-- | gcc/unroll.c | 24 |
2 files changed, 20 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9074e177d29..194bcc4148a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,8 @@ 2001-05-06 Alexandre Oliva <aoliva@redhat.com> + * unroll.c (loop_iterations): Don't sign-extend abs_diff; + zero-extend it. Make abs_inc unsigned. + * optabs.c (expand_binop): Sign-extend xop0 and xop1 from the widest mode in narrowing and widening operations. diff --git a/gcc/unroll.c b/gcc/unroll.c index a0ffa956f23..71c96f68987 100644 --- a/gcc/unroll.c +++ b/gcc/unroll.c @@ -3451,7 +3451,8 @@ loop_iterations (loop) rtx comparison, comparison_value; rtx iteration_var, initial_value, increment, final_value; enum rtx_code comparison_code; - HOST_WIDE_INT abs_inc; + HOST_WIDE_INT inc; + unsigned HOST_WIDE_INT abs_inc; unsigned HOST_WIDE_INT abs_diff; int off_by_one; int increment_dir; @@ -3951,18 +3952,27 @@ loop_iterations (loop) so correct for that. Note that abs_diff and n_iterations are unsigned, because they can be as large as 2^n - 1. */ - abs_inc = INTVAL (increment); - if (abs_inc > 0) - abs_diff = INTVAL (final_value) - INTVAL (initial_value); - else if (abs_inc < 0) + inc = INTVAL (increment); + if (inc > 0) + { + abs_diff = INTVAL (final_value) - INTVAL (initial_value); + abs_inc = inc; + } + else if (inc < 0) { abs_diff = INTVAL (initial_value) - INTVAL (final_value); - abs_inc = -abs_inc; + abs_inc = -inc; } else abort (); - abs_diff = trunc_int_for_mode (abs_diff, GET_MODE (iteration_var)); + /* Given that iteration_var is going to iterate over its own mode, + not HOST_WIDE_INT, disregard higher bits that might have come + into the picture due to sign extension of initial and final + values. */ + abs_diff &= ((unsigned HOST_WIDE_INT)1 + << (GET_MODE_BITSIZE (GET_MODE (iteration_var)) - 1) + << 1) - 1; /* For NE tests, make sure that the iteration variable won't miss the final value. If abs_diff mod abs_incr is not zero, then the |

