From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by sourceware.org (Postfix) with ESMTPS id 5644E3858430 for ; Tue, 8 Mar 2022 16:10:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5644E3858430 Received: by mail-pj1-x1036.google.com with SMTP id v4so17614356pjh.2 for ; Tue, 08 Mar 2022 08:10:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=W/dGxzzKKCQqgejAEvd0CPli0Y6Ca5AFJ3AGs/YxDMg=; b=IS8bRxTEjO1E063NoGPhKn753axzaEAL1ZmjCE0ejSp2FdZKhyKJx+9juHUiWUPQIG Es8MSyzfdguzb0GAiwZrAkRHBnQTnddY7khxBMFZC3kfFufVvnkcimfxv6SeOG0Kz37p fp/oTHOz7sCZ+1z5WgxczDw9V/1KfC6stfUWYXgMbPnRxdZ7M10rGwrpke4wyGz1Xd1W h6/qVS8lM51c7+2Xwp68NQWyQyK0Lc7Sb6bnmYKoZeI9v+21wp+uZDtS0splL3KQhDAQ uBvtxWWOIF2G8ivdextAUcSmv+8wrbluFx2SfuYirgug4aXSwaaJb5BaxOtpOJ2zaji0 umvw== X-Gm-Message-State: AOAM531LDnxcxqQOPn1LuT+EPTRqlH0211tTEtKDyYU6T8DdKnmUYzx9 zirXkK/iircnmdEZaiyCzMRMX8tYLz38clMJHGw= X-Google-Smtp-Source: ABdhPJxlQejxjqwh8VEKeosaJ3IUqGQey5KncfTDBR7mKWWRDrkH2FyhSeWOX84Cs8MsYcNALCepmgdwo4BriwBNeF8= X-Received: by 2002:a17:902:cf12:b0:14f:e0c2:1515 with SMTP id i18-20020a170902cf1200b0014fe0c21515mr18380573plg.4.1646755800731; Tue, 08 Mar 2022 08:10:00 -0800 (PST) MIME-Version: 1.0 References: <20220307150628.68146-1-hjl.tools@gmail.com> In-Reply-To: From: "H.J. Lu" Date: Tue, 8 Mar 2022 08:09:25 -0800 Message-ID: Subject: Re: [PATCH v3] x86: Disable SSE on unwind-c.c and unwind-dw2.c To: Jakub Jelinek Cc: Eric Botcazou , gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3020.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Mar 2022 16:10:07 -0000 On Tue, Mar 8, 2022 at 7:46 AM Jakub Jelinek wrote: > > 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 YMM and ZMM can be used to expand memset with -march=native. It works fine on Linux. No stack realignment is needed. > immediately. True. > > > 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 Does it need to realign the stack? > (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 > ? Yes, it should work. Thanks. > I'm bootstrapping/regtesting such a patch right now (because I needed some > quick fix for the gnat1 hangs). > > Jakub > -- H.J.