<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 - [X86] Different codegen icmp_eq(and(x,maskbit),maskbit) vs icmp_ne(and(x,maskbit),0)"
href="https://bugs.llvm.org/show_bug.cgi?id=41672">41672</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[X86] Different codegen icmp_eq(and(x,maskbit),maskbit) vs icmp_ne(and(x,maskbit),0)
</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>llvm-dev@redking.me.uk
</td>
</tr>
<tr>
<th>CC</th>
<td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, spatel+llvm@rotateright.com
</td>
</tr></table>
<p>
<div>
<pre>As mentioned on <a href="https://reviews.llvm.org/D61189">https://reviews.llvm.org/D61189</a>
when performing bit tests:
icmp_eq(and(x,maskbit),maskbit)
gives different results to:
icmp_ne(and(x,maskbit),0):
<a href="https://godbolt.org/z/78ko0B">https://godbolt.org/z/78ko0B</a>
define i32 @test(<4 x i32> %a0) {
%1 = icmp slt <4 x i32> %a0, zeroinitializer
%2 = bitcast <4 x i1> %1 to i4
%3 = zext i4 %2 to i32
%4 = and i32 %3, 1
%5 = and i32 %3, 2
%6 = icmp eq i32 %4, 1
%7 = icmp eq i32 %5, 2
%8 = zext i1 %6 to i32
%9 = zext i1 %7 to i32
%10 = and i32 %8, %9
ret i32 %10
}
define i32 @cmp0(<4 x i32> %a0) {
%1 = icmp slt <4 x i32> %a0, zeroinitializer
%2 = bitcast <4 x i1> %1 to i4
%3 = zext i4 %2 to i32
%4 = and i32 %3, 1
%5 = and i32 %3, 2
%6 = icmp ne i32 %4, 0
%7 = icmp ne i32 %5, 0
%8 = zext i1 %6 to i32
%9 = zext i1 %7 to i32
%10 = and i32 %8, %9
ret i32 %10
}
test:
vmovmskps %xmm0, %ecx
xorl %eax, %eax
notl %ecx
testb $3, %cl
sete %al
retq
cmp0:
vmovmskps %xmm0, %ecx
movl %ecx, %eax
andl $2, %eax
shrl %eax
andl %ecx, %eax
retq</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>