Re: patch to fix constant math - second small patch -patch ping for next stage 1

2013-03-28 Thread Kenneth Zadeck

committed as revision 197200.

kenny


On 03/27/2013 11:07 AM, Richard Biener wrote:

On Wed, Mar 27, 2013 at 3:23 PM, Kenneth Zadeck
 wrote:

On 03/27/2013 10:18 AM, Richard Biener wrote:

On Wed, Feb 27, 2013 at 1:27 AM, Kenneth Zadeck
 wrote:

Here is the second of my wide int patches with the patch rot removed.

I would like to get these pre approved for the next stage 1.
On 10/05/2012 06:48 PM, Kenneth Zadeck wrote:

This patch adds machinery to genmodes.c so that largest possible sizes
of
various data structures can be determined at gcc build time. These
functions
create 3 symbols that are available in insn-modes.h:
MAX_BITSIZE_MODE_INT - the bitsize of the largest int.
MAX_BITSIZE_MODE_PARTIAL_INT - the bitsize of the largest partial int.
MAX_BITSIZE_MODE_ANY_INT - the largest bitsize of any kind of int.

I remember we have discussed about the need to special-case/handle partial
integer modes.  Do further patches use the _INT and _PARTIAL_INT sizes
at all?  I'm fine with providing MAX_BITSIZE_MODE_ANY_INT.

i do not believe that in the end, those two ended up getting used.i can
remove them if you want.

Yes please.  Ok with that change.

Richard.


kenny


Richard.






Re: patch to fix constant math - second small patch -patch ping for next stage 1

2013-03-27 Thread Richard Biener
On Wed, Mar 27, 2013 at 3:23 PM, Kenneth Zadeck
 wrote:
>
> On 03/27/2013 10:18 AM, Richard Biener wrote:
>>
>> On Wed, Feb 27, 2013 at 1:27 AM, Kenneth Zadeck
>>  wrote:
>>>
>>> Here is the second of my wide int patches with the patch rot removed.
>>>
>>> I would like to get these pre approved for the next stage 1.
>>> On 10/05/2012 06:48 PM, Kenneth Zadeck wrote:

 This patch adds machinery to genmodes.c so that largest possible sizes
 of
 various data structures can be determined at gcc build time. These
 functions
 create 3 symbols that are available in insn-modes.h:
 MAX_BITSIZE_MODE_INT - the bitsize of the largest int.
 MAX_BITSIZE_MODE_PARTIAL_INT - the bitsize of the largest partial int.
 MAX_BITSIZE_MODE_ANY_INT - the largest bitsize of any kind of int.
>>
>> I remember we have discussed about the need to special-case/handle partial
>> integer modes.  Do further patches use the _INT and _PARTIAL_INT sizes
>> at all?  I'm fine with providing MAX_BITSIZE_MODE_ANY_INT.
>
> i do not believe that in the end, those two ended up getting used.i can
> remove them if you want.

Yes please.  Ok with that change.

Richard.

> kenny
>>
>>
>> Richard.
>
>


Re: patch to fix constant math - second small patch -patch ping for next stage 1

2013-03-27 Thread Kenneth Zadeck


On 03/27/2013 10:18 AM, Richard Biener wrote:

On Wed, Feb 27, 2013 at 1:27 AM, Kenneth Zadeck
 wrote:

Here is the second of my wide int patches with the patch rot removed.

I would like to get these pre approved for the next stage 1.
On 10/05/2012 06:48 PM, Kenneth Zadeck wrote:

This patch adds machinery to genmodes.c so that largest possible sizes of
various data structures can be determined at gcc build time. These functions
create 3 symbols that are available in insn-modes.h:
MAX_BITSIZE_MODE_INT - the bitsize of the largest int.
MAX_BITSIZE_MODE_PARTIAL_INT - the bitsize of the largest partial int.
MAX_BITSIZE_MODE_ANY_INT - the largest bitsize of any kind of int.

I remember we have discussed about the need to special-case/handle partial
integer modes.  Do further patches use the _INT and _PARTIAL_INT sizes
at all?  I'm fine with providing MAX_BITSIZE_MODE_ANY_INT.
i do not believe that in the end, those two ended up getting used.i 
can remove them if you want.


kenny


Richard.




Re: patch to fix constant math - second small patch -patch ping for next stage 1

