public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/94857] New: Failure to optimize load+add+store into add on memory when getting carry flag afterwards on x86
@ 2020-04-29 17:45 gabravier at gmail dot com
  2020-04-30  6:51 ` [Bug target/94857] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: gabravier at gmail dot com @ 2020-04-29 17:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94857
           Summary: Failure to optimize load+add+store into add on memory
                    when getting carry flag afterwards on x86
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

bool f(unsigned *p, unsigned x)
{
    unsigned u = *p;
    *p += x;
    return u > *p;
}

With -O3, LLVM outputs :

f(unsigned int*, unsigned int): # @f(unsigned int*, unsigned int)
  add dword ptr [rdi], esi
  setb al
  ret

GCC outputs :

f(unsigned int*, unsigned int):
  add esi, DWORD PTR [rdi]
  mov DWORD PTR [rdi], esi
  setc al
  ret

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

end of thread, other threads:[~2020-05-08  8:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-29 17:45 [Bug rtl-optimization/94857] New: Failure to optimize load+add+store into add on memory when getting carry flag afterwards on x86 gabravier at gmail dot com
2020-04-30  6:51 ` [Bug target/94857] " rguenth at gcc dot gnu.org
2020-05-07 17:36 ` jakub at gcc dot gnu.org
2020-05-07 18:59 ` jakub at gcc dot gnu.org
2020-05-08  8:05 ` cvs-commit at gcc dot gnu.org
2020-05-08  8:06 ` jakub 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).