[Bug tree-optimization/97690] (cond ? 2 : 0) is not optimized to int(cond) << 1

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 3 10:37:40 GMT 2020


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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
More generally, Clang seems to reliably turn

cond ? (2<<N) : 0

into:

int(bool(cond)) << N


Including when using immediates or constants in places of 2<<N and 0.


More information about the Gcc-bugs mailing list