public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/94798] New: Failure to optimize subtraction and 0 literal properly
@ 2020-04-27 13:47 gabravier at gmail dot com
  2020-04-27 15:06 ` [Bug rtl-optimization/94798] " glisse at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: gabravier at gmail dot com @ 2020-04-27 13:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94798
           Summary: Failure to optimize subtraction and 0 literal properly
           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: ---

int f(int a, int b)
{
    return (b >= a) ? (b - a) : 0;
}

Generates some *really* bad code with GCC right now, it seems to forget such
basic things as how to set a register to 0 on x86. LLVM generates good code.

Comparison here : https://godbolt.org/z/LZ8dBy

Also, this seems to have regressed back in GCC 4.9, GCC 4.8 at least generates
a `xor reg, reg` instead of a `mov reg, 0`

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

end of thread, other threads:[~2021-09-04 23:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-27 13:47 [Bug rtl-optimization/94798] New: Failure to optimize subtraction and 0 literal properly gabravier at gmail dot com
2020-04-27 15:06 ` [Bug rtl-optimization/94798] " glisse at gcc dot gnu.org
2020-04-27 15:34 ` gabravier at gmail dot com
2020-04-27 15:51 ` jakub at gcc dot gnu.org
2020-05-07 17:21 ` jakub at gcc dot gnu.org
2021-01-02  8:45 ` jakub at gcc dot gnu.org
2021-08-14  9:54 ` pinskia at gcc dot gnu.org
2021-09-04 23:57 ` 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).