public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/63464] compare one character to many: faster
Date: Mon, 06 Oct 2014 11:27:00 -0000	[thread overview]
Message-ID: <bug-63464-4-TV6PPOwF1j@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-63464-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63464

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-10-06
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org,
                   |                            |steven at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
We have this optimization implemented for switches, if you compile
char*f3(char*s){
  do
    {
      switch (*s)
        {
        case ' ':
        case ',':
        case '\r':
        case '\n':
          ++s;
          continue;
        default:
          return s;
        }
    }
  while (1);
}

then it will do the bit test, see r189173 (and various follow-up fixes for
that).
Now, we can argue whether in this case it is beneficial to perform the
MINUS_EXPR or if maxval is small enough (e.g. when maxval is smaller than
BITS_PER_WORD), just assume minval is 0.

And then the question is, if we should teach reassoc range optimizations to
reuse emit_case_bit_tests, or convert such tests into a GIMPLE_SWITCH and
expand as such.

Richard/Steven, thoughts about this?


  reply	other threads:[~2014-10-06 11:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-05 21:28 [Bug tree-optimization/63464] New: " glisse at gcc dot gnu.org
2014-10-06 11:27 ` jakub at gcc dot gnu.org [this message]
2014-10-06 11:52 ` [Bug tree-optimization/63464] " rguenther at suse dot de
2014-10-06 16:59 ` jakub at gcc dot gnu.org
2014-10-07 11:11 ` jakub at gcc dot gnu.org
2014-10-07 11:15 ` rguenther at suse dot de
2014-10-07 20:15 ` glisse at gcc dot gnu.org
2014-10-07 21:01 ` glisse at gcc dot gnu.org
2014-10-10 12:16 ` jakub at gcc dot gnu.org
2014-10-13 15:51 ` jakub at gcc dot gnu.org
2014-10-13 15:53 ` jakub at gcc dot gnu.org
2014-10-15 14:19 ` jakub at gcc dot gnu.org
2014-10-17 10:55 ` jakub at gcc dot gnu.org
2014-10-17 11:20 ` jakub at gcc dot gnu.org
2014-10-17 11:49 ` ubizjak at gmail dot com
2015-01-16 17:14 ` jakub at gcc dot gnu.org
2015-01-16 17:28 ` jakub at gcc dot gnu.org

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=bug-63464-4-TV6PPOwF1j@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).