public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "roger at nextmovesoftware dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/98713] Failure to generate branch version of abs if user requested it
Date: Mon, 18 Jan 2021 09:19:52 +0000	[thread overview]
Message-ID: <bug-98713-4-RKl2QpEXm3@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-98713-4@http.gcc.gnu.org/bugzilla/>

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

Roger Sayle <roger at nextmovesoftware dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |roger at nextmovesoftware dot com

--- Comment #2 from Roger Sayle <roger at nextmovesoftware dot com> ---
My first impression is that this isn't a bug, it's a feature.  In an optimizing
compiler, the user specifies the computation to be performed and the compiler
selects the implementation.  Hence "x+0" isn't a user request to perform an
addition.

Perhaps David could provide more information on why a branch implementation is
required/preferred (for example on which target)?  On generic x86_64, I believe
the code currently generated is both smaller and faster.  Assuming "neg eax"
takes about the same time as "test edi,edi", and that "cmovs" takes about the
same time as (either branch) of "js".

As a workaround a branch version can be implemented in inline assembly using
__asm, but I'm still hazy as to why this would be desirable.

  parent reply	other threads:[~2021-01-18  9:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-17 20:08 [Bug c/98713] New: " david.bolvansky at gmail dot com
2021-01-18  8:44 ` [Bug middle-end/98713] " marxin at gcc dot gnu.org
2021-01-18  9:19 ` roger at nextmovesoftware dot com [this message]
2021-01-18  9:35 ` rguenth at gcc dot gnu.org
2021-01-18  9:45 ` ubizjak at gmail dot com
2021-01-18 10:31 ` david.bolvansky at gmail dot com
2021-01-18 10:34 ` jakub at gcc dot gnu.org
2021-01-18 11:46 ` roger at nextmovesoftware dot com
2021-01-18 14:03 ` jakub at gcc dot gnu.org
2021-09-26  9:41 ` pinskia at gcc dot gnu.org
2021-09-26  9:42 ` 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-98713-4-RKl2QpEXm3@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).