public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "zfigura at codeweavers dot com" <gcc-bugzilla@gcc.gnu.org>
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	[thread overview]
Message-ID: <bug-111107-4-AMy6f2DJtZ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-111107-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from Zebediah Figura <zfigura at codeweavers dot com> ---
(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/
> 
> 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—that 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
> 
> config/i386/cygming.h:#define STACK_REALIGN_DEFAULT TARGET_SSE
> 
> is a non-working "fix".  The appropriate default would be
> -mincoming-stack-boundary=2.  MIN_STACK_BOUNDARY should already be 4, so
> that leaves PREFERRED_STACK_BOUNDARY_DEFAULT is the way to go here.  I also
> see
> 
> /* 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)
> 
> 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 aligned.
Which means that we should just have -mincoming-stack-boundary=2 everywhere.

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 chance
try to clarify?

  parent reply	other threads:[~2023-08-24 20:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-22 21:27 [Bug target/111107] New: " zfigura at codeweavers dot com
2023-08-22 21:29 ` [Bug target/111107] " pinskia at gcc dot gnu.org
2023-08-22 21:41 ` zfigura at codeweavers dot com
2023-08-22 21:41 ` pinskia at gcc dot gnu.org
2023-08-22 21:56 ` zfigura at codeweavers dot com
2023-08-23  7:55 ` rguenth at gcc dot gnu.org
2023-08-24 20:29 ` zfigura at codeweavers dot com [this message]
2023-08-28 18:28 ` gabrielopcode at gmail dot com
2023-11-25  7:34 ` alexhenrie24 at gmail dot com
2023-11-25  8:57 ` amonakov at gcc dot gnu.org
2023-11-25 17:40 ` gabrielopcode at gmail dot com
2023-11-25 18:54 ` alexhenrie24 at gmail dot com
2023-11-25 19:20 ` alexhenrie24 at gmail dot com
2023-11-25 21:45 ` alexhenrie24 at gmail dot com
2023-11-28 22:34 ` ebotcazou at gcc dot gnu.org
2023-11-28 22:58 ` ebotcazou at gcc dot gnu.org
2023-11-29  3:54 ` zfigura at codeweavers dot com
2023-11-29  7:49 ` ebotcazou at gcc dot gnu.org
2023-11-29 19:05 ` zfigura at codeweavers dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-111107-4-AMy6f2DJtZ@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).