[Bug middle-end/101955] (signed<<31)>>31 should become -(signed&1)
navidrahimi at microsoft dot com
gcc-bugzilla@gcc.gnu.org
Thu Nov 11 00:21:31 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101955
navidrahimi <navidrahimi at microsoft dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |navidrahimi at microsoft dot com
--- Comment #5 from navidrahimi <navidrahimi at microsoft dot com> ---
I think rather than just
int f(int b)
{
return (((b)<<31)>>31);
}
We should optimize long too:
int f(int b)
{
return (((b)<<63)>>63);
}
1) https://compiler-explorer.com/z/dnrr54v4r
More information about the Gcc-bugs
mailing list