This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Support (match_operand:MODE) in genpreds

Paolo Bonzini wrote:
This patch adds a small feature to genpreds, that is

(match_operand:MODE 0 "predicate")

will call predicate (op, MODE). This can be useful for example to match const_int's in a small range, as in

   (match_operand:QI 0 "immediate_operand")
   (match_operand:QI 0 "const_int_operand")

Sigh, no patch attached.

2005-02-21  Paolo Bonzini  <>

	* genpreds.c (mark_mode_tests): Handle non-VOIDmode match_operands.
	(write_predicate_expr): Likewise.

Index: genpreds.c
RCS file: /cvs/gcc/gcc/gcc/genpreds.c,v
retrieving revision 1.12
diff -u -p -r1.12 genpreds.c
--- genpreds.c	13 Dec 2004 10:27:42 -0000	1.12
+++ genpreds.c	21 Feb 2005 07:45:01 -0000
@@ -167,7 +167,7 @@ mark_mode_tests (rtx exp)
 	struct pred_data *p = lookup_predicate (XSTR (exp, 1));
 	if (!p)
 	  error ("reference to undefined predicate '%s'", XSTR (exp, 1));
-	else if (p->special)
+	else if (p->special || GET_MODE (exp) != VOIDmode)
 	  NO_MODE_TEST (exp) = 1;
@@ -366,7 +366,10 @@ write_predicate_expr (const char *name, 
     case MATCH_OPERAND:
-      printf ("%s (op, mode)", XSTR (exp, 1));
+      if (GET_MODE (exp) == VOIDmode)
+        printf ("%s (op, mode)", XSTR (exp, 1));
+      else
+        printf ("%s (op, %smode)", XSTR (exp, 1), mode_name[GET_MODE (exp)]);
     case MATCH_CODE:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]