On 09/07/2016 09:45 AM, Christophe Lyon wrote: > On 6 September 2016 at 15:45, Martin Liška <mli...@suse.cz> 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 SImode and DImode are in fact 4*BITS_PER_UNIT and 8*BITS_PER_UNIT, >>> TYPE_SIZE_UNIT comparisons for 4 and 8 are most natural. >>> And I wouldn't add gcc_unreachable, just warn for weirdo arches always. >>> >>> Jakub >> >> Thank you Jakub for helping me with that. I've used TYPE_SIZE_UNIT macro. >> >> Ready for trunk? >> Martin > > Hi Martin, > > On targets which do not support atomic profile update, your patch generates a > warning on gcc.dg/tree-prof/val-profiler-threads-1.c, making it fail. > > Do we need a new effective-target ? > > Christophe >
Hi. Thanks for observation, I'm sending a patch that does that. Can you please test it? Thanks, Martin
>From 9a68f2fbf2b5cb547aee7860926c846d5f15d398 Mon Sep 17 00:00:00 2001 From: marxin <mli...@suse.cz> Date: Wed, 7 Sep 2016 11:28:13 +0200 Subject: [PATCH] Add new effective target: profile_update_atomic gcc/testsuite/ChangeLog: 2016-09-07 Martin Liska <mli...@suse.cz> * g++.dg/gcov/gcov-threads-1.C: Use profile_update_atomic effective target. * gcc.dg/tree-prof/val-profiler-threads-1.c: Likewise. * lib/target-supports.exp: Define the new target. --- gcc/testsuite/g++.dg/gcov/gcov-threads-1.C | 1 + gcc/testsuite/gcc.dg/tree-prof/val-profiler-threads-1.c | 2 ++ gcc/testsuite/lib/target-supports.exp | 7 +++++++ 3 files changed, 10 insertions(+) diff --git a/gcc/testsuite/g++.dg/gcov/gcov-threads-1.C b/gcc/testsuite/g++.dg/gcov/gcov-threads-1.C index a4a6f0a..cc9266a 100644 --- a/gcc/testsuite/g++.dg/gcov/gcov-threads-1.C +++ b/gcc/testsuite/g++.dg/gcov/gcov-threads-1.C @@ -1,5 +1,6 @@ /* { dg-options "-fprofile-arcs -ftest-coverage -pthread -fprofile-update=atomic" } */ /* { dg-do run { target native } } */ +/* { dg-require-effective-target profile_update_atomic } */ #include <stdint.h> #include <pthread.h> diff --git a/gcc/testsuite/gcc.dg/tree-prof/val-profiler-threads-1.c b/gcc/testsuite/gcc.dg/tree-prof/val-profiler-threads-1.c index e9b04a0..95d6ee3 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/val-profiler-threads-1.c +++ b/gcc/testsuite/gcc.dg/tree-prof/val-profiler-threads-1.c @@ -1,4 +1,6 @@ /* { dg-options "-O0 -pthread -fprofile-update=atomic" } */ +/* { dg-require-effective-target profile_update_atomic } */ + #include <pthread.h> #define NUM_THREADS 8 diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 545b3dc..6724a7f 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -7699,3 +7699,10 @@ proc check_effective_target_offload_hsa { } { int main () {return 0;} } "-foffload=hsa" ] } + +# Return 1 if the target support -fprofile-update=atomic +proc check_effective_target_profile_update_atomic {} { + return [check_no_compiler_messages profile_update_atomic assembly { + int main (void) { return 0; } + } "-fprofile-update=atomic -fprofile-generate"] +} -- 2.9.2