diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-04-20 15:36:45 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-04-20 15:36:45 +0000 |
commit | c3e85a5791bb5b6a4afb9748029b9f804666d0b2 (patch) | |
tree | 7440afed755684acfb2774ba45ae6709add2d3a0 | |
parent | 08843223915f937a606645b334d9743aee7d91d0 (diff) | |
download | gcc-c3e85a5791bb5b6a4afb9748029b9f804666d0b2.tar.gz |
PR libgomp/43569
* sections.c (gomp_sections_init): Initialize ws->mode.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158564 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | libgomp/ChangeLog | 5 | ||||
-rw-r--r-- | libgomp/sections.c | 20 |
2 files changed, 23 insertions, 2 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 5534cd6adaa..7756ac15a2e 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,8 @@ +2010-04-20 Jakub Jelinek <jakub@redhat.com> + + PR libgomp/43569 + * sections.c (gomp_sections_init): Initialize ws->mode. + 2010-04-14 Uros Bizjak <ubizjak@gmail.com> * acinclude.m4 (LIBGOMP_CHECK_SYNC_BUILTINS): Remove set but diff --git a/libgomp/sections.c b/libgomp/sections.c index 7acd441de53..c7f49b7c32a 100644 --- a/libgomp/sections.c +++ b/libgomp/sections.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc. +/* Copyright (C) 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Contributed by Richard Henderson <rth@redhat.com>. This file is part of the GNU OpenMP Library (libgomp). @@ -34,9 +34,25 @@ gomp_sections_init (struct gomp_work_share *ws, unsigned count) { ws->sched = GFS_DYNAMIC; ws->chunk_size = 1; - ws->end = count + 1; + ws->end = count + 1L; ws->incr = 1; ws->next = 1; +#ifdef HAVE_SYNC_BUILTINS + /* Prepare things to make each iteration faster. */ + if (sizeof (long) > sizeof (unsigned)) + ws->mode = 1; + else + { + struct gomp_thread *thr = gomp_thread (); + struct gomp_team *team = thr->ts.team; + long nthreads = team ? team->nthreads : 1; + + ws->mode = ((nthreads | ws->end) + < 1UL << (sizeof (long) * __CHAR_BIT__ / 2 - 1)); + } +#else + ws->mode = 0; +#endif } /* This routine is called when first encountering a sections construct |