2013-03-27 Thread Richard Biener
On Wed, Feb 27, 2013 at 1:27 AM, Kenneth Zadeck
 wrote:
> Here is the second of my wide int patches with the patch rot removed.
>
> I would like to get these pre approved for the next stage 1.
> On 10/05/2012 06:48 PM, Kenneth Zadeck wrote:
>>
>> This patch adds machinery to genmodes.c so that largest possible sizes of
>> various data structures can be determined at gcc build time. These functions
>> create 3 symbols that are available in insn-modes.h:
>> MAX_BITSIZE_MODE_INT - the bitsize of the largest int.
>> MAX_BITSIZE_MODE_PARTIAL_INT - the bitsize of the largest partial int.
>> MAX_BITSIZE_MODE_ANY_INT - the largest bitsize of any kind of int.

I remember we have discussed about the need to special-case/handle partial
integer modes.  Do further patches use the _INT and _PARTIAL_INT sizes
at all?  I'm fine with providing MAX_BITSIZE_MODE_ANY_INT.

Richard.


Re: patch to fix constant math - second small patch -patch ping for next stage 1

2013-02-26 Thread Kenneth Zadeck

Here is the second of my wide int patches with the patch rot removed.

I would like to get these pre approved for the next stage 1.
On 10/05/2012 06:48 PM, Kenneth Zadeck wrote:
This patch adds machinery to genmodes.c so that largest possible sizes 
of various data structures can be determined at gcc build time. These 
functions create 3 symbols that are available in insn-modes.h:

MAX_BITSIZE_MODE_INT - the bitsize of the largest int.
MAX_BITSIZE_MODE_PARTIAL_INT - the bitsize of the largest partial int.
MAX_BITSIZE_MODE_ANY_INT - the largest bitsize of any kind of int.


2013-2-26  Kenneth Zadeck 

* genmodes.c (emit_max_int): New function.
(emit_insn_modes_h): Added call to emit_max_function.
* doc/rtl.texi (MAX_BITSIZE_MODE_INT, MAX_BITSIZE_MODE_PARTIAL_INT,
MAX_BITSIZE_MODE_ANY_INT, MAX_BITSIZE_MODE_ANY_MODE): Added doc.
* machmode.def: Fixed comment.
diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi
index b0b0723..095a642 100644
--- a/gcc/doc/rtl.texi
+++ b/gcc/doc/rtl.texi
@@ -1456,6 +1456,28 @@ Returns the number of units contained in a mode, i.e.,
 Returns the narrowest mode in mode class @var{c}.
 @end table
 
+The following 4 variables are defined on every target.   They can be
+used to allocate buffers that are guaranteed to be large enough to
+hold any value that can be represented on the target.   
+
+@table @code
+@findex MAX_BITSIZE_MODE_INT
+@item MAX_BITSIZE_MODE_INT
+The bitsize of the largest integer mode defined on the target.
+
+@findex MAX_BITSIZE_MODE_PARTIAL_INT
+@item MAX_BITSIZE_MODE_PARTIAL_INT
+The bitsize of the largest partial integer mode defined on the target.
+
+@findex MAX_BITSIZE_MODE_ANY_INT
+@item MAX_BITSIZE_MODE_ANY_INT
+The maximum of MAX_BITSIZE_MODE_INT and MAX_BITSIZE_MODE_PARTIAL_INT.
+
+@findex MAX_BITSIZE_MODE_ANY_MODE
+@item MAX_BITSIZE_MODE_ANY_MODE
+The bitsize of the largest mode on the target.   
+@end table
+
 @findex byte_mode
 @findex word_mode
 The global variables @code{byte_mode} and @code{word_mode} contain modes
diff --git a/gcc/genmodes.c b/gcc/genmodes.c
index 9907d69..f822dcd 100644
--- a/gcc/genmodes.c
+++ b/gcc/genmodes.c
@@ -848,6 +848,38 @@ calc_wider_mode (void)
 
 #define print_closer() puts ("};")
 
