From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 77C6C3857342; Thu, 15 Jun 2023 21:53:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 77C6C3857342 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686866000; bh=OBO9W9J25ftHlfefditk9+mO5zbHQixxtSxWGTaQqLo=; h=From:To:Subject:Date:From; b=uhsOJhDy6wLOTXDPLWgBzqDdNCW/2DFZltvDTiBNC99wl5MM88/aFFxGOOxycs0/a 4SuZcs8lbEQ4mqArIWRYmVDlmlT2Ivc0Uv51KR93HgHuN5STK5Yvh3L0l/5gNIgDJt +yb+hNnpjnKAaxDkMWxI5nwq7EM4518FaDbMs7Kg= From: "zfigura at codeweavers dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/110273] New: i686-w64-mingw32 with -march=znver4 generates AVX instructions without stack alignment Date: Thu, 15 Jun 2023 21:53:19 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: zfigura at codeweavers dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110273 Bug ID: 110273 Summary: i686-w64-mingw32 with -march=3Dznver4 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=3D55334&action=3Dedit 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 a= re "-m32 -march=3Dznver4 -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=3Dznver3 instead will generate the same vmovd= qa 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)=