public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bonzini at gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/53087] [powerpc] Poor code from cstore expander
Date: Wed, 25 Apr 2012 20:02:00 -0000	[thread overview]
Message-ID: <bug-53087-4-sx04jfv0zC@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-53087-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53087

--- Comment #9 from Paolo Bonzini <bonzini at gnu dot org> 2012-04-25 20:00:57 UTC ---
The handling of this code sequence in fold-const changed back and forth many
times, and this is likely the reason why GCC 4.1 produced straight-line code
while GCC 4.3 produced branchy code.

I think the best fix is to add support for expanding "x != 0" using the cntlzw
trick---either in the cstore expander or in emit_store_flag.

In fact, emit_store_flag already has code for a similar trick:

      /* For EQ or NE, one way to do the comparison is to apply an operation
         that converts the operand into a positive number if it is nonzero
         or zero if it was originally zero.  Then, for EQ, we subtract 1 and
         for NE we negate.  This puts the result in the sign bit.  Then we
         normalize with a shift, if needed.

         Two operations that can do the above actions are ABS and FFS, so try
         them.  If that doesn't work, and MODE is smaller than a full word,
         we can use zero-extension to the wider mode (an unsigned conversion)
         as the operation.  */

So another thing to do is to investigate why this doesn't work.


  parent reply	other threads:[~2012-04-25 20:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-23 16:36 [Bug target/53087] New: Poor code for conversion from _Bool to int steven at gcc dot gnu.org
2012-04-23 16:42 ` [Bug target/53087] " steven at gcc dot gnu.org
2012-04-23 17:13 ` steven at gcc dot gnu.org
2012-04-23 20:12 ` [Bug target/53087] [powerpc] Poor code from cstore expander steven at gcc dot gnu.org
2012-04-23 20:13 ` steven at gcc dot gnu.org
2012-04-23 20:24 ` dje at gcc dot gnu.org
2012-04-24  0:41 ` dje at gcc dot gnu.org
2012-04-25  5:27 ` amodra at gmail dot com
2012-04-25 12:59 ` amodra at gmail dot com
2012-04-25 20:02 ` bonzini at gnu dot org [this message]
2012-04-26 15:53 ` bonzini at gnu dot org
2012-09-26  5:19 ` segher at gcc dot gnu.org
2012-09-26  5:42 ` segher at gcc dot gnu.org
2012-11-08 23:02 ` steven 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-53087-4-sx04jfv0zC@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).