public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/98713] New: Failure to generate branch version of abs if user requested it
@ 2021-01-17 20:08 david.bolvansky at gmail dot com
  2021-01-18  8:44 ` [Bug middle-end/98713] " marxin at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: david.bolvansky at gmail dot com @ 2021-01-17 20:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98713
           Summary: Failure to generate branch version of abs if user
                    requested it
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: david.bolvansky at gmail dot com
  Target Milestone: ---

int branch_abs(int v) {
    return __builtin_expect(v > 0, 1) ? v : -v;
}

GCC -O2 now:

branch_abs:
  mov eax, edi
  neg eax
  cmovs eax, edi
  ret


Expected:
branch_abs:
  mov eax, edi
  test edi, edi
  js .LBB0_1
  ret
.LBB0_1:
  neg eax
  ret


Same for min/max.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-09-26  9:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-17 20:08 [Bug c/98713] New: Failure to generate branch version of abs if user requested it 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
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

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).