public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/111595] New: detection of MIN/MAX with truncation and sign change for the result
@ 2023-09-26  5:20 pinskia at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: pinskia at gcc dot gnu.org @ 2023-09-26  5:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111595
           Summary: detection of MIN/MAX with truncation and sign change
                    for the result
           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:
```
unsigned short f(long a, long b)
{
        short as = a;
        short bs = b;
        unsigned short asu = a;
        unsigned short bsu = b;
        if (as < bs) return asu;
        return bsu;
}
unsigned short f0(long a, long b)
{
        short as = a;
        short bs = b;
        unsigned short asu = a;
        unsigned short bsu = b;
        if (as < bs) return as;
        return bs;
}

unsigned short f1(long a, long b)
{
        short as = a;
        short bs = b;
        unsigned short asu = a;
        unsigned short bsu = b;
        signed short t;
        if (as < bs) t = as;
        else t = bs;
        return t;
}
```

Currently only f1 detects MIN here. They all should produce the same IR in the
end.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-26  5:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-26  5:20 [Bug tree-optimization/111595] New: detection of MIN/MAX with truncation and sign change for the result 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).