<html>
<head>
<base href="https://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 --- - [x86, SSE] rematerialized existing constants"
href="https://llvm.org/bugs/show_bug.cgi?id=25554">25554</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[x86, SSE] rematerialized existing constants
</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>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>spatel+llvm@rotateright.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>$ cat bad_vmov.c
#include <smmintrin.h>
void foo(__m128i v0, __m128i v1, int *ret) {
__m128i one0 = _mm_set_epi32(0,0,0,1);
__m128i one1 = _mm_set_epi32(0,1,0,0);
if ( _mm_testz_si128(v0, one0) ) ret[0] = 10;
if ( _mm_testz_si128(v1, one1) ) ret[1] = 20;
}
Using:
./clang -v
clang version 3.8.0 (trunk 253253)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
$ ./clang -O2 -S -o - bad_vmov.c -fomit-frame-pointer -msse4.1
...
movl $1, %eax
movd %rax, %xmm2
ptest %xmm2, %xmm0
jne LBB0_2
movl $10, (%rdi)
LBB0_2:
movl $1, %eax <--- $1 was already in %eax
movd %rax, %xmm0 <--- and %xmm2 already has this value
pslldq $8, %xmm0
ptest %xmm0, %xmm1
jne LBB0_4
movl $20, 4(%rdi)
LBB0_4:
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>