<div dir="ltr">This load instruction assumes the default ABI alignment for the <4 x float> type, which is 16:<div><div>  %15 = load <4 x float>* %14</div></div><div><br></div><div>You can set the alignment of loads to something lower than 16 in your frontend, and this will make LLVM use movups instructions:<br></div><div>  %15 = load <4 x float>* %14, align 4<br></div><div><br></div><div>If some LLVM mid-level pass is introducing this load without proving that the vector is 16-byte aligned, then that's a bug</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 29, 2015 at 1:02 PM, Frank Winter <span dir="ltr"><<a href="mailto:fwinter@jlab.org" target="_blank">fwinter@jlab.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">When I compile attached IR with LLVM 3.6<br>
<br>
llc -march=x86-64 -o f.S f.ll<br>
<br>
it generates an aligned ADDPS with unaligned address. See attached f.S, here an extract:<br>
<br>
        addq    $12, %r9         # $12 is not a multiple of 4, thus for xmm0 this is unaligned<br>
        xorl    %esi, %esi<br>
        .align  16, 0x90<br>
.LBB0_1:                                # %loop2<br>
                                        # =>This Inner Loop Header: Depth=1<br>
        movq    offset_array3(,%rsi,8), %rdi<br>
        movq    offset_array2(,%rsi,8), %r10<br>
        movss   -28(%rax), %xmm0<br>
        movss   -8(%rax), %xmm1<br>
        movss   -4(%rax), %xmm2<br>
        unpcklps        %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]<br>
        movss   (%rax), %xmm0<br>
        unpcklps        %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]<br>
        unpcklps        %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]<br>
        addps   (%r9), %xmm1          # here, it gets used, causes a segfault<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
Frank<br>
<br>
</font></span><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" rel="noreferrer" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div>