(force_to_mode): Don't do right-shift in a narrower mode.
authorRichard Stallman <rms@gnu.org>
Tue, 16 Nov 1993 07:20:33 +0000 (07:20 +0000)
committerRichard Stallman <rms@gnu.org>
Tue, 16 Nov 1993 07:20:33 +0000 (07:20 +0000)
From-SVN: r6105

gcc/combine.c

index aed46278c1c5a5cfd315f533037a94ef52539761..1d22a1358b398a02fadbd9731820f7956b374995 100644 (file)
@@ -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)