]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* double-int.h (double_int_and): New.
authoraesok <aesok@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 25 May 2010 19:48:40 +0000 (19:48 +0000)
committeraesok <aesok@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 25 May 2010 19:48:40 +0000 (19:48 +0000)
* combine.c (try_combine): Clean up, use double_int_* and
immed_double_int_const functions.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159842 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/combine.c
gcc/double-int.h

index f336b1137847503602c0c44255b4932a932b454c..9476e77f74a1883bbeacc1670979b8e10e99ee20 100644 (file)
@@ -1,3 +1,9 @@
+2010-05-25  Anatoly Sokolov  <aesok@post.ru>
+
+       * double-int.h (double_int_and): New.
+       * combine.c (try_combine): Clean up, use double_int_* and
+       immed_double_int_const functions.
+
 2010-05-25  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * configure.ac (gcc_cv_as_ld_jalr_reloc): Redirect grep stdout,
index 2e81efcb0274c92c2e244d3b3bf12ccc4ec3d5b4..9809565a77c46983d700fd8aad482c4a4d304310 100644 (file)
@@ -2595,74 +2595,20 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p)
 
       if (offset >= 0
          && (GET_MODE_BITSIZE (GET_MODE (SET_DEST (temp)))
-             <= HOST_BITS_PER_WIDE_INT * 2))
+             <= HOST_BITS_PER_DOUBLE_INT))
        {
-         HOST_WIDE_INT mhi, ohi, ihi;
-         HOST_WIDE_INT mlo, olo, ilo;
+         double_int m, o, i;
          rtx inner = SET_SRC (PATTERN (i3));
          rtx outer = SET_SRC (temp);
 
-         if (CONST_INT_P (outer))
-           {
-             olo = INTVAL (outer);
-             ohi = olo < 0 ? -1 : 0;
-           }
-         else
-           {
-             olo = CONST_DOUBLE_LOW (outer);
-             ohi = CONST_DOUBLE_HIGH (outer);
-           }
-
-         if (CONST_INT_P (inner))
-           {
-             ilo = INTVAL (inner);
-             ihi = ilo < 0 ? -1 : 0;
-           }
-         else
-           {
-             ilo = CONST_DOUBLE_LOW (inner);
-             ihi = CONST_DOUBLE_HIGH (inner);
-           }
-
-         if (width < HOST_BITS_PER_WIDE_INT)
-           {
-             mlo = ((unsigned HOST_WIDE_INT) 1 << width) - 1;
-             mhi = 0;
-           }
-         else if (width < HOST_BITS_PER_WIDE_INT * 2)
-           {
-             mhi = ((unsigned HOST_WIDE_INT) 1
-                    << (width - HOST_BITS_PER_WIDE_INT)) - 1;
-             mlo = -1;
-           }
-         else
-           {
-             mlo = -1;
-             mhi = -1;
-           }
-
-         ilo &= mlo;
-         ihi &= mhi;
-
-         if (offset >= HOST_BITS_PER_WIDE_INT)
-           {
-             mhi = mlo << (offset - HOST_BITS_PER_WIDE_INT);
-             mlo = 0;
-             ihi = ilo << (offset - HOST_BITS_PER_WIDE_INT);
-             ilo = 0;
-           }
-         else if (offset > 0)
-           {
-             mhi = (mhi << offset) | ((unsigned HOST_WIDE_INT) mlo
-                                      >> (HOST_BITS_PER_WIDE_INT - offset));
-             mlo = mlo << offset;
-             ihi = (ihi << offset) | ((unsigned HOST_WIDE_INT) ilo
-                                      >> (HOST_BITS_PER_WIDE_INT - offset));
-             ilo = ilo << offset;
-           }
+         o = rtx_to_double_int (outer);
+         i = rtx_to_double_int (inner);
 
-         olo = (olo & ~mlo) | ilo;
-         ohi = (ohi & ~mhi) | ihi;
+         m = double_int_mask (width);
+         i = double_int_and (i, m);
+         m = double_int_lshift (m, offset, HOST_BITS_PER_DOUBLE_INT, false);
+         i = double_int_lshift (i, offset, HOST_BITS_PER_DOUBLE_INT, false);
+         o = double_int_ior (double_int_and (o, double_int_not (m)), i);
 
          combine_merges++;
          subst_insn = i3;
@@ -2675,7 +2621,7 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p)
             resulting insn the new pattern for I3.  Then skip to where we
             validate the pattern.  Everything was set up above.  */
          SUBST (SET_SRC (temp),
-                immed_double_const (olo, ohi, GET_MODE (SET_DEST (temp))));
+                immed_double_int_const (o, GET_MODE (SET_DEST (temp))));
 
          newpat = PATTERN (i2);
 
index 370f61965c9acdfce2d19248d713160ca18dac36..c13b112d496b5722e6de775f919a627a01aff38e 100644 (file)
@@ -147,6 +147,16 @@ double_int_ior (double_int a, double_int b)
   return a;
 }
 
+/* Returns A & B.  */
+
+static inline double_int
+double_int_and (double_int a, double_int b)
+{
+  a.low &= b.low;
+  a.high &= b.high;
+  return a;
+}
+
 /* Shift operations.  */
 double_int double_int_lshift (double_int, HOST_WIDE_INT, unsigned int, bool);
 double_int double_int_rshift (double_int, HOST_WIDE_INT, unsigned int, bool);