summaryrefslogtreecommitdiffstats
path: root/contrib/gcclibs/libgomp/iter.c
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2015-04-28 16:47:56 +0000
committerpfg <pfg@FreeBSD.org>2015-04-28 16:47:56 +0000
commit2d27910557b244e5865dd06b404266affda4b69f (patch)
tree1520aa2b59b9d24dcf83d81f2b9dbdb778880d61 /contrib/gcclibs/libgomp/iter.c
parentfefec004ec27508db607b80e855d1fbee3b0b756 (diff)
parentefa03e2cad49a3519b80897c1fef2ca9997f76fb (diff)
downloadFreeBSD-src-2d27910557b244e5865dd06b404266affda4b69f.zip
FreeBSD-src-2d27910557b244e5865dd06b404266affda4b69f.tar.gz
MFV r282150
libgomp: Update to version 4.3.5. This is a partial revert of r282115, to bring the fromal upstream libgomp from GCC 4.3.5 Release under LGPLv2.1+. This is only brought to ease the ongoing development of the CPU affinity support. This shall not be MFC'd.
Diffstat (limited to 'contrib/gcclibs/libgomp/iter.c')
-rw-r--r--contrib/gcclibs/libgomp/iter.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/contrib/gcclibs/libgomp/iter.c b/contrib/gcclibs/libgomp/iter.c
index 1a8a2a7..2d5dd2e 100644
--- a/contrib/gcclibs/libgomp/iter.c
+++ b/contrib/gcclibs/libgomp/iter.c
@@ -242,16 +242,16 @@ gomp_iter_guided_next_locked (long *pstart, long *pend)
if (ws->next == ws->end)
return false;
- n = (ws->end - ws->next) / ws->incr;
+ start = ws->next;
+ n = (ws->end - start) / ws->incr;
q = (n + nthreads - 1) / nthreads;
if (q < ws->chunk_size)
q = ws->chunk_size;
- if (q > n)
- q = n;
-
- start = ws->next;
- end = start + q * ws->incr;
+ if (q <= n)
+ end = start + q * ws->incr;
+ else
+ end = ws->end;
ws->next = end;
*pstart = start;
@@ -286,15 +286,15 @@ gomp_iter_guided_next (long *pstart, long *pend)
if (start == end)
return false;
- n = (end - start) / ws->incr;
+ n = (end - start) / incr;
q = (n + nthreads - 1) / nthreads;
if (q < chunk_size)
q = chunk_size;
- if (q > n)
- q = n;
-
- nend = start + q * incr;
+ if (__builtin_expect (q <= n, 1))
+ nend = start + q * incr;
+ else
+ nend = end;
tmp = __sync_val_compare_and_swap (&ws->next, start, nend);
if (__builtin_expect (tmp == start, 1))
OpenPOWER on IntegriCloud