>
>
> -----Original Message-----
>
...
> Subject: Re: [LLVMdev] Stack alignment on X86 AVX seems incorrect
>
> On Thu, Mar 01, 2012 at 06:16:46PM +0000, Demikhovsky, Elena wrote:
> > vmovaps should not access stack if it is not aligned to 32
>
> I'm not completely sure I understand your problem. Are you saying that
> the generated code assumes 256bit alignment, your default stack
> alignment is 128bit and LLVM doesn't adjust it automatically?
>
> Joerg
>
Hey Joerg,
The faulty code can be found in
function X86InstrInfo::storeRegToStackSlot(...)
from /lib/Target/X86/X86InstrInfo.cpp.
> bool isAligned = (RI.getStackAlignment() >= 16) ||
RI.canRealignStack(MF);
When creating the spill's machine instruction, the spill slot is assumed to
be aligned if the alignment is >= 16 bytes, which is not the case for AVX.
AVX spills require 32 byte alignment to make use of aligned moves. The
stack is not adjusted automatically.
For performance, the best fix is to align the frame to a 32-byte boundary,
ensuring that the YMM spill slots are also on 32-byte boundaries. This, of
course, breaks the ABI.
-Cameron
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20120301/68ebf9d3/attachment.html>