http://llvm.org/bugs/show_bug.cgi?id=17038

            Bug ID: 17038
           Summary: bzhi not generated
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

$ ./clang -v
clang version 3.4 (trunk 189409)
Target: x86_64-apple-darwin11.4.2
Thread model: posix

$ cat bzhi.c 
int foo(int x, unsigned char index) {
    return (x & ((1 << index) - 1));
}

$ ./clang -S -O3 -march=core-avx2 bzhi.c -o /dev/stdout 
    .section    __TEXT,__text,regular,pure_instructions
    .globl    _foo
    .align    4, 0x90
_foo:                                   ## @foo
    .cfi_startproc
## BB#0:                                ## %entry
    pushq    %rbp
Ltmp2:
    .cfi_def_cfa_offset 16
Ltmp3:
    .cfi_offset %rbp, -16
    movq    %rsp, %rbp
Ltmp4:
    .cfi_def_cfa_register %rbp
    movl    $1, %eax
    shlxl    %esi, %eax, %eax
    decl    %eax
    andl    %edi, %eax
    popq    %rbp
    ret

...

I was expecting this code sequence to generate the BMI2 instruction 'BZHI'
rather than mov/shift/subtract/and. Something like this:

bzhi %esi, %edi, %eax

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to