[PATCH] Detect whether target can use -fprofile-update=atomic

2016-08-16 Thread Martin Liška
Hello. As reported in [1], m68k has been broken since I installed the patch. Reason is that the target does not support atomic operations (add, or) for a mode of gcov_type. Because of that, we see an undefined symbols. Proper fix contains of 2 parts: a) compiler emission must verify that -fprof

Re: [PATCH] Detect whether target can use -fprofile-update=atomic

2016-08-16 Thread Nathan Sidwell
On 08/16/16 08:55, Martin Liška wrote: Hello. As reported in [1], m68k has been broken since I installed the patch. Reason is that the target does not support atomic operations (add, or) for a mode of gcov_type. Because of that, we see an undefined symbols. Proper fix contains of 2 parts: a)

Re: [PATCH] Detect whether target can use -fprofile-update=atomic

2016-09-06 Thread Martin Liška
On 08/16/2016 04:30 PM, Nathan Sidwell wrote: > On 08/16/16 08:55, Martin Liška wrote: >> Hello. >> >> As reported in [1], m68k has been broken since I installed the patch. Reason >> is that the target >> does not support atomic operations (add, or) for a mode of gcov_type. >> Because of that, we

Re: [PATCH] Detect whether target can use -fprofile-update=atomic

2016-09-06 Thread David Edelsohn
On Tue, Sep 6, 2016 at 6:45 AM, Martin Liška wrote: >>> Proper fix contains of 2 parts: >>> a) compiler emission must verify that -fprofile-update=atomic is doable for >>> a given target; it's done >>> via a new function can_generate_atomic_builtin >>> b) libgcc must detect whether __atomic_fetc

Re: [PATCH] Detect whether target can use -fprofile-update=atomic

2016-09-06 Thread Nathan Sidwell
On 09/06/16 06:57, David Edelsohn wrote: What about Jakub's comment in the PR? https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77378#c6 This needs addressing. Can you clarify PPC behaviour, because I may have misunderstood: 1) PPC currently has 64 bit counters -- but cannot support 64bit ato

Re: [PATCH] Detect whether target can use -fprofile-update=atomic

2016-09-06 Thread Jakub Jelinek
On Tue, Sep 06, 2016 at 08:14:58AM -0400, Nathan Sidwell wrote: > On 09/06/16 06:57, David Edelsohn wrote: > > >What about Jakub's comment in the PR? > > > >https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77378#c6 > > This needs addressing. Can you clarify PPC behaviour, because I may have > misund

Re: [PATCH] Detect whether target can use -fprofile-update=atomic

2016-09-06 Thread David Edelsohn
On Tue, Sep 6, 2016 at 8:14 AM, Nathan Sidwell wrote: > On 09/06/16 06:57, David Edelsohn wrote: > >> What about Jakub's comment in the PR? >> >> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77378#c6 > > > This needs addressing. Can you clarify PPC behaviour, because I may have > misunderstood: >

Re: [PATCH] Detect whether target can use -fprofile-update=atomic

2016-09-06 Thread David Edelsohn
On Tue, Sep 6, 2016 at 8:26 AM, Jakub Jelinek wrote: > On Tue, Sep 06, 2016 at 08:14:58AM -0400, Nathan Sidwell wrote: >> On 09/06/16 06:57, David Edelsohn wrote: >> >> >What about Jakub's comment in the PR? >> > >> >https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77378#c6 >> >> This needs addressing

Re: [PATCH] Detect whether target can use -fprofile-update=atomic

2016-09-06 Thread Martin Liška
sooner. >> >> >> >>> Which is worse? >>> Which is more likely? >> >> >> My initial thought is that it is probably awkward to support 2 different >> sized counter types in the 'same' config. I.e. 64-bit single-threaded >> c

Re: [PATCH] Detect whether target can use -fprofile-update=atomic

2016-09-06 Thread Jakub Jelinek
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

Re: [PATCH] Detect whether target can use -fprofile-update=atomic

2016-09-06 Thread Martin Liška
n its size either test the HAVE_*si or > HAVE_*di macros. > > Jakub > Ok, thanks, this should be the proper patch, where I distinguish sizeof(gcov_type) and use appropriate GAVE_*{s,d}i macros. Ready for trunk? Thanks, Martin >From 41bef1e975042071c973c3cb733a0e0d9a59fec6 Mon

