aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@cygnus.com>2000-08-11 00:38:23 -0700
committerRichard Henderson <rth@gcc.gnu.org>2000-08-11 00:38:23 -0700
commitf94d0f60d36612acccb50ac4bae4aac9c396c1bc (patch)
tree1fb34c9abf221449b5620ee029b478dfd9dbae9b /gcc/combine.c
parent9c683c2adc2f3607bf63998f060d1ed2b7791cfd (diff)
downloadgcc-f94d0f60d36612acccb50ac4bae4aac9c396c1bc.zip
gcc-f94d0f60d36612acccb50ac4bae4aac9c396c1bc.tar.gz
gcc-f94d0f60d36612acccb50ac4bae4aac9c396c1bc.tar.bz2
* combine.c (simplify_shift_const): Obey SHIFT_COUNT_TRUNCATED.
From-SVN: r35622
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index e424317..4ad2f4f 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -8879,10 +8879,11 @@ 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. 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. 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.
Since these shifts are being produced by the compiler by combining
multiple operations, each of which are defined, we know what the
@@ -8890,6 +8891,11 @@ 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)