[Bug tree-optimization/115976] Missing uadd_sat/usub_sat vectorization

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jul 17 22:05:09 GMT 2024


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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note f2 should really be:
```
void f2(unsigned *__restrict__  a, unsigned * __restrict__ b)
{
        for(int i = 0;i < 1024;i ++)
        {
          long long ta = a[i];
          long long tb = b[i];
          long long tt = ta - tb;
          if (tt < 0)
            tt = 0;
          if (tt > (long long)(unsigned long long)(unsigned)-1u)
            tt = -1u;

          a[i] = tt;
        }
}
```

Because `0 - 10` saturates to `0` rather than to `UINT_MAX`. I accidently made
the idea there.


More information about the Gcc-bugs mailing list