https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104357
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot
gnu.org
Status|NEW |ASSIGNED
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
One thing I should note:
_7 = x_3(D) >= 0;
_6 = (unsigned char) _7;
_8 = -_6;
Should be done on the gimple level as:
t = x_3(D) >> (sizeof(x_3(D))*8 - 1)
_8 = (unsigned char)t;
And then we can factor out the cast and I think it will produce the same code.
And yes it does, that is:
unsigned char stbi__clamp(int x)
{
int t = x;
if ((unsigned)x > 255) {
t = x >> 31;
}
return t;
}
So Mine for GCC 13.