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

--- Comment #5 from Zoltan Hidvegi <zoltan at hidvegi dot com> ---
I've compiled this:

unsigned long bar2(unsigned long x) { return __builtin_clzg(x, 64); }
unsigned long bar3(unsigned long x) { return x ? __builtin_clzl(x) : 64; }

gcc -march=skylake -mlzcnt -mpopcnt -O2 -S clztest.c
gives this:

bar2:
        xorl    %eax, %eax
        lzcntq  %rdi, %rax
        ret
bar3:
        xorl    %eax, %eax
        movl    $64, %edx
        lzcntq  %rdi, %rax
        testq   %rdi, %rdi
        cmove   %rdx, %rax
        ret

Reply via email to