public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Speedup lookup_constraint for 2-letter constraints
@ 2013-02-19 15:08 Richard Biener
  2013-02-19 15:10 ` Jakub Jelinek
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Biener @ 2013-02-19 15:08 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jakub Jelinek


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.

Ok?

Thanks,
Richard.
2013-02-19  Richard Biener  <rguenther@suse.de>

	* 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)
 	{
 	  do
 	    {
-	      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);
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Speedup lookup_constraint for 2-letter constraints
  2013-02-19 15:08 [PATCH] Speedup lookup_constraint for 2-letter constraints Richard Biener
@ 2013-02-19 15:10 ` Jakub Jelinek
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2013-02-19 15:10 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

On Tue, Feb 19, 2013 at 04:07:49PM +0100, Richard Biener wrote:
> 
> 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.
> 
> Ok?

Yes, thanks.

> 2013-02-19  Richard Biener  <rguenther@suse.de>
> 
> 	* genpreds.c (write_lookup_constraint): Do not compare first
> 	letter of the constraint again.

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-19 15:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-19 15:08 [PATCH] Speedup lookup_constraint for 2-letter constraints Richard Biener
2013-02-19 15:10 ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).