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:53:00 -0000	[thread overview]
Message-ID: <bug-50168-4-ESDBEHGBYB@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 #9 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-08-24 09:48:20 UTC ---
(In reply to comment #7)
> Hm, so the best thing we can do is a peephole recognizing that
> 
>   10:   48 0f bc ff             bsf    %rdi,%rdi
>   14:   48 63 ff                movslq %edi,%rdi
> 
> when rdi is zero it will stay so and the movslq is redundant?

I don't think so.  While the SandyBridge CPU seems to behave that way, there is
no such guarantee in the Intel manuals which say that the destination value is
undefined if zero-flag is cleared (i.e. the source was zero) and thus some
older or future CPUs might behave differently.


  parent reply	other threads:[~2011-08-24  9:49 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
2011-08-24  9:53 ` jakub at gcc dot gnu.org [this message]
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-ESDBEHGBYB@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).