combine.c (try_combine): Fix SUBREG setting for HOST_BITS_PER_WIDE_INT >= 2 * BITS_PE...
authorAlexandre Oliva <aoliva@redhat.com>
Tue, 30 Jan 2001 22:27:44 +0000 (22:27 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Tue, 30 Jan 2001 22:27:44 +0000 (22:27 +0000)
* combine.c (try_combine): Fix SUBREG setting for
HOST_BITS_PER_WIDE_INT >= 2 * BITS_PER_WORD.

From-SVN: r39355

gcc/ChangeLog
gcc/combine.c

index 22c5b2d1ccc67265478e2f2b7d29b47e5d1d5b01..abc714195af418458c73f35269cf1b03d07fa89b 100644 (file)
@@ -1,3 +1,8 @@
+2001-01-30  Alexandre Oliva  <aoliva@redhat.com>
+
+       * combine.c (try_combine): Fix SUBREG setting for
+       HOST_BITS_PER_WIDE_INT >= 2 * BITS_PER_WORD.
+
 2001-01-30  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>
 
        * jump.c (comparison_dominates_p): Don't try to handle UNKNOWN
index 9b721af4df4d96ff0dccf526adc77e8c210dd28c..74b02b55a472a99cd56a68b94950dac85a95a2e1 100644 (file)
@@ -1661,9 +1661,32 @@ try_combine (i3, i2, i1, new_direct_jump_p)
        }
 
       if (subreg_lowpart_p (SET_DEST (PATTERN (i3))))
-       lo = INTVAL (SET_SRC (PATTERN (i3)));
-      else
+       {
+         /* We don't handle the case of the target word being wider
+            than a host wide int.  */
+         if (HOST_BITS_PER_WIDE_INT < BITS_PER_WORD)
+           abort ();
+
+         lo &= ~(((unsigned HOST_WIDE_INT)1 << BITS_PER_WORD) - 1);
+         lo |= INTVAL (SET_SRC (PATTERN (i3)));
+       }
+      else if (HOST_BITS_PER_WIDE_INT == BITS_PER_WORD)
        hi = INTVAL (SET_SRC (PATTERN (i3)));
+      else if (HOST_BITS_PER_WIDE_INT >= 2 * BITS_PER_WORD)
+       {
+         int sign = -(int) ((unsigned HOST_WIDE_INT) lo
+                            >> (HOST_BITS_PER_WIDE_INT - 1));
+
+         lo &= ~((((unsigned HOST_WIDE_INT)1 << BITS_PER_WORD) - 1)
+                 << BITS_PER_WORD);
+         lo |= INTVAL (SET_SRC (PATTERN (i3))) << BITS_PER_WORD;
+         if (hi == sign)
+           hi = lo < 0 ? -1 : 0;
+       }
+      else
+       /* We don't handle the case of the higher word not fitting
+          entirely in either hi or lo.  */
+       abort ();
 
       combine_merges++;
       subst_insn = i3;