On Tue, Mar 8, 2022 at 4:29 AM Jakub Jelinek <ja...@redhat.com> wrote:
>
> On Tue, Mar 08, 2022 at 12:15:15PM +0100, Jakub Jelinek via Gcc-patches wrote:
> > > --- gcc/config/i386/i386.h.jj       2022-02-25 12:06:45.535493490 +0100
> > > +++ gcc/config/i386/i386.h  2022-03-08 11:20:43.207043370 +0100
> > > @@ -2848,6 +2848,10 @@ extern enum attr_cpu ix86_schedule;
> > >  #define NUM_X86_64_MS_CLOBBERED_REGS 12
> > >  #endif
> > >
> > > +/* __builtin_eh_return can't handle stack realignment, so disable SSE in
> > > +   libgcc functions that call it.  */
> > > +#define LIBGCC2_UNWIND_ATTRIBUTE __attribute__((target ("no-sse")))
> > > +
> > >  /*
> > >  Local variables:
> > >  version-control: t
> > >
> > >
> > > As mentioned in PR104838, this likely isn't specific to just Solaris and
> > > cygwin/mingw.  Fedora uses -msse2 -mfpmath=sse -mstackrealign in its 
> > > C{,XX}FLAGS
> > > among other things for i686.
> >
> > Now verified that with your full patch applied gcc on Fedora/i686 doesn't
> > build (gets those sorry messages when compiling unwind-dw2), while if I
> > replace those 2 libgcc hunks from your patch with the above one it seems to
> > get past the previous hanging point of gnat1 processes.
>
> 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.

> 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.

> 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.

-- 
H.J.

Reply via email to