aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@cygnus.com>2000-08-16 00:56:04 -0700
committerRichard Henderson <rth@gcc.gnu.org>2000-08-16 00:56:04 -0700
commit853d88280aa4989f22b716b55f80b0d36ae5fc27 (patch)
tree063dee2e529b7990805b0203f057fade59de7b59 /gcc/combine.c
parentcbd273a8034166dc9f5c5d2db54d549103d2bf0c (diff)
downloadgcc-853d88280aa4989f22b716b55f80b0d36ae5fc27.zip
gcc-853d88280aa4989f22b716b55f80b0d36ae5fc27.tar.gz
gcc-853d88280aa4989f22b716b55f80b0d36ae5fc27.tar.bz2
combine.c (simplify_shift_const): Revert previous two changes.
* combine.c (simplify_shift_const): Revert previous two changes. If SHIFT_COUNT_TRUNCATED, crop the shift count before the main loop. From-SVN: r35742
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index e4be714..9e7083b 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -8851,6 +8851,14 @@ simplify_shift_const (x, code, result_mode, varop, input_count)
count = input_count;
+ /* Make sure and truncate the "natural" shift on the way in. We don't
+ want to do this inside the loop as it makes it more difficult to
+ combine shifts. */
+#ifdef SHIFT_COUNT_TRUNCATED
+ if (SHIFT_COUNT_TRUNCATED)
+ count %= GET_MODE_BITSIZE (mode);
+#endif
+
/* Unless one of the branches of the `if' in this loop does a `continue',
we will `break' the loop after the `if'. */
@@ -8879,11 +8887,10 @@ simplify_shift_const (x, code, result_mode, varop, input_count)
? result_mode : mode);
/* Handle cases where the count is greater than the size of the mode
- minus 1. If SHIFT_COUNT_TRUNCATED, there aren't really any such
- cases. Otherwise, for ASHIFT, use the size minus one as the count
- (this can occur when simplifying (lshiftrt (ashiftrt ..))). For
- rotates, take the count modulo the size. For other shifts, the
- result is zero.
+ minus 1. For ASHIFT, use the size minus one as the count (this can
+ occur when simplifying (lshiftrt (ashiftrt ..))). For rotates,
+ take the count modulo the size. For other shifts, the result is
+ zero.
Since these shifts are being produced by the compiler by combining
multiple operations, each of which are defined, we know what the
@@ -8891,11 +8898,6 @@ simplify_shift_const (x, code, result_mode, varop, input_count)
if (count > GET_MODE_BITSIZE (shift_mode) - 1)
{
-#ifdef SHIFT_COUNT_TRUNCATED
- if (SHIFT_COUNT_TRUNCATED)
- count %= GET_MODE_BITSIZE (shift_mode);
- else
-#endif
if (code == ASHIFTRT)
count = GET_MODE_BITSIZE (shift_mode) - 1;
else if (code == ROTATE || code == ROTATERT)
@@ -9149,8 +9151,6 @@ simplify_shift_const (x, code, result_mode, varop, input_count)
break;
count += first_count;
- if (count >= GET_MODE_BITSIZE (shift_mode))
- count = GET_MODE_BITSIZE (shift_mode) - 1;
varop = XEXP (varop, 0);
continue;
}
@@ -9204,9 +9204,6 @@ simplify_shift_const (x, code, result_mode, varop, input_count)
else
count = signed_count;
- if (count >= GET_MODE_BITSIZE (shift_mode))
- count = GET_MODE_BITSIZE (shift_mode) - 1;
-
varop = XEXP (varop, 0);
continue;
}