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

--- Comment #1 from Andi Kleen <andi-gcc at firstfloor dot org> ---
typedef unsigned u;
u bzhi(u src, u inx) { return src & ((1 << inx) - 1); } 


with -O2 -march=skylake generates

        movl    %esi, %r8d
        movl    $1, %esi
        shlx    %r8d, %esi, %esi
        leal    -1(%rsi), %eax
        andl    %edi, %eax
        ret


clang generates the expected
        bzhil   %esi, %edi, %eax
        retq

Reply via email to