[llvm-bugs] [Bug 48662] New: SLP vectorizer produces lower performance code
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jan 5 03:09:35 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=48662
Bug ID: 48662
Summary: SLP vectorizer produces lower performance code
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: chfast at gmail.com
CC: llvm-bugs at lists.llvm.org
The code just checks if array uint64_t[4] has all zeros.
using u64 = unsigned long;
struct u256
{
u64 w[4];
};
bool iszero(const u256& u)
{
return (u.w[0] == 0) & (u.w[1] == 0) & (u.w[2] == 0) & (u.w[3] == 0);
}
Without SLP vectorization (-fno-slp-vectorize) the compiler produces nice OR
folding:
iszero(u256 const&): # @iszero(u256 const&)
mov rax, qword ptr [rdi + 8]
or rax, qword ptr [rdi]
or rax, qword ptr [rdi + 16]
or rax, qword ptr [rdi + 24]
sete al
ret
With SLP vectorization (default):
iszero(u256 const&): # @iszero(u256 const&)
movdqu xmm0, xmmword ptr [rdi]
movdqu xmm1, xmmword ptr [rdi + 16]
por xmm1, xmm0
pxor xmm0, xmm0
pcmpeqb xmm0, xmm1
pmovmskb eax, xmm0
cmp eax, 65535
sete al
ret
>From llvm-mca the vectorized code may have higher throughput but higher
latency. In my real life usage of similar code I can definitely notice the
performance degradation.
https://godbolt.org/z/z19EPc
--
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/20210105/cc2fc49d/attachment.html>
More information about the llvm-bugs
mailing list