<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 - Failure to merge repeated blend shuffles"
href="https://bugs.llvm.org/show_bug.cgi?id=40502">40502</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Failure to merge repeated blend shuffles
</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>Common Code Generator Code
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>llvm-dev@redking.me.uk
</td>
</tr>
<tr>
<th>CC</th>
<td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, spatel+llvm@rotateright.com
</td>
</tr></table>
<p>
<div>
<pre><a href="https://godbolt.org/z/CDW2iQ">https://godbolt.org/z/CDW2iQ</a>
define void @_Z3fooPiS_S_S_(i32*, i32*, i32*, i32*) {
%5 = bitcast i32* %1 to <4 x i32>*
%6 = load <4 x i32>, <4 x i32>* %5, align 4
%7 = bitcast i32* %2 to <4 x i32>*
%8 = load <4 x i32>, <4 x i32>* %7, align 4
%9 = mul nsw <4 x i32> %8, %6
%10 = add nsw <4 x i32> %8, %6
%11 = shufflevector <4 x i32> %9, <4 x i32> %10, <4 x i32> <i32 0, i32 5, i32
6, i32 3>
%12 = bitcast i32* %3 to <4 x i32>*
%13 = load <4 x i32>, <4 x i32>* %12, align 4
%14 = add nsw <4 x i32> %11, %13
%15 = sub <4 x i32> %11, %13
%16 = shufflevector <4 x i32> %14, <4 x i32> %15, <4 x i32> <i32 0, i32 5,
i32 6, i32 3>
%17 = bitcast i32* %0 to <4 x i32>*
store <4 x i32> %16, <4 x i32>* %17, align 4
ret void
}
The output from the vectorizer uses the same shuffle for the 2 partial paths.
We should be able to combine these (in InstCombine/DAGCombine) to:
define void @_Z7foo_vecPiS_S_S_(i32*, i32*, i32*, i32*) {
%5 = bitcast i32* %1 to <4 x i32>*
%6 = load <4 x i32>, <4 x i32>* %5, align 1
%7 = bitcast i32* %2 to <4 x i32>*
%8 = load <4 x i32>, <4 x i32>* %7, align 1
%9 = bitcast i32* %3 to <4 x i32>*
%10 = load <4 x i32>, <4 x i32>* %9, align 1
%11 = mul <4 x i32> %8, %6
%12 = add <4 x i32> %11, %10
%13 = add <4 x i32> %8, %6
%14 = sub <4 x i32> %13, %10
%15 = shufflevector <4 x i32> %12, <4 x i32> %14, <4 x i32> <i32 0, i32 5,
i32 6, i32 3>
%16 = bitcast i32* %0 to <4 x i32>*
store <4 x i32> %15, <4 x i32>* %16, align 1
ret void
}
I think selects with the same mask could be done as well?</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>