From patchwork Tue Feb 19 15:07:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 221712 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id AE7E62C0090 for ; Wed, 20 Feb 2013 02:08:34 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1361891315; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Cc:Subject:Message-ID:User-Agent:MIME-Version: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=dgJlA+A iWhFjsAKNOzawf93wuH4=; b=uyi0MXZlVUYlLXY9kuxELds8SZu80qiqlp1UJN+ BJYNUv+GMzx3Fq7vQuQR7+MdvEYGVv00Sv/9keAtka6eqMg8O95hU08lNAAmKAvQ 2ai4NrHVj6mPf9Lie4X11TggXT7y4vT3rPONo/ihryP122kjJwV7OZmLYvG4e20g WyWE= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Date:From:To:Cc:Subject:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=jiZ0Parkas7q8z1ctdg2ccOUKh82UBUXAW6V7aE3ByLkBppZ+EtGfG7w0NZeek vL6MSSVpv/iO2PVJ2bq8DsODPYpIGwIKsdNqCWpJ15ve/3etV7FTTASIujxCHtYn 2DhfLGyMkUZ02asmagf2lt1WFD/M8KekNnAoIIPuDjvtQ=; Received: (qmail 10219 invoked by alias); 19 Feb 2013 15:08:24 -0000 Received: (qmail 10211 invoked by uid 22791); 19 Feb 2013 15:08:23 -0000 X-SWARE-Spam-Status: No, hits=-5.8 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 19 Feb 2013 15:07:51 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E201BA3B99; Tue, 19 Feb 2013 16:07:49 +0100 (CET) Date: Tue, 19 Feb 2013 16:07:49 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Cc: Jakub Jelinek Subject: [PATCH] Speedup lookup_constraint for 2-letter constraints Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 * 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);