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