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 middle-end/50168] __builtin_ctz() and intrinsics __bsr(), __bsf() generate suboptimal code on x86_64
Date: Wed, 24 Aug 2011 09:49:00 -0000	[thread overview]
Message-ID: <bug-50168-4-D1AUAdl15J@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-50168-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-08-24 09:45:56 UTC ---
What we IMHO should optimize and don't currently is the redundant sign
extension when using __builtin_ffsl - as it internally uses bsf + cmove,
nonzero_bits isn't able to figure out that the result of the sequence is
guaranteed to have nonzero-bits.  Perhaps we should in that case add a
REG_EQUAL note to the last insn in the sequence and perhaps nonzero_bits could
also look at REG_EQUAL notes.  Doing that could perhaps help even testcases
like:
int foo (long x)
{
  return __builtin_popcountl (x) & 0xff;
}
where the andl $0x255, %eax could be optimized away, etc.


  parent reply	other threads:[~2011-08-24  9:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-23 16:40 [Bug c/50168] New: " gpiez at web dot de
2011-08-23 17:00 ` [Bug c/50168] " jakub at gcc dot gnu.org
2011-08-23 18:07 ` jakub at gcc dot gnu.org
2011-08-23 22:01 ` gpiez at web dot de
2011-08-23 23:53 ` gpiez at web dot de
2011-08-24  8:18 ` [Bug middle-end/50168] " rguenth at gcc dot gnu.org
2011-08-24  9:41 ` jakub at gcc dot gnu.org
2011-08-24  9:47 ` rguenth at gcc dot gnu.org
2011-08-24  9:49 ` jakub at gcc dot gnu.org [this message]
2011-08-24  9:53 ` jakub at gcc dot gnu.org
2021-08-08 22:48 ` [Bug middle-end/50168] __builtin_ctz() and intrinsics __bsr(), __bsf() generate extra sign extend " pinskia 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-50168-4-D1AUAdl15J@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).