https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110273

            Bug ID: 110273
           Summary: i686-w64-mingw32 with -march=znver4 generates AVX
                    instructions without stack alignment
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zfigura at codeweavers dot com
                CC: amonakov at gcc dot gnu.org
  Target Milestone: ---

Created attachment 55334
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55334&action=edit
offending source file

Found with Wine.

I've attached a C file that's a minimal-ish reproducer.

I don't currently have a machine with gcc 13.1.0, so I did this using
godbolt.org's "MinGW gcc 13.1.0" target, with "-m32". Full compiler flags are
"-m32 -march=znver4 -O2".

The generated output begins

        pushl   %ebp
        vpxor   %xmm0, %xmm0, %xmm0
        movl    %esp, %ebp
        subl    $424, %esp
        vmovdqa %xmm0, 16(%esp)

which is broken. Using -march=znver3 instead will generate the same vmovdqa
instruction, but align the stack first:

        pushl   %ebp
        vpxor   %xmm0, %xmm0, %xmm0
        movl    %esp, %ebp
        andl    $-16, %esp
        subl    $416, %esp
        leal    36(%esp), %eax
        movl    $380, 8(%esp)
        movl    $0, 4(%esp)
        vmovdqa %xmm0, 16(%esp)

Reply via email to