From aa988991ba0aec1677612c76ca5998460e77891f Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Tue, 16 Nov 1993 07:20:33 +0000 Subject: [PATCH] (force_to_mode): Don't do right-shift in a narrower mode. From-SVN: r6105 --- gcc/combine.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/combine.c b/gcc/combine.c index aed46278c1c..1d22a1358b3 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) -- 2.30.2