public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/109959] New: `(a > 1) ? 0 : (a == 1)` is not optimized when spelled out
@ 2023-05-24 22:10 pinskia at gcc dot gnu.org
  2023-05-24 22:16 ` [Bug tree-optimization/109959] `(a > 1) ? 0 : (a == 1)` is not optimized when spelled out at -O2+ pinskia at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-24 22:10 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109959
           Summary: `(a > 1) ? 0 : (a == 1)` is not optimized when spelled
                    out
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
_Bool f(unsigned a)
{
        if (a > 1)
          return 0;
        return a == 1;
}


_Bool f0(unsigned a)
{
  return (a > 1) ? 0 : (a == 1);
}
```
Both of these should just optimize to:
`return a == 1`, f0 is currently.

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

end of thread, other threads:[~2023-08-07 14:48 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-24 22:10 [Bug tree-optimization/109959] New: `(a > 1) ? 0 : (a == 1)` is not optimized when spelled out pinskia at gcc dot gnu.org
2023-05-24 22:16 ` [Bug tree-optimization/109959] `(a > 1) ? 0 : (a == 1)` is not optimized when spelled out at -O2+ pinskia at gcc dot gnu.org
2023-05-24 22:17 ` pinskia at gcc dot gnu.org
2023-05-24 22:21 ` pinskia at gcc dot gnu.org
2023-05-25  3:39 ` pinskia at gcc dot gnu.org
2023-05-25  7:57 ` rguenth at gcc dot gnu.org
2023-06-07 22:36 ` pinskia at gcc dot gnu.org
2023-06-07 22:48 ` pinskia at gcc dot gnu.org
2023-08-06 18:19 ` pinskia at gcc dot gnu.org
2023-08-06 21:12 ` pinskia at gcc dot gnu.org
2023-08-07  0:26 ` pinskia at gcc dot gnu.org
2023-08-07  1:52 ` pinskia at gcc dot gnu.org
2023-08-07  5:09 ` pinskia at gcc dot gnu.org
2023-08-07 14:47 ` cvs-commit at gcc dot gnu.org
2023-08-07 14:48 ` 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).