[llvm-bugs] [Bug 27435] New: [X86][SSE] Failure to vectorize __builtin_sqrt/__builtin_sqrtf
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Apr 20 07:21:54 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=27435
Bug ID: 27435
Summary: [X86][SSE] Failure to vectorize
__builtin_sqrt/__builtin_sqrtf
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: llvm-dev at redking.me.uk
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
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
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160420/8c1071fb/attachment-0001.html>
More information about the llvm-bugs
mailing list