diff mbox

wide-int, gen*.c

Message ID E913F70D-C180-4572-81A9-CB2AFD3411B5@comcast.net
State New
Headers show

Commit Message

Mike Stump Nov. 23, 2013, 7:21 p.m. UTC
Richi has asked the we break the wide-int patch so that the individual port and front end maintainers can review their parts without have to go through the entire patch.    This patch covers the gen*.c code, excluding gengtype.

Ok?
* genemit.c
	(gen_exp): Add CONST_WIDE_INT case.
	* gengenrtl.c
	(excluded_rtx): Add CONST_WIDE_INT case.
	* genmodes.c
	(emit_max_int): Define MAX_BITSIZE_MODE_ANY_INT and
	MAX_BITSIZE_MODE_ANY_MODE.
	* genpreds.c
	(write_one_predicate_function): Update comment.
	(write_tm_constrs_h): Add check for hval and lval use in
	CONST_WIDE_INT.
	* genrecog.c
	(validate_pattern): Add CONST_WIDE_INT case.
	(add_to_sequence): Likewise.
	* gensupport.c
	(struct std_pred_table): Add const_scalar_int_operand and
	const_double_operand.

Comments

Richard Biener Nov. 25, 2013, 10:45 a.m. UTC | #1
On Sat, Nov 23, 2013 at 8:21 PM, Mike Stump <mikestump@comcast.net> wrote:
> Richi has asked the we break the wide-int patch so that the individual port and front end maintainers can review their parts without have to go through the entire patch.    This patch covers the gen*.c code, excluding gengtype.
>
> Ok?

Ok.

Thanks,
Richard.
diff mbox

Patch

diff --git a/gcc/genemit.c b/gcc/genemit.c
index 03831bf..174aa30 100644
--- a/gcc/genemit.c
+++ b/gcc/genemit.c
@@ -204,6 +204,7 @@  gen_exp (rtx x, enum rtx_code subroutine_type, char *used)
 
     case CONST_DOUBLE:
     case CONST_FIXED:
+    case CONST_WIDE_INT:
       /* These shouldn't be written in MD files.  Instead, the appropriate
 	 routines in varasm.c should be called.  */
       gcc_unreachable ();
diff --git a/gcc/gengenrtl.c b/gcc/gengenrtl.c
index 4a35683..ce2049d 100644
--- a/gcc/gengenrtl.c
+++ b/gcc/gengenrtl.c
@@ -142,6 +142,7 @@  static int
 excluded_rtx (int idx)
 {
   return ((strcmp (defs[idx].enumname, "CONST_DOUBLE") == 0)
+	  || (strcmp (defs[idx].enumname, "CONST_WIDE_INT") == 0)
 	  || (strcmp (defs[idx].enumname, "CONST_FIXED") == 0));
 }
 
diff --git a/gcc/genmodes.c b/gcc/genmodes.c
index 12a98f3..6f0fba8 100644
--- a/gcc/genmodes.c
+++ b/gcc/genmodes.c
@@ -883,14 +883,14 @@  emit_max_int (void)
 	max = i->bytesize;
   if (max > mmax)
     mmax = max;
-  printf ("#define MAX_BITSIZE_MODE_ANY_INT %d*BITS_PER_UNIT\n", mmax);
+  printf ("#define MAX_BITSIZE_MODE_ANY_INT %d\n", mmax * MAX_BITS_PER_UNIT);
 
   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);
+  printf ("#define MAX_BITSIZE_MODE_ANY_MODE %d\n", mmax * MAX_BITS_PER_UNIT);
 }
 
 static void
