https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101175
--- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Mikael Pettersson from comment #2)
> (In reply to Iru Cai from comment #0)
> > Built with '-march=x86-64-v3 -O1', the following code generates a bsr
> > instruction, which has undefined behavior when the source operand is zero,
> > thus gives wrong result
>
> The documentation for __builtin_clz(x) states "If x is 0, the result is
> undefined".
The testcase from Comment #0 does:
if (value != 0) {
return __builtin_clz(value);