From patchwork Thu Nov 4 10:05:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 47042 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7FB9A3857C60 for ; Thu, 4 Nov 2021 10:06:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7FB9A3857C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1636020365; bh=fkKenmIAQY996nI3F7rXCxzv85/X+h85MbAGxEW6uoo=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=H2/rrMMdU7UIxj2g+UM42rDZM8VYQxA6GbcnkWcLu/kAualz05jj8DkA8tTtni34V tCc99lZepziuIAggVPCzZCbbgvM5ymX9TK6ZtJv4x9S4xS0+q7udBtJefU1SgK+3ob Fv/1HaBj5ARr8xl152kRFHqLLZOs+oimZzhT6DVE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTPS id 4E4CA3858409 for ; Thu, 4 Nov 2021 10:05:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4E4CA3858409 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-593-F8Id7q56PSqjcShK7Piyxw-1; Thu, 04 Nov 2021 06:05:35 -0400 X-MC-Unique: F8Id7q56PSqjcShK7Piyxw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E5D0B19057A1; Thu, 4 Nov 2021 10:05:33 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.193.172]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7F3D170871; Thu, 4 Nov 2021 10:05:33 +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 1A4A5T753342796 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 4 Nov 2021 11:05:30 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 1A4A5SIR3342793; Thu, 4 Nov 2021 11:05:28 +0100 Date: Thu, 4 Nov 2021 11:05:28 +0100 To: Iain Sandoe , Uros Bizjak , Jan Hubicka Subject: [PATCH] x86: Make stringop_algs::stringop_strategy ctor constexpr [PR100246] Message-ID: <20211104100528.GS304296@tucnak> References: <2AF05BB0-7510-4B7B-8702-8AE76EC622E6@sandoe.co.uk> MIME-Version: 1.0 In-Reply-To: <2AF05BB0-7510-4B7B-8702-8AE76EC622E6@sandoe.co.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP 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-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Cc: GCC Patches Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" On Tue, Jul 06, 2021 at 11:17:55AM +0100, Iain Sandoe wrote: > >> The addition of the CTOR is the fix for the C++ compile fail in the PR, the conditional is > >> only there because the same header is compiled by C and C++. > > > > Whoops sorry - I was confused. The patch looks OK to me if you add a comment > > before the CTOR why it was added (maybe quoting the error that happens) > > Thanks, pushed as below. > Iain > > ------- > > X86: Provide a CTOR for stringop_algs [PR100246]. > > Several older compilers fail to build modern GCC because of missing > or incomplete C++11 support. > > Signed-off-by: Iain Sandoe > > PR bootstrap/100246 - [11/12 Regression] GCC will not bootstrap with clang 3.4/3.5 [xcode 5/6, Darwin 12/13] > > PR bootstrap/100246 > > gcc/ChangeLog: > > * config/i386/i386.h (struct stringop_algs): Define a CTOR for > this type. Unfortunately, as mentioned in my https://gcc.gnu.org/pipermail/gcc-patches/2021-November/583289.html mail, without the new dyninit pass this causes dynamic initialization of many variables, 6.5KB _GLOBAL__sub_I_* on x86_64 and 12.5KB on i686. The following so far only lightly tested patch makes the ctor constexpr so that already the FE is able to statically initialize all those. I don't have access to Darwin nor to the broken versions of clang, do you think you could test bootstrap there with this too? Especially because 11.x is not going to have the dyninit optimization for sure, it would be nice to do this on the 11 branch too. 2021-11-04 Jakub Jelinek PR bootstrap/100246 * config/i386/i386.h (stringop_algs::stringop_strategy::stringop_strategy): Make the ctor constexpr. Jakub --- gcc/config/i386/i386.h.jj 2021-09-28 23:18:35.282563395 +0200 +++ gcc/config/i386/i386.h 2021-11-04 10:48:47.165086806 +0100 @@ -78,8 +78,9 @@ struct stringop_algs this issue. Since this header is used by code compiled with the C compiler we must guard the addition. */ #ifdef __cplusplus - stringop_strategy(int _max = -1, enum stringop_alg _alg = libcall, - int _noalign = false) + constexpr stringop_strategy(int _max = -1, + enum stringop_alg _alg = libcall, + int _noalign = false) : max (_max), alg (_alg), noalign (_noalign) {} #endif const int max;