Stack alignment in kernel

I'm running in AVX mode, but the stack before call to kernel is aligned to 16 bit.
Could you, please, tell me where it should be specified?

Thank you.

- Elena

./llc -mattr=+avx -stack-alignment=16 < basic.ll | grep movaps | grep ymm | grep rbp
        vmovaps -176(%rbp), %ymm14
        vmovaps -144(%rbp), %ymm11
        vmovaps -240(%rbp), %ymm13
        vmovaps -208(%rbp), %ymm9
        vmovaps -272(%rbp), %ymm7
        vmovaps -304(%rbp), %ymm0
        vmovaps -112(%rbp), %ymm0
        vmovaps -80(%rbp), %ymm1
        vmovaps -112(%rbp), %ymm0
        vmovaps -80(%rbp), %ymm0
        vmovaps -176(%rbp), %ymm15
        vmovaps -144(%rbp), %ymm0
        vmovaps -240(%rbp), %ymm0
        vmovaps -208(%rbp), %ymm0
        vmovaps -272(%rbp), %ymm0
        vmovaps -304(%rbp), %ymm0

vmovaps should not access stack if it is not aligned to 32

- Elena

basic.ll (37.9 KB)

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

When stack is unaligned, LLVM should generate vmovups instead of vmovaps.

- Elena

When stack is unaligned, LLVM should generate vmovups instead of vmovaps.

That's the question I have asked. If LLVM believes the stack is aligned,
the choice is correct.

Joerg