<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 - [SLP] convert multiple scalar comparisons into vector comparison and horizontal reduction"
href="https://bugs.llvm.org/show_bug.cgi?id=32078">32078</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[SLP] convert multiple scalar comparisons into vector comparison and horizontal reduction
</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>All
</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>Transformation Utilities
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>spatel+llvm@rotateright.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>define i1 @cmpv2f32(<2 x i32> %x, <2 x i32> %y) {
entry:
%x0 = extractelement <2 x i32> %x, i32 0
%y0 = extractelement <2 x i32> %y, i32 0
%cmp0 = icmp eq i32 %x0, %y0
br i1 %cmp0, label %if, label %endif
if:
%x1 = extractelement <2 x i32> %x, i32 1
%y1 = extractelement <2 x i32> %y, i32 1
%cmp1 = icmp eq i32 %x1, %y1
br label %endif
endif:
%and_of_cmps = phi i1 [ false, %entry ], [ %cmp1, %if ]
ret i1 %and_of_cmps
}
------------------------------------------------------------------------------
Can we (instcombine + SLP vectorizer?) transform this to:
define i1 @rrcmpv2f32(<2 x i32> %x, <2 x i32> %y) {
%vcmp = icmp eq <2 x i32> %x, %y
%cmp0 = extractelement <2 x i1> %vcmp, i32 0
%cmp1 = extractelement <2 x i1> %vcmp, i32 1
%and_of_cmps = and i1 %cmp0, %cmp1
ret i1 %and_of_cmps
}
------------------------------------------------------------------------------
This example is reduced from source for an x86 target, so the ultimate goal is
to have this produce a vector compare and 'movmsk':
bool cmpv4f32_0(__m128 a, __m128 b) {
union {
__m128 v;
int i32[4];
} _a, _b;
_a.v = a;
_b.v = b;
return (_a.i32[0] == _b.i32[0] &&
_a.i32[1] == _b.i32[1] &&
_a.i32[2] == _b.i32[2] &&
_a.i32[3] == _b.i32[3]);
}</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>