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)