From: Richard Biener <richard.guenther@gmail.com>
To: Roger Sayle <roger@nextmovesoftware.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Minor improvement to genpreds.cc
Date: Mon, 23 May 2022 10:21:09 +0200 [thread overview]
Message-ID: <CAFiYyc3C1-1YpVz_QtWGq27Jji-q1sckYsYL96YosxUo_YbPZA@mail.gmail.com> (raw)
In-Reply-To: <020b01d86dba$b2e29cd0$18a7d670$@nextmovesoftware.com>
On Sun, May 22, 2022 at 11:03 AM Roger Sayle <roger@nextmovesoftware.com> wrote:
>
>
> This simple patch implements Richard Biener's suggestion in comment #6
> of PR tree-optimization/52171 (from February 2013) that the insn-preds
> code generated by genpreds can avoid using strncmp when matching constant
> strings of length one.
>
> The effect of this patch is best explained by the diff of insn-preds.cc:
> < if (!strncmp (str + 1, "g", 1))
> ---
> > if (str[1] == 'g')
> 3104c3104
> < if (!strncmp (str + 1, "m", 1))
> ---
> > if (str[1] == 'm')
> 3106c3106
> < if (!strncmp (str + 1, "c", 1))
> ---
> > if (str[1] == 'c')
> ...
>
> The equivalent optimization is performed by GCC (but perhaps not by the
> host compiler), but generating simpler/smaller code may encourage further
> optimizations (such as use of a switch statement).
>
> This patch has been tested on x86_64-pc-linux-gnu with make bootstrap
> and make -k check with no new failures. Ok for mainline?
OK.
Richard.
>
> 2022-05-22 Roger Sayle <roger@nextmovesoftware.com>
>
> gcc/ChangeLog
> * genpreds.cc (write_lookup_constraint_1): Avoid generating a call
> to strncmp for strings of length one.
>
> Roger
> --
>
prev parent reply other threads:[~2022-05-23 8:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-22 9:02 Roger Sayle
2022-05-23 8:21 ` Richard Biener [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFiYyc3C1-1YpVz_QtWGq27Jji-q1sckYsYL96YosxUo_YbPZA@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=roger@nextmovesoftware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).