public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: Eric Botcazou <ebotcazou@adacore.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH v3] x86: Disable SSE on unwind-c.c and unwind-dw2.c
Date: Tue, 8 Mar 2022 16:46:02 +0100	[thread overview]
Message-ID: <Yid6OgTq8uH+Ze4O@tucnak> (raw)
In-Reply-To: <CAMe9rOq=+e1fD7edAwF+XMARCePvbJ-SN1=4BdaX3P=uXYUtLQ@mail.gmail.com>

On Tue, Mar 08, 2022 at 07:37:17AM -0800, H.J. Lu wrote:
> > Though, perhaps it should be
> > #ifndef __x86_64__
> > #define LIBGCC2_UNWIND_ATTRIBUTE __attribute__((target ("no-sse")))
> > #endif
> > or something similar, on x86-64 one at least normally doesn't use lower
> > stack realignment unless avx or later.  Maybe we want to use
> > no-avx for the x86-64 case though.
> 
> I have verified that AVX and AVX512 have no issues on x86-64.  In 32-bit,
> -mstackrealign triggers the problem.

I bet it would be a problem if we started vectorizing something in there
using avx/avx2/avx512*.  But given the sorry, I think we'd find that out
immediately.

> > Disabling sse/sse2 might be a problem especially on mingw where we need to
> > restore SSE registers in the EH return, no?
> 
> No, it isn't needed.

I meant for 64-bit where I think the Windows ABI preserves some XMM regs
(low 128-bits of them).  So my earlier patch to just define
LIBGCC2_UNWIND_ATTRIBUTE unconditionally would be wrong for it.

> > Even better would be to make __builtin_eh_return work even with DRAP,
> > but I admit I haven't understood what exactly is the problem that prevents
> > it from working.
> 
> The EH return is a very special case.  Disable SSE in 32-bit is the simplest
> way to make the EH return to work.

Ok.  So, what do you think about replacing the libgcc/ part of your patch
with that
/* __builtin_eh_return can't handle stack realignment, so disable SSE in
   32-bit libgcc functions that call it.  */
#ifndef __x86_64__
#define LIBGCC2_UNWIND_ATTRIBUTE __attribute__((target ("no-sse")))
#endif
?
I'm bootstrapping/regtesting such a patch right now (because I needed some
quick fix for the gnat1 hangs).

	Jakub


  reply	other threads:[~2022-03-08 15:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07 15:06 H.J. Lu
2022-03-08 10:23 ` Jakub Jelinek
2022-03-08 11:15   ` Jakub Jelinek
2022-03-08 12:29     ` Jakub Jelinek
2022-03-08 12:49       ` Eric Botcazou
2022-03-08 15:37       ` H.J. Lu
2022-03-08 15:46         ` Jakub Jelinek [this message]
2022-03-08 16:09           ` H.J. Lu
2022-03-08 17:35             ` [PATCH] x86: Define LIBGCC2_UNWIND_ATTRIBUTE on ia32 [PR104781] Jakub Jelinek
2022-03-08 17:49               ` H.J. Lu
2022-03-09  7:18                 ` Richard Biener
2022-03-09  9:59                   ` [PATCH] x86, v2: " Jakub Jelinek
2022-03-09 11:30                     ` Richard Biener
2022-03-08 17:50               ` [PATCH] x86: " H.J. Lu

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=Yid6OgTq8uH+Ze4O@tucnak \
    --to=jakub@redhat.com \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    /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).