[LLVMdev] Spilled variables using unaligned moves

Dale Johannesen dalej at apple.com
Mon Jul 14 11:46:19 PDT 2008


On Jul 14, 2008, at 11:37 AMPDT, Chris Lattner wrote:

>
> On Jul 14, 2008, at 7:43 AM, Nicolas Capens wrote:
>
>> Hi all,
>>
>> It looks like vector spills don’t use aligned moves even though the  
>> stack is aligned. This seems like an optimization opportunity.
>
> What target is this?  Linux doesn't have a 16-byte aligned stack.
>
> -Chris

It does now:)  Anton (I think) implemented dynamic stack alignment for  
functions with XMM variables.
Note the "and  esp" in the fragment below.

>>  The attached replacement of fibonacci.cpp generates x86 code like  
>> this:
>>
>> 03A70010  push        ebp
>> 03A70011  mov         ebp,esp
>> 03A70013  and         esp,0FFFFFFF0h
>> 03A70019  sub         esp,1A0h
>> ...
>> 03A7006C  movups      xmmword ptr [esp+180h],xmm7
>> ...
>> 03A70229  mulps       xmm1,xmmword ptr [esp+180h]
>> ...
>> 03A70682  movups      xmm0,xmmword ptr [esp+180h]
>>
>> Note how stores and loads use unaligned moves while it could use  
>> aligned moves. It’s also interesting that the multiply does  
>> correctly assume the stack to be 16-byte aligned.
>>
>> Is there something I’m doing wrong (again), or is this already known?
>>
>> Thanks a lot,
>>
>> Nicolas Capens
>>
>> <fibonacci.cpp>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080714/90b92015/attachment.html>


More information about the llvm-dev mailing list