Re: [PATCH 01/13] recog: Increased max number of alternatives - v2

2015-07-02 Thread Andreas Krebbel
On Mon, Jun 08, 2015 at 03:38:03PM +0200, Jakub Jelinek wrote:
 On Mon, Jun 08, 2015 at 03:32:50PM +0200, Andreas Krebbel wrote:
  On 06/01/2015 10:22 AM, Jakub Jelinek wrote:
   On Fri, May 22, 2015 at 09:54:00AM +0200, Andreas Krebbel wrote:
   On Tue, May 19, 2015 at 10:40:26AM +0200, Andreas Krebbel wrote:
   On 05/18/2015 04:19 PM, Richard Biener wrote:
   Please use uint64_t instead.
  
   Done. Ok with that change?
  
   I've applied the following patch.
   
   Note that on current trunk cross compiler from x86_64-linux to
   s390x-linux (admittedly just make cc1 of an older configured tree,
   but with libcpp (normal and build) rebuilt) fails miserably with
   genattrtab: invalid alternative specified for pattern number 1015
   
* recog.h: Increase MAX_RECOG_ALTERNATIVES.
Change type of alternative_mask to uint64_t.
   
   From quick look at genattrtab.c, there are many further spots
   which rely on MAX_RECOG_ALTERNATIVES fitting into int bits.
   
   With this quick patch make cc1 at least succeeds, but no idea whether
   I've caught all the spots which work with bitmasks of alternatives.
  
  I've regtested your patch on S/390 without seeing any problems. Could you 
  please commit it to mainline?
 
 Ok, I will.  Have you looked around if these are all the spots
 that need changing for this in the gen* tools?
 Perhaps trying -fsanitize=undefined and/or valgrind.  I admit I haven't
 spent too much time on it.

Could you please apply this to GCC 5 branch as well? I'm about to
apply the z13 backports now.

Bye,

-Andreas-



Re: [PATCH 01/13] recog: Increased max number of alternatives - v2

2015-06-08 Thread Andreas Krebbel
On 06/01/2015 10:22 AM, Jakub Jelinek wrote:
 On Fri, May 22, 2015 at 09:54:00AM +0200, Andreas Krebbel wrote:
 On Tue, May 19, 2015 at 10:40:26AM +0200, Andreas Krebbel wrote:
 On 05/18/2015 04:19 PM, Richard Biener wrote:
 Please use uint64_t instead.

 Done. Ok with that change?

 I've applied the following patch.
 
 Note that on current trunk cross compiler from x86_64-linux to
 s390x-linux (admittedly just make cc1 of an older configured tree,
 but with libcpp (normal and build) rebuilt) fails miserably with
 genattrtab: invalid alternative specified for pattern number 1015
 
  * recog.h: Increase MAX_RECOG_ALTERNATIVES.
  Change type of alternative_mask to uint64_t.
 
 From quick look at genattrtab.c, there are many further spots
 which rely on MAX_RECOG_ALTERNATIVES fitting into int bits.
 
 With this quick patch make cc1 at least succeeds, but no idea whether
 I've caught all the spots which work with bitmasks of alternatives.

I've regtested your patch on S/390 without seeing any problems. Could you 
please commit it to mainline?

Thanks!

Bye,

-Andreas-



Re: [PATCH 01/13] recog: Increased max number of alternatives - v2

2015-06-08 Thread Jakub Jelinek
On Mon, Jun 08, 2015 at 03:32:50PM +0200, Andreas Krebbel wrote:
 On 06/01/2015 10:22 AM, Jakub Jelinek wrote:
  On Fri, May 22, 2015 at 09:54:00AM +0200, Andreas Krebbel wrote:
  On Tue, May 19, 2015 at 10:40:26AM +0200, Andreas Krebbel wrote:
  On 05/18/2015 04:19 PM, Richard Biener wrote:
  Please use uint64_t instead.
 
  Done. Ok with that change?
 
  I've applied the following patch.
  
  Note that on current trunk cross compiler from x86_64-linux to
  s390x-linux (admittedly just make cc1 of an older configured tree,
  but with libcpp (normal and build) rebuilt) fails miserably with
  genattrtab: invalid alternative specified for pattern number 1015
  
 * recog.h: Increase MAX_RECOG_ALTERNATIVES.
 Change type of alternative_mask to uint64_t.
  
  From quick look at genattrtab.c, there are many further spots
  which rely on MAX_RECOG_ALTERNATIVES fitting into int bits.
  
  With this quick patch make cc1 at least succeeds, but no idea whether
  I've caught all the spots which work with bitmasks of alternatives.
 
 I've regtested your patch on S/390 without seeing any problems. Could you 
 please commit it to mainline?

Ok, I will.  Have you looked around if these are all the spots
that need changing for this in the gen* tools?
Perhaps trying -fsanitize=undefined and/or valgrind.  I admit I haven't
spent too much time on it.

Jakub


Re: [PATCH 01/13] recog: Increased max number of alternatives - v2

