public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/97873] New: Failure to optimize abs optimally (at least one useless instruction on x86)
@ 2020-11-17 10:05 gabravier at gmail dot com
  2020-11-17 15:30 ` [Bug target/97873] Failure to optimize abs optimally (at least one completely " rguenth at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: gabravier at gmail dot com @ 2020-11-17 10:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97873
           Summary: Failure to optimize abs optimally (at least one
                    useless instruction on x86)
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

int abs(int x)
{
        return (x < 0) ? -x : x;
}

For x86 -O3, LLVM outputs this:

abs:
  mov eax, edi
  neg eax
  cmovl eax, edi
  ret

GCC outputs this:

abs:
  mov eax, edi
  neg eax
  cmp eax, edi
  cmovl eax, edi
  ret

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

end of thread, other threads:[~2020-11-20 14:22 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-17 10:05 [Bug tree-optimization/97873] New: Failure to optimize abs optimally (at least one useless instruction on x86) gabravier at gmail dot com
2020-11-17 15:30 ` [Bug target/97873] Failure to optimize abs optimally (at least one completely " rguenth at gcc dot gnu.org
2020-11-17 15:32 ` rguenth at gcc dot gnu.org
2020-11-18  5:16 ` crazylht at gmail dot com
2020-11-18 13:45 ` jakub at gcc dot gnu.org
2020-11-18 18:23 ` ubizjak at gmail dot com
2020-11-18 18:54 ` ubizjak at gmail dot com
2020-11-18 19:38 ` ubizjak at gmail dot com
2020-11-19 16:56 ` ubizjak at gmail dot com
2020-11-20 10:26 ` ubizjak at gmail dot com
2020-11-20 10:26 ` ubizjak at gmail dot com
2020-11-20 14:22 ` 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).