From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id AD95B3858C83 for ; Tue, 8 Mar 2022 15:46:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AD95B3858C83 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-590-KnfkRYFQMu6W7-42UHLulg-1; Tue, 08 Mar 2022 10:46:08 -0500 X-MC-Unique: KnfkRYFQMu6W7-42UHLulg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 235DF1868407; Tue, 8 Mar 2022 15:46:07 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.81]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 953CB10631E9; Tue, 8 Mar 2022 15:46:06 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 228Fk3lV3931712 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 8 Mar 2022 16:46:03 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 228Fk2Hg3931711; Tue, 8 Mar 2022 16:46:02 +0100 Date: Tue, 8 Mar 2022 16:46:02 +0100 From: Jakub Jelinek To: "H.J. Lu" Cc: Eric Botcazou , gcc-patches@gcc.gnu.org Subject: Re: [PATCH v3] x86: Disable SSE on unwind-c.c and unwind-dw2.c Message-ID: Reply-To: Jakub Jelinek References: <20220307150628.68146-1-hjl.tools@gmail.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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 15:46:12 -0000 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