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: Fri, 16 Jan 2015 17:28:00 -0000	[thread overview]
Message-ID: <bug-63464-4-V1GvxgYCFp@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

--- Comment #17 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Or try to deal with this in combine.  We have:
(insn 91 90 92 18 (parallel [
            (set (reg:DI 149 [ D.1943 ])
                (and:DI (reg:DI 147 [ D.1943 ])
                    (const_int 1 [0x1])))
            (clobber (reg:CC 17 flags))
        ]) vrp66-1.c:32 379 {*anddi_1}
     (expr_list:REG_DEAD (reg:DI 147 [ D.1943 ])
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (nil))))
(insn 92 91 94 18 (parallel [
            (set (reg:DI 150 [ D.1943 ])
                (xor:DI (reg:DI 149 [ D.1943 ])
                    (const_int 1 [0x1])))
            (clobber (reg:CC 17 flags))
        ]) vrp66-1.c:32 401 {*xordi_1}
     (expr_list:REG_DEAD (reg:DI 149 [ D.1943 ])
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (nil))))
(insn 94 92 95 18 (parallel [
            (set (reg:QI 93 [ D.1944 ])
                (and:QI (subreg:QI (reg:DI 150 [ D.1943 ]) 0)
                    (const_int 1 [0x1])))
            (clobber (reg:CC 17 flags))
        ]) vrp66-1.c:32 383 {*andqi_1}
     (expr_list:REG_DEAD (reg:DI 150 [ D.1943 ])
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (nil))))

and I believe nonzero_bits is smart enough to say that nonzero_bits of
(subreg:QI (reg:DI 150 [ D.1943 ]) 0) is 1.  But the problem is that
simplify-rtl attempts to match all kinds of weird patterns, like:
(parallel [
        (set (reg:QI 93 [ D.1944 ])
            (eq:QI (zero_extract:DI (reg:DI 147 [ D.1943 ])
                    (const_int 1 [0x1])
                    (const_int 0 [0]))
                (const_int 0 [0])))
        (clobber (reg:CC 17 flags))
    ])
etc.  Perhaps if everything fails, if for and with constant it would just try
to call nonzero_bits on the non-constant operand and if only bits set in the
constant mask are set, it would try to match the stmt into a plain assignment?


      parent reply	other threads:[~2015-01-16 17:28 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 ` [Bug tree-optimization/63464] " jakub at gcc dot gnu.org
2014-10-06 11:52 ` 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 [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=bug-63464-4-V1GvxgYCFp@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).