aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-05-28 22:40:33 +0000
committerRichard Stallman <rms@gnu.org>1993-05-28 22:40:33 +0000
commit4908e5087063c4b310ab617e09230ad65f294efa (patch)
treec53397c415bb439d866469528a44736105a4917b
parent4d01c30fb52de3af8ebfda893e84a61563f6b78a (diff)
downloadgcc-4908e5087063c4b310ab617e09230ad65f294efa.zip
gcc-4908e5087063c4b310ab617e09230ad65f294efa.tar.gz
gcc-4908e5087063c4b310ab617e09230ad65f294efa.tar.bz2
(fold_rtx): Correct check for associating shifts and ending up with a shift count too large...
(fold_rtx): Correct check for associating shifts and ending up with a shift count too large; convert to the largest valid for ASHIFTRT and don't fold all others. From-SVN: r4585
-rw-r--r--gcc/cse.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index 3d2702f..8ae9714 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -5283,13 +5283,21 @@ fold_rtx (x, insn)
break;
/* If we are associating shift operations, don't let this
- produce a shift of larger than the object. This could
- occur when we following a sign-extend by a right shift on
- a machine that does a sign-extend as a pair of shifts. */
+ produce a shift of the size of the object or larger.
+ This could occur when we follow a sign-extend by a right
+ shift on a machine that does a sign-extend as a pair
+ of shifts. */
if (is_shift && GET_CODE (new_const) == CONST_INT
- && INTVAL (new_const) > GET_MODE_BITSIZE (mode))
- break;
+ && INTVAL (new_const) >= GET_MODE_BITSIZE (mode))
+ {
+ /* As an exception, we can turn an ASHIFTRT of this
+ form into a shift of the number of bits - 1. */
+ if (code == ASHIFTRT)
+ new_const = GEN_INT (GET_MODE_BITSIZE (mode) - 1);
+ else
+ break;
+ }
y = copy_rtx (XEXP (y, 0));