<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] KTEST instruction emitted for signed comparisons despite it always clearing S flag"
href="https://bugs.llvm.org/show_bug.cgi?id=36182">36182</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[X86] KTEST instruction emitted for signed comparisons despite it always clearing S flag
</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>craig.topper@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>declare void @foo()
define void @bar(<16 x i32> %x, <16 x i32> %y) {
%a = icmp eq <16 x i32> %x, zeroinitializer
%b = icmp eq <16 x i32> %y, zeroinitializer
%c = and <16 x i1> %a, %b
%d = bitcast <16 x i1> %c to i16
%e = icmp slt i16 %d, 0
br i1 %e, label %end, label %call
call:
call void @foo()
br label %end
end:
ret void
}
This IR
Produces this assembly
bar: # @bar
.cfi_startproc
# %bb.0:
pushq %rax
.cfi_def_cfa_offset 16
vporq %zmm1, %zmm0, %zmm0
vptestnmd %zmm0, %zmm0, %k0
ktestw %k0, %k0
js .LBB0_2
# %bb.1: # %call
vzeroupper
callq foo
.LBB0_2: # %end
popq %rax
vzeroupper
retq
.Lfunc_end0:
.size bar, .Lfunc_end0-bar
.cfi_endproc
# -- End function
Which is broken because KTEST always 0s the S flag.</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>