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]

[PATCH] Speedup lookup_constraint for 2-letter constraints

This speeds up lookup_constraint by allowing the generic folding
for n == 1 strncmp calls to trigger, handling two-letter constraints
by two char comparisons instead of one and a call to strncmp (which
ends up not being inlined because it's considered cold ...).

Bootstrap & regtest pending on x86_64-unknown-linux-gnu.


2013-02-19  Richard Biener  <>

	* genpreds.c (write_lookup_constraint): Do not compare first
	letter of the constraint again.

Index: gcc/genpreds.c
--- gcc/genpreds.c	(revision 196134)
+++ gcc/genpreds.c	(working copy)
@@ -945,9 +945,10 @@ write_lookup_constraint (void)
-	      printf ("      if (!strncmp (str, \"%s\", %lu))\n"
+	      printf ("      if (!strncmp (str + 1, \"%s\", %lu))\n"
 		      "        return CONSTRAINT_%s;\n",
-		      c->name, (unsigned long int) c->namelen, c->c_name);
+		      c->name + 1, (unsigned long int) c->namelen - 1,
+		      c->c_name);
 	      c = c->next_this_letter;
 	  while (c);

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