2015-06-01 Thread Jakub Jelinek
On Fri, May 22, 2015 at 09:54:00AM +0200, Andreas Krebbel wrote:
 On Tue, May 19, 2015 at 10:40:26AM +0200, Andreas Krebbel wrote:
  On 05/18/2015 04:19 PM, Richard Biener wrote:
   Please use uint64_t instead.
  
  Done. Ok with that change?
 
 I've applied the following patch.

Note that on current trunk cross compiler from x86_64-linux to
s390x-linux (admittedly just make cc1 of an older configured tree,
but with libcpp (normal and build) rebuilt) fails miserably with
genattrtab: invalid alternative specified for pattern number 1015

   * recog.h: Increase MAX_RECOG_ALTERNATIVES.
   Change type of alternative_mask to uint64_t.

From quick look at genattrtab.c, there are many further spots
which rely on MAX_RECOG_ALTERNATIVES fitting into int bits.

With this quick patch make cc1 at least succeeds, but no idea whether
I've caught all the spots which work with bitmasks of alternatives.

--- gcc/genattrtab.c.jj 2015-01-09 21:59:45.0 +0100
+++ gcc/genattrtab.c2015-06-01 10:15:50.797576547 +0200
@@ -230,7 +230,7 @@ static int *insn_n_alternatives;
 /* Stores, for each insn code, a bitmap that has bits on for each possible
alternative.  */
 
-static int *insn_alternatives;
+static uint64_t *insn_alternatives;
 
 /* Used to simplify expressions.  */
 
