<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 - Missed opportunity to eliminate copy due to suboptimal scheduling"
href="https://bugs.llvm.org/show_bug.cgi?id=32719">32719</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Missed opportunity to eliminate copy due to suboptimal scheduling
</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>Windows NT
</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>zvi.rackover@intel.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Forking from <a href="https://reviews.llvm.org/D31961#inline-276908">https://reviews.llvm.org/D31961#inline-276908</a>.
For the following equivalent functions:
define <4 x i32> @foo(<4 x i32> %v, <4 x i32> *%p) {
%a = shufflevector <4 x i32> %v, <4 x i32> undef, <4 x i32> <i32 2, i32 3,
i32 2, i32 3>
%b = shufflevector <4 x i32> %v, <4 x i32> undef, <4 x i32> <i32 3, i32 3,
i32 3, i32 2>
store <4 x i32> %a, <4 x i32>* %p
ret <4 x i32> %b
}
define <4 x i32> @bar(<4 x i32> %v, <4 x i32> *%p) {
%b = shufflevector <4 x i32> %v, <4 x i32> undef, <4 x i32> <i32 3, i32 3,
i32 3, i32 2>
%a = shufflevector <4 x i32> %v, <4 x i32> undef, <4 x i32> <i32 2, i32 3,
i32 2, i32 3>
store <4 x i32> %a, <4 x i32>* %p
ret <4 x i32> %b
}
llc -mcpu=skylake will generate
foo:
vpshufd $238, %xmm0, %xmm1 # xmm1 = xmm0[2,3,2,3]
vpshufd $191, %xmm0, %xmm0 # xmm0 = xmm0[3,3,3,2]
vmovdqa %xmm1, (%rdi)
retq
bar:
vpshufd $191, %xmm0, %xmm1 # xmm1 = xmm0[3,3,3,2]
vpshufd $238, %xmm0, %xmm0 # xmm0 = xmm0[2,3,2,3]
vmovdqa %xmm0, (%rdi)
vmovdqa %xmm1, %xmm0
retq
Notice the extra copy in the function 'bar'.
Seems like we are sensitive to the scheduling that happens in Isel.
Is the post-RA scheduling, which we don't do for X86, supposed to handle this
case or is there another way to improve this case?</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>