[llvm-bugs] [Bug 42291] New: [X86] TZCNT should be a separate CPU feature?
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Jun 16 09:15:00 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42291
Bug ID: 42291
Summary: [X86] TZCNT should be a separate CPU feature?
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: lebedev.ri at gmail.com
CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
llvm-dev at redking.me.uk, spatel+llvm at rotateright.com
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, at 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 (https://github.com/llvm-mirror/clang.git
fecd5a1c92f86f9dd15e8aea516c0e7d21f46dac)
(https://github.com/llvm-mirror/llvm.git
50613bd4fdcec438dd605506550709322262cf5b)"
.section ".note.GNU-stack","", at progbits
.addrsig
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190616/50ccc069/attachment-0001.html>
More information about the llvm-bugs
mailing list