@@ -258,7 +258,7 @@ static char *attr_printf   (unsi
   ATTRIBUTE_PRINTF_2;
 static rtx make_numeric_value  (int);
 static struct attr_desc *find_attr (const char **, int);
-static rtx mk_attr_alt (int);
+static rtx mk_attr_alt (uint64_t);
 static char *next_comma_elt   (const char **);
 static rtx insert_right_side  (enum rtx_code, rtx, rtx, int, int);
 static rtx copy_boolean   (rtx);
@@ -769,7 +769,7 @@ check_attr_test (rtx exp, int is_const,
  if (attr == NULL)
{
  if (! strcmp (XSTR (exp, 0), alternative))
-   return mk_attr_alt (1  atoi (XSTR (exp, 1)));
+   return mk_attr_alt (((uint64_t) 1)  atoi (XSTR (exp, 1)));
  else
fatal (unknown attribute `%s' in EQ_ATTR, XSTR (exp, 0));
}
@@ -815,7 +815,7 @@ check_attr_test (rtx exp, int is_const,
 
  name_ptr = XSTR (exp, 1);
  while ((p = next_comma_elt (name_ptr)) != NULL)
-   set |= 1  atoi (p);
+   set |= ((uint64_t) 1)  atoi (p);
 
  return mk_attr_alt (set);
}
@@ -1292,7 +1292,7 @@ static struct attr_value *
 get_attr_value (rtx value, struct attr_desc *attr, int insn_code)
 {
   struct attr_value *av;
-  int num_alt = 0;
+  uint64_t num_alt = 0;
 
   value = make_canonical (attr, value);
   if (compares_alternatives_p (value))
@@ -1934,7 +1934,7 @@ insert_right_side (enum rtx_code code, r
This routine is passed an expression and either AND or IOR.  It returns a
bitmask indicating which alternatives are mentioned within EXP.  */
 
-static int
+static uint64_t
 compute_alternative_mask (rtx exp, enum rtx_code code)
 {
   const char *string;
@@ -1965,15 +1965,15 @@ compute_alternative_mask (rtx exp, enum
 return 0;
 
   if (string[1] == 0)
-return 1  (string[0] - '0');
-  return 1  atoi (string);
+return ((uint64_t) 1)  (string[0] - '0');
+  return ((uint64_t) 1)  atoi (string);
 }
 
 /* Given I, a single-bit mask, return RTX to compare the `alternative'
attribute with the value represented by that bit.  */
 
 static rtx
-make_alternative_compare (int mask)
+make_alternative_compare (uint64_t mask)
 {
   return mk_attr_alt (mask);
 }
@@ -2472,7 +2472,7 @@ attr_alt_complement (rtx s)
in E.  */
 
 static rtx
-mk_attr_alt (int e)
+mk_attr_alt (uint64_t e)
 {
   rtx result = rtx_alloc (EQ_ATTR_ALT);
 
@@ -2499,7 +2499,7 @@ simplify_test_exp (rtx exp, int insn_cod
   struct attr_value *av;
   struct insn_ent *ie;
   struct attr_value_list *iv;
-  int i;
+  uint64_t i;
   rtx newexp = exp;
   bool left_alt, right_alt;
 
@@ -2779,7 +2779,7 @@ simplify_test_exp (rtx exp, int insn_cod
 case EQ_ATTR:
   if (XSTR (exp, 0) == alternative_name)
{
- newexp = mk_attr_alt (1  atoi (XSTR (exp, 1)));
+ newexp = mk_attr_alt (((uint64_t) 1)  atoi (XSTR (exp, 1)));
  break;
}
 
@@ -5263,10 +5263,11 @@ main (int argc, char **argv)
 expand_delays ();
 
   /* Make `insn_alternatives'.  */
-  insn_alternatives = oballocvec (int, insn_code_number);
+  insn_alternatives = oballocvec (uint64_t, insn_code_number);
   for (id = defs; id; id = id-next)
 if (id-insn_code = 0)
-  insn_alternatives[id-insn_code] = (1  id-num_alternatives) - 1;
+  insn_alternatives[id-insn_code]
+   = (((uint64_t) 1)  id-num_alternatives) - 1;
 
   /* Make `insn_n_alternatives'.  */
   insn_n_alternatives = oballocvec (int, insn_code_number);


Jakub


Re: [PATCH 01/13] recog: Increased max number of alternatives - v2

2015-05-22 Thread Andreas Krebbel
On Tue, May 19, 2015 at 10:40:26AM +0200, Andreas Krebbel wrote:
 On 05/18/2015 04:19 PM, Richard Biener wrote:
  Please use uint64_t instead.
 
 Done. Ok with that change?

I've applied the following patch.

Bye,

-Andreas-

gcc/
* recog.h: Increase MAX_RECOG_ALTERNATIVES.
Change type of alternative_mask to uint64_t.
---
 gcc/recog.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/recog.h b/gcc/recog.h
index 463c748..3a09304 100644
--- a/gcc/recog.h
+++ b/gcc/recog.h
@@ -23,8 +23,8 @@ along with GCC; see the file COPYING3.  If not see
 /* Random number that should be large enough for all purposes.  Also define
a type that has at least MAX_RECOG_ALTERNATIVES + 1 bits, with the extra
bit giving an invalid value that can be used to mean uninitialized.  */
-#define MAX_RECOG_ALTERNATIVES 30
-typedef unsigned int alternative_mask;
+#define MAX_RECOG_ALTERNATIVES 35
+typedef uint64_t alternative_mask;
 
 /* A mask of all alternatives.  */
 #define ALL_ALTERNATIVES ((alternative_mask) -1)
-- 
1.7.9.5



Re: [PATCH 01/13] recog: Increased max number of alternatives - v2

2015-05-19 Thread Andreas Krebbel
On 05/18/2015 04:19 PM, Richard Biener wrote:
 On Mon, May 18, 2015 at 3:41 PM, Andreas Krebbel
 kreb...@linux.vnet.ibm.com wrote:
 The new version also changes the type for the alternative_mask to unsigned 
 HOST_WIDE_INT.

 Bootstrapped without regressions on x86-64.

 Ok to apply?
 
 Please use uint64_t instead.

Done. Ok with that change?

-Andreas-




Re: [PATCH 01/13] recog: Increased max number of alternatives - v2

2015-05-19 Thread Richard Biener
On Tue, May 19, 2015 at 10:40 AM, Andreas Krebbel
kreb...@linux.vnet.ibm.com wrote:
 On 05/18/2015 04:19 PM, Richard Biener wrote:
 On Mon, May 18, 2015 at 3:41 PM, Andreas Krebbel
 kreb...@linux.vnet.ibm.com wrote:
 The new version also changes the type for the alternative_mask to unsigned 
 HOST_WIDE_INT.

 Bootstrapped without regressions on x86-64.

 Ok to apply?

 Please use uint64_t instead.

 Done. Ok with that change?

Yes.

Richard.

 -Andreas-




Re: [PATCH 01/13] recog: Increased max number of alternatives - v2

2015-05-18 Thread Richard Biener
On Mon, May 18, 2015 at 3:41 PM, Andreas Krebbel
kreb...@linux.vnet.ibm.com wrote:
 The new version also changes the type for the alternative_mask to unsigned 
 HOST_WIDE_INT.

 Bootstrapped without regressions on x86-64.

 Ok to apply?

Please use uint64_t instead.

Richard.

 Bye,

 -Andreas-

 gcc/
 * recog.h: Increase MAX_RECOG_ALTERNATIVES.
 ---
  gcc/recog.h |4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

 diff --git a/gcc/recog.h b/gcc/recog.h
 index 463c748..07700bd 100644
 --- a/gcc/recog.h
 +++ b/gcc/recog.h
 @@ -23,8 +23,8 @@ along with GCC; see the file COPYING3.  If not see
  /* Random number that should be large enough for all purposes.  Also define
 a type that has at least MAX_RECOG_ALTERNATIVES + 1 bits, with the extra
 bit giving an invalid value that can be used to mean uninitialized.  */
 -#define MAX_RECOG_ALTERNATIVES 30
 -typedef unsigned int alternative_mask;
 +#define MAX_RECOG_ALTERNATIVES 35
 +typedef unsigned HOST_WIDE_INT alternative_mask;

  /* A mask of all alternatives.  */
  #define ALL_ALTERNATIVES ((alternative_mask) -1)