[Bug tree-optimization/126727] New: smax(a-b,b-a) -> abs(a-b)

"pinskia at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126727

            Bug ID: 126727
           Summary: smax(a-b,b-a) -> abs(a-b)
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: easyhack, 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:
```

int __GIMPLE (ssa)
f2 (int a, int b)
{
  int t;
  int _3;

  __BB(2):
  t_2 = a_1(D) - b_5(D);
  t_4 = b_5(D) - a_1(D);
  _3 = __MAX (t_2, t_4);
  return _3;
}
```

This is not optimized to ABS(t_2)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.