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

            Bug ID: 112416
           Summary: absu is not detected
           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
            Blocks: 112324
  Target Milestone: ---
            Target: aarch64

Another case where ABSU is not detected:
```
static inline
int f(int a)
{
  return (a<0)?-(unsigned)a : a;
}

void f1(int *a, int n)
{
  for(int i = 0; i < n; i++)
    a[i] = f(a[i]);
}

static inline
int g(int a)
{
  return (a<0)?-a : a;
}

void g1(int *a, int n)
{
  for(int i = 0; i < n; i++)
    a[i] = g(a[i]);
}
```

As you can see abs is detected for g/g1 but not for f/f1.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112324
[Bug 112324] phiopt fail to recog if (b < 0) max = MAX(-b, max); else max = MAX
(b, max) into max = MAX (ABS(b), max)

Reply via email to