Re: [PATCH] Detect whether target can use -fprofile-update=atomic

2016-09-06 Thread Jakub Jelinek
On Tue, Sep 06, 2016 at 03:13:09PM +0200, Martin Liška wrote: > @@ -535,6 +549,27 @@ tree_profiling (void) > { >struct cgraph_node *node; > > + /* Verify whether we can utilize atomic update operations. */ > + if (flag_profile_update == PROFILE_UPDATE_ATOMIC) > +{ > + bool can_su

Re: [PATCH] Detect whether target can use -fprofile-update=atomic

2016-09-06 Thread Martin Liška
macro. Ready for trunk? Martin >From 744d1688fee0359314d87d948323f58fbca6172e Mon Sep 17 00:00:00 2001 From: marxin Date: Tue, 6 Sep 2016 14:35:52 +0200 Subject: [PATCH] [PATCH] Detect whether target can use -fprofile-update=atomic libgcc/ChangeLog: 2016-09-06 Martin Liska * libgcov-profiler.c: Use __GCC_HAVE_SYNC_COMPAR

Re: [PATCH] Detect whether target can use -fprofile-update=atomic

2016-09-06 Thread Jakub Jelinek
On Tue, Sep 06, 2016 at 03:45:09PM +0200, Martin Liška wrote: > --- a/libgcc/libgcov-profiler.c > +++ b/libgcc/libgcov-profiler.c > @@ -24,8 +24,20 @@ see the files COPYING3 and COPYING.RUNTIME respectively. > If not, see > . */ > > #include "libgcov.h" > +#incl

Re: [PATCH] Detect whether target can use -fprofile-update=atomic

2016-09-07 Thread Christophe Lyon
On 6 September 2016 at 15:45, Martin Liška wrote: > On 09/06/2016 03:31 PM, Jakub Jelinek wrote: >> sizeof (gcov_type) talks about the host gcov type, you want instead the >> target gcov type. So >> TYPE_SIZE (gcov_type_node) == 32 vs. 64 (or TYPE_SIZE_UNIT (gcov_type_node) >> == 4 vs. 8). >> As

Re: [PATCH] Detect whether target can use -fprofile-update=atomic

2016-09-07 Thread Martin Liška
On 09/07/2016 09:45 AM, Christophe Lyon wrote: > On 6 September 2016 at 15:45, Martin Liška wrote: >> On 09/06/2016 03:31 PM, Jakub Jelinek wrote: >>> sizeof (gcov_type) talks about the host gcov type, you want instead the >>> target gcov type. So >>> TYPE_SIZE (gcov_type_node) == 32 vs. 64 (or T

Re: [PATCH] Detect whether target can use -fprofile-update=atomic

2016-09-07 Thread Christophe Lyon
On 7 September 2016 at 11:34, Martin Liška wrote: > On 09/07/2016 09:45 AM, Christophe Lyon wrote: >> On 6 September 2016 at 15:45, Martin Liška wrote: >>> On 09/06/2016 03:31 PM, Jakub Jelinek wrote: sizeof (gcov_type) talks about the host gcov type, you want instead the target gcov ty

Re: [PATCH] Detect whether target can use -fprofile-update=atomic

2016-09-12 Thread Jeff Law
On 09/07/2016 03:34 AM, Martin Liška wrote: On 09/07/2016 09:45 AM, Christophe Lyon wrote: > On 6 September 2016 at 15:45, Martin Liška wrote: >> On 09/06/2016 03:31 PM, Jakub Jelinek wrote: >>> sizeof (gcov_type) talks about the host gcov type, you want instead the >>> target gcov type. So

Re: [PATCH] Detect whether target can use -fprofile-update=atomic

2016-09-29 Thread Rainer Orth
Hi Martin, > 2016-09-06 Martin Liska > > * gcc.dg/profile-update-warning.c: New test. [...] > diff --git a/gcc/testsuite/gcc.dg/profile-update-warning.c > b/gcc/testsuite/gcc.dg/profile-update-warning.c > new file mode 100644 > index 000..0614fad > --- /dev/null > +++ b/gcc/testsuite