+/* Compute the max bitsize of some of the classes of integers.  It may
+   be that there are needs for the other integer classes, and this
+   code is easy to extend.  */
+static void
+emit_max_int (void)
+{
+  unsigned int max, mmax;
+  struct mode_data *i;
+  int j;
+
+  puts ("");
+  for (max = 1, i = modes[MODE_INT]; i; i = i->next)
+if (max < i->bytesize)
+	max = i->bytesize;
+  printf ("#define MAX_BITSIZE_MODE_INT %d*BITS_PER_UNIT\n", max);
+  mmax = max;
+  for (max = 1, i = modes[MODE_PARTIAL_INT]; i; i = i->next)
+if (max < i->bytesize)
+	max = i->bytesize;
+  printf ("#define MAX_BITSIZE_MODE_PARTIAL_INT %d*BITS_PER_UNIT\n", max);
+  if (max > mmax)
+mmax = max;
+  printf ("#define MAX_BITSIZE_MODE_ANY_INT %d*BITS_PER_UNIT\n", mmax);
+
+  mmax = 0;
+  for (j = 0; j < MAX_MODE_CLASS; j++)
+for (i = modes[j]; i; i = i->next)
+  if (mmax < i->bytesize)
+	mmax = i->bytesize;
+  printf ("#define MAX_BITSIZE_MODE_ANY_MODE %d*BITS_PER_UNIT\n", mmax);
+}
+
 static void
 emit_insn_modes_h (void)
 {
@@ -912,6 +944,7 @@ enum machine_mode\n{");
 #endif
   printf ("#define CONST_MODE_IBIT%s\n", adj_ibit ? "" : " const");
   printf ("#define CONST_MODE_FBIT%s\n", adj_fbit ? "" : " const");
+  emit_max_int ();
   puts ("\
 \n\
 #endif /* insn-modes.h */");
diff --git a/gcc/machmode.def b/gcc/machmode.def
index 4b58150..1062f18 100644
--- a/gcc/machmode.def
+++ b/gcc/machmode.def
@@ -179,8 +179,11 @@ RANDOM_MODE (BLK);
 FRACTIONAL_INT_MODE (BI, 1, 1);
 
 /* Basic integer modes.  We go up to TI in generic code (128 bits).
-   The name OI is reserved for a 256-bit type (needed by some back ends).
-   FIXME TI shouldn't be generically available either.  */
+   TImode is needed here because the some front ends now genericly
+   support __int128.  If the front ends decide to generically support
+   larger types, then corresponding modes must be added here.  The
+   name OI is reserved for a 256-bit type (needed by some back ends).
+*/
 INT_MODE (QI, 1);
 INT_MODE (HI, 2);
 INT_MODE (SI, 4);


Re: patch to fix constant math - second small patch

2012-11-26 Thread Richard Biener
On Thu, Nov 8, 2012 at 7:13 PM, Kenneth Zadeck  wrote:
> I have added the proper doc.  OK to commit?

Ok.

Thanks,
Richard.

> Kenny
>
>
>
> On 10/08/2012 05:06 AM, Richard Guenther wrote:
>>
>> On Sat, Oct 6, 2012 at 12:48 AM, Kenneth Zadeck
>>  wrote:
>>>
>>> This patch adds machinery to genmodes.c so that largest possible sizes of
>>> various data structures can be determined at gcc build time.  These
>>> functions create 3 symbols that are available in insn-modes.h:
>>> MAX_BITSIZE_MODE_INT - the bitsize of the largest int.
>>> MAX_BITSIZE_MODE_PARTIAL_INT - the bitsize of the largest partial int.
>>> MAX_BITSIZE_MODE_ANY_INT - the largest bitsize of any kind of int.
>>
>> Ok.  Please document these macros in rtl.texi.
>>
>> Richard.
>
>


Re: patch to fix constant math - second small patch

2012-11-08 Thread Kenneth Zadeck

I have added the proper doc.  OK to commit?

Kenny


On 10/08/2012 05:06 AM, Richard Guenther wrote:

On Sat, Oct 6, 2012 at 12:48 AM, Kenneth Zadeck
 wrote:

This patch adds machinery to genmodes.c so that largest possible sizes of
various data structures can be determined at gcc build time.  These
functions create 3 symbols that are available in insn-modes.h:
MAX_BITSIZE_MODE_INT - the bitsize of the largest int.
MAX_BITSIZE_MODE_PARTIAL_INT - the bitsize of the largest partial int.
MAX_BITSIZE_MODE_ANY_INT - the largest bitsize of any kind of int.

Ok.  Please document these macros in rtl.texi.

Richard.


2012-11-8  Kenneth Zadeck 

* genmodes.c (emit_max_int): New function.
(emit_insn_modes_h): Added call to emit_max_function.
* doc/rtl.texi (MAX_BITSIZE_MODE_INT, MAX_BITSIZE_MODE_PARTIAL_INT,
MAX_BITSIZE_MODE_ANY_INT, MAX_BITSIZE_MODE_ANY_MODE): Added doc.
diff --git a/gcc/doc/rtl.texi b/gcc/doc/rtl.texi
index 07c480d..6842cb8 100644
--- a/gcc/doc/rtl.texi
+++ b/gcc/doc/rtl.texi
@@ -1458,6 +1458,28 @@ Returns the number of units contained in a mode, i.e.,
 Returns the narrowest mode in mode class @var{c}.
 @end table
 
+The following 4 variables are defined on every target.   They can be
+used to allocate buffers that are guaranteed to be large enough to
+hold any value that can be represented on the target.   
+
+@table @code
+@findex MAX_BITSIZE_MODE_INT
+@item MAX_BITSIZE_MODE_INT
+The bitsize of the largest integer mode defined on the target.
+
+@findex MAX_BITSIZE_MODE_PARTIAL_INT
+@item MAX_BITSIZE_MODE_PARTIAL_INT
+The bitsize of the largest partial integer mode defined on the target.
+
+@findex MAX_BITSIZE_MODE_ANY_INT
+@item MAX_BITSIZE_MODE_ANY_INT
+The maximum of MAX_BITSIZE_MODE_INT and MAX_BITSIZE_MODE_PARTIAL_INT.
+
+@findex MAX_BITSIZE_MODE_ANY_MODE
+@item MAX_BITSIZE_MODE_ANY_MODE
+The bitsize of the largest mode on the target.   
+@end table
+
 @findex byte_mode
 @findex word_mode
 The global variables @code{byte_mode} and @code{word_mode} contain modes
diff --git a/gcc/genmodes.c b/gcc/genmodes.c
index d0095c3..3e63cc7 100644
--- a/gcc/genmodes.c
+++ b/gcc/genmodes.c
@@ -849,6 +849,38 @@ calc_wider_mode (void)
 
 #define print_closer() puts ("};")
 
+/* Compute the max bitsize of some of the classes of integers.  It may
+   be that there are needs for the other integer classes, and this
+   code is easy to extend.  */
+static void
+emit_max_int (void)
+{
+  unsigned int max, mmax;
+  struct mode_data *i;
+  int j;
+
+  puts ("");
+  for (max = 1, i = modes[MODE_INT]; i; i = i->next)
+if (max < i->bytesize)
+	max = i->bytesize;
+  printf ("#define MAX_BITSIZE_MODE_INT %d*BITS_PER_UNIT\n", max);
+  mmax = max;
+  for (max = 1, i = modes[MODE_PARTIAL_INT]; i; i = i->next)
+if (max < i->bytesize)
+	max = i->bytesize;
+  printf ("#define MAX_BITSIZE_MODE_PARTIAL_INT %d*BITS_PER_UNIT\n", max);
+  if (max > mmax)
+mmax = max;
+  printf ("#define MAX_BITSIZE_MODE_ANY_INT %d*BITS_PER_UNIT\n", mmax);
+
+  mmax = 0;
+  for (j = 0; j < MAX_MODE_CLASS; j++)
+for (i = modes[j]; i; i = i->next)
+  if (mmax < i->bytesize)
+	mmax = i->bytesize;
+  printf ("#define MAX_BITSIZE_MODE_ANY_MODE %d*BITS_PER_UNIT\n", mmax);
+}
+
 static void
 emit_insn_modes_h (void)
 {
@@ -913,6 +945,7 @@ enum machine_mode\n{");
 #endif
   printf ("#define CONST_MODE_IBIT%s\n", adj_ibit ? "" : " const");
   printf ("#define CONST_MODE_FBIT%s\n", adj_fbit ? "" : " const");
+  emit_max_int ();
   puts ("\
 \n\
 #endif /* insn-modes.h */");
diff --git a/gcc/machmode.def b/gcc/machmode.def
index 631015f..7186cb4 100644
--- a/gcc/machmode.def
+++ b/gcc/machmode.def
@@ -180,8 +180,11 @@ RANDOM_MODE (BLK);
 FRACTIONAL_INT_MODE (BI, 1, 1);
 
 /* Basic integer modes.  We go up to TI in generic code (128 bits).
-   The name OI is reserved for a 256-bit type (needed by some back ends).
-   FIXME TI shouldn't be generically available either.  */
+   TImode is needed here because the some front ends now genericly
+   support __int128.  If the front ends decide to generically support
+   larger types, then corresponding modes must be added here.  The
+   name OI is reserved for a 256-bit type (needed by some back ends).
+*/
 INT_MODE (QI, 1);
 INT_MODE (HI, 2);
 INT_MODE (SI, 4);


Re: patch to fix constant math - second small patch

2012-10-08 Thread Richard Guenther
On Sat, Oct 6, 2012 at 12:48 AM, Kenneth Zadeck
 wrote:
> This patch adds machinery to genmodes.c so that largest possible sizes of
> various data structures can be determined at gcc build time.  These
> functions create 3 symbols that are available in insn-modes.h:
> MAX_BITSIZE_MODE_INT - the bitsize of the largest int.
> MAX_BITSIZE_MODE_PARTIAL_INT - the bitsize of the largest partial int.
> MAX_BITSIZE_MODE_ANY_INT - the largest bitsize of any kind of int.

Ok.  Please document these macros in rtl.texi.

Richard.


Re: patch to fix constant math - second small patch

2012-10-05 Thread Kenneth Zadeck
This patch adds machinery to genmodes.c so that largest possible sizes 
of various data structures can be determined at gcc build time.  These 
functions create 3 symbols that are available in insn-modes.h:

MAX_BITSIZE_MODE_INT - the bitsize of the largest int.
MAX_BITSIZE_MODE_PARTIAL_INT - the bitsize of the largest partial int.
MAX_BITSIZE_MODE_ANY_INT - the largest bitsize of any kind of int.
Index: gcc/genmodes.c
===
--- gcc/genmodes.c	(revision 191978)
+++ gcc/genmodes.c	(working copy)
@@ -849,6 +849,38 @@ calc_wider_mode (void)
 
 #define print_closer() puts ("};")
 
+/* Compute the max bitsize of some of the classes of integers.  It may
+   be that there are needs for the other integer classes, and this
+   code is easy to extend.  */
+static void
+emit_max_int (void)
+{
+  unsigned int max, mmax;
+  struct mode_data *i;
+  int j;
+
+  puts ("");
+  for (max = 1, i = modes[MODE_INT]; i; i = i->next)
+if (max < i->bytesize)
+	max = i->bytesize;
+  printf ("#define MAX_BITSIZE_MODE_INT %d*BITS_PER_UNIT\n", max);
+  mmax = max;
+  for (max = 1, i = modes[MODE_PARTIAL_INT]; i; i = i->next)
+if (max < i->bytesize)
+	max = i->bytesize;
+  printf ("#define MAX_BITSIZE_MODE_PARTIAL_INT %d*BITS_PER_UNIT\n", max);
+  if (max > mmax)
+mmax = max;
+  printf ("#define MAX_BITSIZE_MODE_ANY_INT %d*BITS_PER_UNIT\n", mmax);
+
+  mmax = 0;
+  for (j = 0; j < MAX_MODE_CLASS; j++)
+for (i = modes[j]; i; i = i->next)
+  if (mmax < i->bytesize)
+	mmax = i->bytesize;
+  printf ("#define MAX_BITSIZE_MODE_ANY_MODE %d*BITS_PER_UNIT\n", mmax);
+}
+
 static void
 emit_insn_modes_h (void)
 {
@@ -913,6 +945,7 @@ enum machine_mode\n{");
 #endif
   printf ("#define CONST_MODE_IBIT%s\n", adj_ibit ? "" : " const");
   printf ("#define CONST_MODE_FBIT%s\n", adj_fbit ? "" : " const");
+  emit_max_int ();
   puts ("\
 \n\
 #endif /* insn-modes.h */");
2012-10-5  Kenneth Zadeck 

* genmodes.c (emit_max_int): New function.
(emit_insn_modes_h): Added call to emit_max_function.