From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A0AD23858C2C; Thu, 24 Aug 2023 20:29:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A0AD23858C2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692908952; bh=NVzs9BHfrFd4m8imnKJmX4NF5MhnMWPIoA+tY4DrOos=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jJ8f46tZdgyiCHa6XPPE7IzBilQjrnA6vEQZvGaVI8G3ZG4GFMKfQwj4HyhGB7G+M E1CwhsFei9m9WefhJpGgJSzWVRvIoqHyU7P5dZ6nLEyA42Zbfxz+gZ71HSVWxC1aIz Njb8BExFMJuk5D+TGt4CzahwHAETWlwfhAp0C03Q= From: "zfigura at codeweavers dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/111107] i686-w64-mingw32 does not realign stack when __attribute__((aligned)) or __attribute__((vector_size)) are used Date: Thu, 24 Aug 2023 20:29:10 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: ABI, wrong-code 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: Message-ID: In-Reply-To: References: 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=3D111107 --- Comment #6 from Zebediah Figura --- (In reply to Zebediah Figura from comment #4) > (In reply to Andrew Pinski from comment #3) > > https://inbox.sourceware.org/gcc-patches/5969976.Bvae8NF9fS@polaris/ >=20 > Again, I'm not sure what you're trying to communicate here. I'm aware that > -mstackrealign exists (and its attribute equivalent). We *do* use that in > Wine. Ah, I'm sorry, I think I see what you're trying to say=E2=80=94that it was = an intentional choice to add -mstackrealign if -msse2 is used, so it's hard to call this a "bug" per se. (In reply to Richard Biener from comment #5) > I'd say that >=20 > config/i386/cygming.h:#define STACK_REALIGN_DEFAULT TARGET_SSE >=20 > is a non-working "fix". The appropriate default would be > -mincoming-stack-boundary=3D2. MIN_STACK_BOUNDARY should already be 4, so > that leaves PREFERRED_STACK_BOUNDARY_DEFAULT is the way to go here. I al= so > see >=20 > /* It should be MIN_STACK_BOUNDARY. But we set it to 128 bits for > both 32bit and 64bit, to support codes that need 128 bit stack > alignment for SSE instructions, but can't realign the stack. */ > #define PREFERRED_STACK_BOUNDARY_DEFAULT \ > (TARGET_IAMCU ? MIN_STACK_BOUNDARY : 128) >=20 > which suggests there might be problems with SSE anyway. > > So does the following work? But I would agree with this, yeah. If we're going to manually align for SSE then we should also manually align for types that need to be manually align= ed. Which means that we should just have -mincoming-stack-boundary=3D2 everywhe= re. In theory that patch works, although I'll have to put together a gcc build = to be sure. I do have one question, though... from reading the documentation, I have a = hard time understanding the difference, or intended difference, between -mincoming-stack-boundary and -mpreferred-stack-boundary. Could you by chan= ce try to clarify?=