From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 73740 invoked by alias); 6 Sep 2016 12:51:46 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 73597 invoked by uid 89); 6 Sep 2016 12:51:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=mans, man's X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 06 Sep 2016 12:51:42 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 48C8980F75; Tue, 6 Sep 2016 12:51:41 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-204-43.brq.redhat.com [10.40.204.43]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u86CpdjN005566 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 6 Sep 2016 08:51:40 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id u86CpcSd029352; Tue, 6 Sep 2016 14:51:38 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id u86Cpahq029351; Tue, 6 Sep 2016 14:51:36 +0200 Date: Tue, 06 Sep 2016 13:13:00 -0000 From: Jakub Jelinek To: Martin =?utf-8?B?TGnFoWth?= Cc: David Edelsohn , Nathan Sidwell , GCC Patches , Jan Hubicka , Andreas Schwab , Richard Biener Subject: Re: [PATCH] Detect whether target can use -fprofile-update=atomic Message-ID: <20160906125136.GG14857@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <1ff3cc75-7cee-79f3-395b-ef7a4d286a3d@acm.org> <04a05835-4666-4d7d-c1a9-d4bcc4ea924a@suse.cz> <19c4a81d-6ecd-8c6e-b641-e257c1959baf@suse.cz> <43f60306-d6d6-47e4-758c-a806f661d6a0@acm.org> <07cadca7-913a-acad-2f49-482b19e97a72@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2016-09/txt/msg00301.txt.bz2 On Tue, Sep 06, 2016 at 02:45:32PM +0200, Martin Liška wrote: > --- a/gcc/tree-profile.c > +++ b/gcc/tree-profile.c > @@ -528,6 +528,13 @@ gimple_gen_ior_profiler (histogram_value value, unsigned tag, unsigned base) > gsi_insert_before (&gsi, call, GSI_NEW_STMT); > } > > +#ifndef HAVE_sync_compare_and_swapsi > +#define HAVE_sync_compare_and_swapsi 0 > +#endif > +#ifndef HAVE_atomic_compare_and_swapsi > +#define HAVE_atomic_compare_and_swapsi 0 > +#endif > + > /* Profile all functions in the callgraph. */ > > static unsigned int > @@ -535,6 +542,16 @@ tree_profiling (void) > { > struct cgraph_node *node; > > + /* Verify whether we can utilize atomic update operations. */ > + if (flag_profile_update == PROFILE_UPDATE_ATOMIC > + && !HAVE_sync_compare_and_swapsi > + && !HAVE_atomic_compare_and_swapsi) This isn't in sync with: > +/* Detect whether target can support atomic update of profilers. */ > +#if LONG_LONG_TYPE_SIZE <= 32 && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 > +#define GCOV_SUPPORTS_ATOMIC 1 > +#else > +#if LONG_LONG_TYPE_SIZE > 32 && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 > +#define GCOV_SUPPORTS_ATOMIC 1 > +#else > +#define GCOV_SUPPORTS_ATOMIC 0 > +#endif > +#endif this. Either you implement the poor man's 64-bit atomics with 32-bit cas and adjust the latter, or the former needs to look at the target's gcov type (long long always?) and depending on its size either test the HAVE_*si or HAVE_*di macros. Jakub