[LLVMdev] stack alignment (again)

Dale Johannesen dalej at apple.com
Fri Mar 28 17:23:41 PDT 2008


On Mar 28, 2008, at 5:17 PM, Chuck Rose III wrote:

> Hola LLVMers,
>
> I was curious about the state of stack alignment on x86.  I noticed  
> there are a few bugs outstanding on the issue.  I recently added  
> some code which had the effect of throwing an extra function  
> parameter on our stack at runtime, a 4 byte pointer.
>
> Esp is now not 16-byte aligned, so instructions like unpcklps xmm1,  
> dword ptr [eps] cause grief.  My AllocaInstr instructions are told  
> to be 16 byte aligned, so the addition of a 4-byte parameter  
> shouldn’t have changed alignment on the objects.
>
> The unpcklps instruction is coming from an ExtractElementInst or  
> InsertElementInst.  I can always hard code these by cyling my  
> vectors to memory and doing things one scalar at a time, though perf  
> will suffer.  I’ll try it Monday to see if it gets rid of the  
> alignment sensitive instructions.
>
> I’m noticing this under windows via JIT.  I’m going to check to see  
> if my mac has similar issues.

The stack on MacOS is supposed to be kept 16-byte aligned.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080328/6864a92b/attachment.html>


More information about the llvm-dev mailing list