[LLVMdev] Use CreateVectorSplat to create a vector value
zhi chen
zchenhn at gmail.com
Mon May 18 10:44:25 PDT 2015
I used CreateVectorSplat to create a vector for a double variable x, e.g.,
<x, x>. I expected that it would work like _mm_set1_pd for sse or
_mm256_broadcast_sd for avx. But it turned out that llc -O3 would create
the following assembly. I don't understand why it needs to move it to two
xmm registers and then unpack it. Is it because of alignment?
movq %rcx, %rbx
vmovd %esi, %xmm4
vpbroadcastq %xmm4, %xmm5
vmovdqa %xmm5, 64(%rsp) # 16-byte Spill
vpextrq $1, %xmm5, %rax
cltq
vmovq %rax, %xmm4
vmovq %xmm5, %rcx
movslq %ecx, %rcx
vmovq %rcx, %xmm5
vpunpcklqdq %xmm4, %xmm5, %xmm4 # xmm4 = xmm5[0],xmm4[0]
Thanks,
Best
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150518/a17e096c/attachment.html>
More information about the llvm-dev
mailing list