diff --git a/gcc/genpreds.c b/gcc/genpreds.c
index c27ae88..dbffa90 100644
--- a/gcc/genpreds.c
+++ b/gcc/genpreds.c
@@ -612,7 +612,7 @@  write_one_predicate_function (struct pred_data *p)
   add_mode_tests (p);
 
   /* A normal predicate can legitimately not look at enum machine_mode
-     if it accepts only CONST_INTs and/or CONST_DOUBLEs.  */
+     if it accepts only CONST_INTs and/or CONST_WIDE_INT and/or CONST_DOUBLEs.  */
   printf ("int\n%s (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)\n{\n",
 	  p->name);
   write_predicate_stmts (p->exp);
@@ -1075,12 +1075,17 @@  write_tm_constrs_h (void)
 	if (needs_ival)
 	  puts ("  if (CONST_INT_P (op))\n"
 		"    ival = INTVAL (op);");
+#if TARGET_SUPPORTS_WIDE_INT
+	if (needs_lval || needs_hval)
+	  error ("you can't use lval or hval");
+#else
 	if (needs_hval)
 	  puts ("  if (GET_CODE (op) == CONST_DOUBLE && mode == VOIDmode)"
 		"    hval = CONST_DOUBLE_HIGH (op);");
 	if (needs_lval)
 	  puts ("  if (GET_CODE (op) == CONST_DOUBLE && mode == VOIDmode)"
 		"    lval = CONST_DOUBLE_LOW (op);");
+#endif
 	if (needs_rval)
 	  puts ("  if (GET_CODE (op) == CONST_DOUBLE && mode != VOIDmode)"
 		"    rval = CONST_DOUBLE_REAL_VALUE (op);");
diff --git a/gcc/genrecog.c b/gcc/genrecog.c
index 814be7d..14a7e15 100644
--- a/gcc/genrecog.c
+++ b/gcc/genrecog.c
@@ -588,6 +588,7 @@  validate_pattern (rtx pattern, rtx insn, rtx set, int set_code)
 		 && GET_CODE (src) != PC
 		 && GET_CODE (src) != CC0
 		 && !CONST_INT_P (src)
+		 && !CONST_WIDE_INT_P (src)
 		 && GET_CODE (src) != CALL)
 	  {
 	    const char *which;
@@ -772,13 +773,14 @@  add_to_sequence (rtx pattern, struct decision_head *last,
 
 	       We can optimize the generated code a little if either
 	       (a) the predicate only accepts one code, or (b) the
-	       predicate does not allow CONST_INT, in which case it
-	       can match only if the modes match.  */
+	       predicate does not allow CONST_INT or CONST_WIDE_INT,
+	       in which case it can match only if the modes match.  */
 	    pred = lookup_predicate (pred_name);
 	    if (pred)
 	      {
 		test->u.pred.data = pred;
-		allows_const_int = pred->codes[CONST_INT];
+		allows_const_int = (pred->codes[CONST_INT]
+				    || pred->codes[CONST_WIDE_INT]);
 		if (was_code == MATCH_PARALLEL
 		    && pred->singleton != PARALLEL)
 		  message_with_line (pattern_lineno,
diff --git a/gcc/gensupport.c b/gcc/gensupport.c
index e6c5c23..d9f7940 100644
--- a/gcc/gensupport.c
+++ b/gcc/gensupport.c
@@ -2806,7 +2806,12 @@  static const struct std_pred_table std_preds[] = {
   {"scratch_operand", false, false, {SCRATCH, REG}},
   {"immediate_operand", false, true, {UNKNOWN}},
   {"const_int_operand", false, false, {CONST_INT}},
+#if TARGET_SUPPORTS_WIDE_INT
+  {"const_scalar_int_operand", false, false, {CONST_INT, CONST_WIDE_INT}},
+  {"const_double_operand", false, false, {CONST_DOUBLE}},
+#else
   {"const_double_operand", false, false, {CONST_INT, CONST_DOUBLE}},
+#endif
   {"nonimmediate_operand", false, false, {SUBREG, REG, MEM}},
   {"nonmemory_operand", false, true, {SUBREG, REG}},
   {"push_operand", false, false, {MEM}},