<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [X86] TZCNT should be a separate CPU feature?"
   href="https://bugs.llvm.org/show_bug.cgi?id=42291">42291</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[X86] TZCNT should be a separate CPU feature?
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: X86
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>lebedev.ri@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Currently there are FeaturePOPCNT, FeatureLZCNT.
Nominally, POPCNT and LZCNT are part of ABM instruction set,
and TZCNT is part of BMI1.

But i'm seeing something weird here:

 ./bin/llvm-exegesis --opcode-name=TZCNT32rr --benchmarks-file=- --mode=latency
Check generated assembly with: /usr/bin/objdump -d /tmp/snippet-fe658c.o
---
mode:            latency
key:             
  instructions:    
    - 'TZCNT32rr R11D R11D'
  config:          ''
  register_initial_values: 
    - 'R11D=0x0'
cpu_name:        amdfam10
llvm_triple:     x86_64-unknown-linux-gnu
num_repetitions: 10000
measurements:    
  - { key: latency, value: 4.0207, per_snippet_value: 4.0207 }
error:           ''
info:            Repeating a single explicitly serial instruction
assembled_snippet:
41BB00000000F3450FBCDBF3450FBCDBF3450FBCDBF3450FBCDBF3450FBCDBF3450FBCDBF3450FBCDBF3450FBCDBF3450FBCDBF3450FBCDBF3450FBCDBF3450FBCDBF3450FBCDBF3450FBCDBF3450FBCDBF3450FBCDBC3
...

That CPU does not support BMI1, yet TZCNT32rr works?

$ ./bin/clang -mbmi /tmp/test.cpp && ./a.out ; echo $?
6
$ cat /tmp/test.cpp 
#include <x86intrin.h>

int main(int argc, char* argv[]) {
    return _tzcnt_u32(0b1000000); // yes, i tried with different patterns
}
$ ./bin/clang -mbmi /tmp/test.cpp -o - -S
        .text
        .file   "test.cpp"
        .globl  main                    # -- Begin function main
        .p2align        4, 0x90
        .type   main,@function
main:                                   # @main
        .cfi_startproc
# %bb.0:                                # %entry
        pushq   %rbp
        .cfi_def_cfa_offset 16
        .cfi_offset %rbp, -16
        movq    %rsp, %rbp
        .cfi_def_cfa_register %rbp
        movl    $0, -8(%rbp)
        movl    %edi, -12(%rbp)
        movq    %rsi, -24(%rbp)
        movl    $64, -4(%rbp)
        movl    -4(%rbp), %eax
        tzcntl  %eax, %eax
        popq    %rbp
        .cfi_def_cfa %rsp, 8
        retq
.Lfunc_end0:
        .size   main, .Lfunc_end0-main
        .cfi_endproc
                                        # -- End function

        .ident  "clang version 9.0.0 (<a href="https://github.com/llvm-mirror/clang.git">https://github.com/llvm-mirror/clang.git</a>
fecd5a1c92f86f9dd15e8aea516c0e7d21f46dac)
(<a href="https://github.com/llvm-mirror/llvm.git">https://github.com/llvm-mirror/llvm.git</a>
50613bd4fdcec438dd605506550709322262cf5b)"
        .section        ".note.GNU-stack","",@progbits
        .addrsig</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>