]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
combine.c (force_to_mode): Use gen_int_mode.
authorJakub Jelinek <jakub@redhat.com>
Thu, 23 May 2002 08:14:35 +0000 (10:14 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 23 May 2002 08:14:35 +0000 (10:14 +0200)
* combine.c (force_to_mode): Use gen_int_mode.
Don't clear CONST_INT bits outside of mode.

* gcc.dg/20020517-1.c: New test.

From-SVN: r53777

gcc/ChangeLog
gcc/combine.c
gcc/testsuite/ChangeLog

index dd269fa9485897c72a6e31a6a9c96da975610a76..65a5ed22b00ce291fda54c7f6299b47242fa3ef2 100644 (file)
@@ -1,3 +1,8 @@
+2002-05-23  Jakub Jelinek  <jakub@redhat.com>
+
+       * combine.c (force_to_mode): Use gen_int_mode.
+       Don't clear CONST_INT bits outside of mode.
+
 2002-05-23  Jakub Jelinek  <jakub@redhat.com>
 
        * configure.in: Fix as version test for binutils 2.12.1 releases
index bb22b0cdfb8cb5ee3eadbf21195b26663724b9be..44bcdee6c190682a51b670e22bc828c8dcbbd596 100644 (file)
@@ -6697,18 +6697,7 @@ force_to_mode (x, mode, mask, reg, just_select)
   /* If X is a CONST_INT, return a new one.  Do this here since the
      test below will fail.  */
   if (GET_CODE (x) == CONST_INT)
-    {
-      HOST_WIDE_INT cval = INTVAL (x) & mask;
-      int width = GET_MODE_BITSIZE (mode);
-
-      /* If MODE is narrower that HOST_WIDE_INT and CVAL is a negative
-        number, sign extend it.  */
-      if (width > 0 && width < HOST_BITS_PER_WIDE_INT
-         && (cval & ((HOST_WIDE_INT) 1 << (width - 1))) != 0)
-       cval |= (HOST_WIDE_INT) -1 << width;
-
-      return GEN_INT (cval);
-    }
+    return gen_int_mode (INTVAL (x) & mask, mode);
 
   /* If X is narrower than MODE and we want all the bits in X's mode, just
      get X in the proper mode.  */
@@ -6914,14 +6903,6 @@ force_to_mode (x, mode, mask, reg, just_select)
                                     force_to_mode (XEXP (x, 1), mode, mask,
                                                    reg, next_select));
 
-      /* If OP1 is a CONST_INT and X is an IOR or XOR, clear bits outside
-        MASK since OP1 might have been sign-extended but we never want
-        to turn on extra bits, since combine might have previously relied
-        on them being off.  */
-      if (GET_CODE (op1) == CONST_INT && (code == IOR || code == XOR)
-         && (INTVAL (op1) & mask) != 0)
-       op1 = GEN_INT (INTVAL (op1) & mask);
-
       if (op_mode != GET_MODE (x) || op0 != XEXP (x, 0) || op1 != XEXP (x, 1))
        x = gen_binary (code, op_mode, op0, op1);
       break;
index 52c4b08c3bf3db8a1dbbbb96dbb57665f6fb3c92..cc2e3e8d9803c41a0fbfab1f5b8bfd191139acaf 100644 (file)
@@ -1,3 +1,7 @@
+2002-05-23  Jakub Jelinek  <jakub@redhat.com>
+
+       * gcc.dg/20020517-1.c: New test.
+
 2002-05-22  Andreas Jaeger  <aj@suse.de>
 
        * gcc.c-torture/execute/loop-2c.x: Remove, the test should pass