aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-11-16 07:20:33 +0000
committerRichard Stallman <rms@gnu.org>1993-11-16 07:20:33 +0000
commitaa988991ba0aec1677612c76ca5998460e77891f (patch)
tree10e41fdd7294ac9e9f0f2a9815128fe3abea46a8
parent02b35b12a61e894e1fb1b6e98dbf9577049aa792 (diff)
downloadgcc-aa988991ba0aec1677612c76ca5998460e77891f.zip
gcc-aa988991ba0aec1677612c76ca5998460e77891f.tar.gz
gcc-aa988991ba0aec1677612c76ca5998460e77891f.tar.bz2
(force_to_mode): Don't do right-shift in a narrower mode.
From-SVN: r6105
-rw-r--r--gcc/combine.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index aed4627..1d22a13 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -5608,6 +5608,11 @@ force_to_mode (x, mode, mask, reg)
&& (code_to_optab[(int) code]->handlers[(int) mode].insn_code
!= CODE_FOR_nothing))
? mode : GET_MODE (x));
+ /* It is not valid to do a right-shift in a narrower mode
+ than the one it came in with. */
+ if ((code == LSHIFTRT || code == ASHIFTRT)
+ && GET_MODE_BITSIZE (mode) < GET_MODE_BITSIZE (GET_MODE (x)))
+ op_mode = GET_MODE (x);
/* Truncate MASK to fit OP_MODE. */
if (op_mode)