summaryrefslogtreecommitdiff
path: root/libgomp/iter.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2011-06-22 20:39:25 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2011-06-22 20:39:25 +0000
commit31712e83a5cbef7bb3af1ad1a7ab271de5c9c4b4 (patch)
treec2cc34ab7a462c76b41fcd457b365ba285e84685 /libgomp/iter.c
parent777e67996082e503858a25af4fb4c9d6b6b3d546 (diff)
downloadgcc-31712e83a5cbef7bb3af1ad1a7ab271de5c9c4b4.tar.gz
PR libgomp/49490
* omp-low.c (expand_omp_for_static_nochunk): Only use n ceil/ nthreads size for the first n % nthreads threads in the team instead of all threads except for the last few ones which get less work or none at all. * iter.c (gomp_iter_static_next): For chunk size 0 only use n ceil/ nthreads size for the first n % nthreads threads in the team instead of all threads except for the last few ones which get less work or none at all. * iter_ull.c (gomp_iter_ull_static_next): Likewise. * env.c (parse_schedule): If OMP_SCHEDULE doesn't have chunk argument, set run_sched_modifier to 0 for static resp. 1 for other kinds. If chunk argument is 0 and not static, set value to 1. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@175315 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp/iter.c')
-rw-r--r--libgomp/iter.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/libgomp/iter.c b/libgomp/iter.c
index 9ec4dbd2252..cd9484a1ea4 100644
--- a/libgomp/iter.c
+++ b/libgomp/iter.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2008, 2009, 2011 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
@@ -59,7 +59,7 @@ gomp_iter_static_next (long *pstart, long *pend)
trip through the outer loop. */
if (ws->chunk_size == 0)
{
- unsigned long n, q, i;
+ unsigned long n, q, i, t;
unsigned long s0, e0;
long s, e;
@@ -74,11 +74,14 @@ gomp_iter_static_next (long *pstart, long *pend)
/* Compute the "zero-based" start and end points. That is, as
if the loop began at zero and incremented by one. */
q = n / nthreads;
- q += (q * nthreads != n);
- s0 = q * i;
+ t = n % nthreads;
+ if (i < t)
+ {
+ t = 0;
+ q++;
+ }
+ s0 = q * i + t;
e0 = s0 + q;
- if (e0 > n)
- e0 = n;
/* Notice when no iterations allocated for this thread. */
if (s0 >= e0)