[llvm-bugs] [Bug 31810] New: llvm.bitreverse.i8 on x86 lowers to questionable assembly
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jan 31 01:58:59 PST 2017
https://llvm.org/bugs/show_bug.cgi?id=31810
Bug ID: 31810
Summary: llvm.bitreverse.i8 on x86 lowers to questionable
assembly
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: gonzalobg88 at gmail.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
On x86 the 32 and 64 bit versions of bitreverse look very good, but the
generated code for the 8-bit version looks worse than the naive implementation:
https://godbolt.org/g/kAlOC7
@bitrev_8_naive(unsigned char)
mov eax, 2149582850
imul rax, rdi
movabs rcx, 36578664720
and rcx, rax
movabs rax, 4311810305
imul rax, rcx
shr rax, 32
ret
vs llvm.bitreverse.i8:
@bitrev_8(unsigned char)
rol dil, 4
mov eax, edi
and al, 51
shl al, 2
and dil, -52
shr dil, 2
or dil, al
mov eax, edi
and al, 85
add al, al
and dil, -86
shr dil
or dil, al
mov eax, edi
ret
--
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/20170131/ffcefb66/attachment.html>
More information about the llvm-bugs
mailing list