<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 --- - cost model of slp vectorizer needs to be architecture aware"
href="https://llvm.org/bugs/show_bug.cgi?id=23510">23510</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>cost model of slp vectorizer needs to be architecture aware
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Loop Optimizer
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>wmi@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=14318" name="attach_14318" title="testcase 1.cc">attachment 14318</a> <a href="attachment.cgi?id=14318&action=edit" title="testcase 1.cc">[details]</a></span>
testcase 1.cc
For the testcase 1.cc attached, on x86,
~/workarea/llvm-r236609/build/bin/clang++ -O2 -std=c++11
-fno-omit-frame-pointer -fno-exceptions -fno-omit-frame-pointer
-fno-strict-aliasing -funsigned-char -S 1.cc
In func _Z8DistanceIlLi5EEvPfiPmS0_:
Without slp:
movq $5, (%rdx)
movslq %esi, %rax
leaq (%rdi,%rax,4), %r8
movss 20(%rdi,%rax,4), %xmm0 # xmm0 = mem[0],zero,zero,zero
addss 12(%rcx), %xmm0
movss %xmm0, 12(%rcx)
movq (%rdx), %rdi
movq %rdi, %rsi
shrq $5, %rdi
movq %rdi, (%rdx)
shrq $5, 8(%rdx)
shrq $5, 16(%rdx)
shrq $3, %rsi
shrq $5, 24(%rdx)
leaq (%r8,%rax,4), %rax
andl $20, %esi
movss (%rsi,%rax), %xmm0 # xmm0 = mem[0],zero,zero,zero
addss (%rcx), %xmm0
movss %xmm0, (%rcx)
retq
With slp:
movq $5, (%rdx)
movslq %esi, %rax
leaq (%rdi,%rax,4), %r8
movss 20(%rdi,%rax,4), %xmm0 # xmm0 = mem[0],zero,zero,zero
addss 12(%rcx), %xmm0
movss %xmm0, 12(%rcx)
movq (%rdx), %rdi
movq %rdi, %rsi
shrq $3, %rsi
shrq $5, %rdi
movq %rdi, (%rdx)
movdqu 8(%rdx), %xmm0
psrlq $5, %xmm0
movdqu %xmm0, 8(%rdx)
shrq $5, 24(%rdx)
leaq (%r8,%rax,4), %rax
andl $20, %esi
movss (%rsi,%rax), %xmm0 # xmm0 = mem[0],zero,zero,zero
addss (%rcx), %xmm0
movss %xmm0, (%rcx)
retq
slp vectorizer convert the following
shrq $5, 8(%rdx)
shrq $5, 16(%rdx)
to:
movdqu 8(%rdx), %xmm0
psrlq $5, %xmm0
movdqu %xmm0, 8(%rdx)
The cost of latter is higher than the former. psrlq does't support the form:
psrlq $5, 8(%rdx) but slp cost model is not aware of it.
Turning off slp vectorizer improved a benchmark by 10%.</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>