<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] Failure to vectorize __builtin_sqrt/__builtin_sqrtf"
href="https://llvm.org/bugs/show_bug.cgi?id=27435">27435</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[X86][SSE] Failure to vectorize __builtin_sqrt/__builtin_sqrtf
</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>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>llvm-dev@redking.me.uk
</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>Trunk fails to vectorize:
#include <x86intrin.h>
__m128d sqrtd2(double* v) {
return _mm_setr_pd(__builtin_sqrt(v[0]), __builtin_sqrt(v[1]));
}
__m128 sqrtf4(float* v) {
return _mm_setr_ps(__builtin_sqrtf(v[0]), __builtin_sqrtf(v[1]),
__builtin_sqrtf(v[2]), __builtin_sqrtf(v[3]));
}
clang -S -O3 test.c -o -
sqrtd2:
vsqrtsd (%rdi), %xmm0, %xmm0
vsqrtsd 8(%rdi), %xmm0, %xmm1
vunpcklpd %xmm1, %xmm0, %xmm0 # xmm0 = xmm0[0],xmm1[0]
retq
sqrtf4:
vsqrtss (%rdi), %xmm0, %xmm0
vsqrtss 4(%rdi), %xmm0, %xmm1
vsqrtss 8(%rdi), %xmm0, %xmm2
vsqrtss 12(%rdi), %xmm0, %xmm3
vinsertps $16, %xmm1, %xmm0, %xmm0 # xmm0 = xmm0[0],xmm1[0],xmm0[2,3]
vinsertps $32, %xmm2, %xmm0, %xmm0 # xmm0 = xmm0[0,1],xmm2[0],xmm0[3]
vinsertps $48, %xmm3, %xmm0, %xmm0 # xmm0 = xmm0[0,1,2],xmm3[0]
retq
Note that this is for __builtin_sqrt not ::sqrt()!
I'd expect:
sqrtd2:
vsqrtpd (%rdi), %xmm0
retq
sqrtf4:
vsqrtps (%rdi), %xmm0
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>