https://gcc.gnu.org/bugzilla/show_bug.cgi?id=29776
Alexander Monakov <amonakov at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |amonakov at gcc dot gnu.org
--- Comment #23 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
In libcpp, search_line_fast implementations suffer from this, and what is
worse, attempts to workaround it by explicitly requesting zero extension don't
work:
char *foo(char *p, int x)
{
return p + (unsigned)__builtin_ctz(x);
}
The above code is deliberately asking for zero extension, and yet various
optimizations in GCC transform it back to costlier form with sign extension.
(FWIW, LLVM gets this right)