<html>
<head>
<base href="http://llvm.org/bugs/" />
</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 --- - (sext (vzext x)) -> (vsext x) in sign_extend_inreg lowering incorrectly optimize the case when input type is a vector of i1"
href="http://llvm.org/bugs/show_bug.cgi?id=18054">18054</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>(sext (vzext x)) -> (vsext x) in sign_extend_inreg lowering incorrectly optimize the case when input type is a vector of i1
</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>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</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>michael.liao@intel.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=11606" name="attach_11606" title="test case">attachment 11606</a> <a href="attachment.cgi?id=11606&action=edit" title="test case">[details]</a></span>
test case
During lowering of sign_extend_inreg, (sext (vzext x)) is optimized to (vsext
x), however, it doesn't check the in-register type as that optimization is only
valid when in-register type is a vector of i8, i16, or i32. E.g. if the
in-register type is a vector of i1, (vsext x) cannot extend sign-bit.
A test case is attached. Run 'llc -mcpu=penryn < ss.ll' (with SSE only), it
produces the following code
foo: # @foo
.cfi_startproc
# BB#0:
movdqa %xmm0, %xmm1
pshufb .LCPI0_0(%rip), %xmm1
pslld $31, %xmm1
psrad $31, %xmm1
movdqa %xmm0, %xmm2
pshufb .LCPI0_1(%rip), %xmm2
pslld $31, %xmm2
psrad $31, %xmm2
pmovsxbd %xmm0, %xmm3
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pshufb .LCPI0_2(%rip), %xmm0
pslld $31, %xmm0
psrad $31, %xmm0
movdqa %xmm3, (%rdi)
movdqa %xmm0, 48(%rdi)
movdqa %xmm2, 32(%rdi)
movdqa %xmm1, 16(%rdi)
ret
.Ltmp0:
.size foo, .Ltmp0-foo
.cfi_endproc
Note that pmovsxbd marked. It's incorrect as the value in xmm0 is still i1.</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>