public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/110068] New: missing min detection
@ 2023-06-01  3:30 pinskia at gcc dot gnu.org
  2023-06-01  3:49 ` [Bug tree-optimization/110068] " pinskia at gcc dot gnu.org
  2023-09-10  6:58 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-01  3:30 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110068
           Summary: missing min detection
           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:
```
#define min1(x,y) ((x) < (y) ? (x) : (y))
#define min2(x,y) ((x) <= (y) ? (x) : (y))
static inline unsigned
min3(unsigned x, unsigned y)
{
        return min1(x, y);
}
static inline unsigned
min4(unsigned x, unsigned y)
{
        return min3(x, y);
}
unsigned 
f1 (unsigned  x)
{
  return min1(x, 1U<<(sizeof(x)*8-1));
}
unsigned
f2 (unsigned  x)
{
  return min2(x, 1U<<(sizeof(x)*8-1));
}
unsigned
f3 (unsigned  x)
{
  return min3(x, 1U<<(sizeof(x)*8-1));
}
unsigned
f4 (unsigned  x)
{
  return min4(x, 1U<<(sizeof(x)*8-1));
}
```
f1,f2,f3, and f4 should all produce MIN_EXPRs but currently f1 does not.
I would have thought r11-1504-g2e0f4a18bc978  fixed this case but it does not.

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

end of thread, other threads:[~2023-09-10  6:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-01  3:30 [Bug tree-optimization/110068] New: missing min detection pinskia at gcc dot gnu.org
2023-06-01  3:49 ` [Bug tree-optimization/110068] " pinskia at gcc dot gnu.org
2023-09-10  6:58 ` 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).