public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/98060] New: Failure to optimize cmp+setnb+add to cmp+sbb
@ 2020-11-29 23:07 gabravier at gmail dot com
  2020-11-30 16:21 ` [Bug target/98060] " ubizjak at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: gabravier at gmail dot com @ 2020-11-29 23:07 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98060
           Summary: Failure to optimize cmp+setnb+add to cmp+sbb
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

int r(unsigned v0, unsigned v1, int v2)
{
    return (v0 >= v1) + v2;
}

This code, on x86, can be implemented with `cmp` followed by `sbb`. This
optimization is done by LLVM, but not by GCC.

-O3 x86 output on LLVM :

r:
  mov eax, edx
  cmp edi, esi
  sbb eax, -1
  ret

On GCC :

r:
  xor eax, eax
  cmp edi, esi
  setnb al
  add eax, edx
  ret

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

end of thread, other threads:[~2021-04-30  8:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-29 23:07 [Bug target/98060] New: Failure to optimize cmp+setnb+add to cmp+sbb gabravier at gmail dot com
2020-11-30 16:21 ` [Bug target/98060] " ubizjak at gmail dot com
2020-12-02 15:31 ` ubizjak at gmail dot com
2020-12-02 15:42 ` ubizjak at gmail dot com
2020-12-02 19:47 ` ubizjak at gmail dot com
2020-12-18 15:19 ` ubizjak at gmail dot com
2021-04-30  8:16 ` cvs-commit at gcc dot gnu.org
2021-04-30  8:39 ` ubizjak at gmail dot com

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