This patch does three things in wide-int:

1) it cleans up some comments.
2) removes a small amount of trash.
3) it changes the max size of the wide int from being 4x of MAX_BITSIZE_MODE_ANY_INT to 2x +1. This should improve large muls and divs as well as perhaps help with some cache behavior.

ok to commit
Index: gcc/wide-int.h
===================================================================
--- gcc/wide-int.h	(revision 205488)
+++ gcc/wide-int.h	(working copy)
@@ -55,10 +55,12 @@ along with GCC; see the file COPYING3.
 
      2) offset_int.  This is a fixed size representation that is
      guaranteed to be large enough to compute any bit or byte sized
-     address calculation on the target.  Currently the value is 64 + 4
-     bits rounded up to the next number even multiple of
+     address calculation on the target.  Currently the value is 64 + 3
+     + 1 bits rounded up to the next number even multiple of
      HOST_BITS_PER_WIDE_INT (but this can be changed when the first
-     port needs more than 64 bits for the size of a pointer).
+     port needs more than 64 bits for the size of a pointer).  The 3
+     bits allow the bits of byte to accessed, the 1 allows any
+     unsigned value to be converted to signed without overflowing.
 
      This flavor can be used for all address math on the target.  In
      this representation, the values are sign or zero extended based
@@ -112,11 +114,11 @@ along with GCC; see the file COPYING3.
    two, the default is the prefered representation.
 
    All three flavors of wide_int are represented as a vector of
-   HOST_WIDE_INTs.  The default and widest_int vectors contain enough elements
-   to hold a value of MAX_BITSIZE_MODE_ANY_INT bits.  offset_int contains only
-   enough elements to hold ADDR_MAX_PRECISION bits.  The values are stored
-   in the vector with the least significant HOST_BITS_PER_WIDE_INT bits
-   in element 0.
+   HOST_WIDE_INTs.  The default and widest_int vectors contain enough
+   elements to hold a value of MAX_BITSIZE_MODE_ANY_INT bits.
+   offset_int contains only enough elements to hold ADDR_MAX_PRECISION
+   bits.  The values are stored in the vector with the least
+   significant HOST_BITS_PER_WIDE_INT bits in element 0.
 
    The default wide_int contains three fields: the vector (VAL),
    the precision and a length (LEN).  The length is the number of HWIs
@@ -223,10 +225,6 @@ along with GCC; see the file COPYING3.
 #include "signop.h"
 #include "insn-modes.h"
 
-#if 0
-#define DEBUG_WIDE_INT
-#endif
-
 /* The MAX_BITSIZE_MODE_ANY_INT is automatically generated by a very
    early examination of the target's mode file.  Thus it is safe that
    some small multiple of this number is easily larger than any number
@@ -235,8 +233,8 @@ along with GCC; see the file COPYING3.
    range of a multiply.  This code needs 2n + 2 bits.  */
 
 #define WIDE_INT_MAX_ELTS \
-  ((4 * MAX_BITSIZE_MODE_ANY_INT + HOST_BITS_PER_WIDE_INT - 1) \
-   / HOST_BITS_PER_WIDE_INT)
+  (((2 * MAX_BITSIZE_MODE_ANY_INT + HOST_BITS_PER_WIDE_INT - 1) \
+    / HOST_BITS_PER_WIDE_INT) + 1)
 
 /* This is the max size of any pointer on any machine.  It does not
    seem to be as easy to sniff this out of the machine description as
Index: gcc/wide-int.cc
===================================================================
--- gcc/wide-int.cc	(revision 205488)
+++ gcc/wide-int.cc	(working copy)
@@ -2090,59 +2090,5 @@ void gt_ggc_mx (widest_int *) { }
 void gt_pch_nx (widest_int *, void (*) (void *, void *), void *) { }
 void gt_pch_nx (widest_int *) { }
 
-/*
- * Private debug printing routines.
- */
-#ifdef DEBUG_WIDE_INT
-/* The debugging routines print results of wide operations into the
-   dump files of the respective passes in which they were called.  */
-static char *
-dumpa (const HOST_WIDE_INT *val, unsigned int len, unsigned int prec, char *buf)
-{
-  int i;
-  unsigned int l;
-  const char * sep = "";
 
-  l = sprintf (buf, "[%d (", prec);
-  for (i = len - 1; i >= 0; i--)
-    {
-      l += sprintf (&buf[l], "%s" HOST_WIDE_INT_PRINT_HEX, sep, val[i]);
-      sep = " ";
-    }
 
-  gcc_assert (len != 0);
-
-  l += sprintf (&buf[l], ")]");
-
-  gcc_assert (l < MAX_SIZE);
-  return buf;
-
-
-}
-#endif
-
-#if 0
-/* The debugging routines print results of wide operations into the
-   dump files of the respective passes in which they were called.  */
-char *
-wide_int_ro::dump (char* buf) const
-{
-  int i;
-  unsigned int l;
-  const char * sep = "";
-
-  l = sprintf (buf, "[%d (", precision);
-  for (i = len - 1; i >= 0; i--)
-    {
-      l += sprintf (&buf[l], "%s" HOST_WIDE_INT_PRINT_HEX, sep, val[i]);
-      sep = " ";
-    }
-
-  gcc_assert (len != 0);
-
-  l += sprintf (&buf[l], ")]");
-
-  gcc_assert (l < MAX_SIZE);
-  return buf;
-}
-#endif

Reply via email to