summaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2008-06-13 15:44:25 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2008-06-13 15:44:25 +0000
commit49dbc65a258b9f187ea549a505443e500df8683f (patch)
tree9261bc45df26a587b5762e9d1ec2a6307641c5ea /libgomp
parent5c83e8d87ce4673b56807db9a168e58d709370b7 (diff)
downloadgcc-49dbc65a258b9f187ea549a505443e500df8683f.tar.gz
2008-06-13 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r136757 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@136758 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/ChangeLog29
-rw-r--r--libgomp/config.h.in3
-rwxr-xr-xlibgomp/configure3
-rw-r--r--libgomp/configure.ac2
-rw-r--r--libgomp/env.c3
-rw-r--r--libgomp/libgomp.h1
-rw-r--r--libgomp/omp_lib.f90.in6
-rw-r--r--libgomp/task.c12
-rw-r--r--libgomp/testsuite/libgomp.c/reduction-5.c78
9 files changed, 130 insertions, 7 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 92b999fd3c3..1e81a55d66b 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,32 @@
+2008-06-12 Tobias Burnus <burnus@net-b.de>
+
+ * omp_lib.f90.in: Add "implicit none".
+
+2008-06-12 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/36506
+ * testsuite/libgomp.c/reduction-5.c: New test.
+
+2008-06-11 Jakub Jelinek <jakub@redhat.com>
+
+ * libgomp.h (struct gomp_task): Add in_tied_task field.
+ * task.c (gomp_init_task): Initialize it.
+ (GOMP_task): Likewise. Call gomp_team_barrier_set_task_pending
+ unconditionally. Don't call gomp_team_barrier_wake if
+ current task is implicit or if(0) from implicit and number of
+ running tasks is equal to nthreads - 1.
+
+ PR libgomp/36471
+ * omp_lib.f90.in (omp_get_ancestor_thread_num_8,
+ omp_get_team_size_8): Fix pastos.
+
+ PR libgomp/36469
+ * configure.ac: Add AC_CHECK_FUNCS (strtoull).
+ * configure: Regenerated.
+ * config.h.in: Regenerated.
+ * env.c (strtoull): Define to strtoul if HAVE_STRTOULL is not
+ defined.
+
2008-06-06 Andreas Tobler <a.tobler@schweiz.org>
PR bootstrap/36452
diff --git a/libgomp/config.h.in b/libgomp/config.h.in
index 900711e1322..c83c2cf13cf 100644
--- a/libgomp/config.h.in
+++ b/libgomp/config.h.in
@@ -48,6 +48,9 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
+/* Define to 1 if you have the `strtoull' function. */
+#undef HAVE_STRTOULL
+
/* Define to 1 if the target supports __sync_*_compare_and_swap */
#undef HAVE_SYNC_BUILTINS
diff --git a/libgomp/configure b/libgomp/configure
index 4b00f8bd791..0ef9bcdb0e6 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -17411,7 +17411,8 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
# Check for functions needed.
-for ac_func in getloadavg clock_gettime
+
+for ac_func in getloadavg clock_gettime strtoull
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index 12c92340e8c..21aed2ba819 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -178,7 +178,7 @@ AC_LINK_IFELSE(
[AC_MSG_ERROR([Pthreads are required to build libgomp])])])
# Check for functions needed.
-AC_CHECK_FUNCS(getloadavg clock_gettime)
+AC_CHECK_FUNCS(getloadavg clock_gettime strtoull)
# Check for broken semaphore implementation on darwin.
# sem_init returns: sem_init error: Function not implemented.
diff --git a/libgomp/env.c b/libgomp/env.c
index 022fb1bb0ad..50872c277fe 100644
--- a/libgomp/env.c
+++ b/libgomp/env.c
@@ -47,6 +47,9 @@
#include <limits.h>
#include <errno.h>
+#ifndef HAVE_STRTOULL
+# define strtoull(ptr, eptr, base) strtoul (ptr, eptr, base)
+#endif
struct gomp_task_icv gomp_global_icv = {
.nthreads_var = 1,
diff --git a/libgomp/libgomp.h b/libgomp/libgomp.h
index 66180122c1e..7292358b9aa 100644
--- a/libgomp/libgomp.h
+++ b/libgomp/libgomp.h
@@ -253,6 +253,7 @@ struct gomp_task
void *fn_data;
enum gomp_task_kind kind;
bool in_taskwait;
+ bool in_tied_task;
gomp_sem_t taskwait_sem;
};
diff --git a/libgomp/omp_lib.f90.in b/libgomp/omp_lib.f90.in
index a31a94567ea..07a57997b28 100644
--- a/libgomp/omp_lib.f90.in
+++ b/libgomp/omp_lib.f90.in
@@ -26,6 +26,7 @@
! General Public License.
module omp_lib_kinds
+ implicit none
integer, parameter :: omp_integer_kind = 4
integer, parameter :: omp_logical_kind = 4
integer, parameter :: omp_lock_kind = @OMP_LOCK_KIND@
@@ -35,6 +36,7 @@
module omp_lib
use omp_lib_kinds
+ implicit none
integer, parameter :: openmp_version = 200805
integer (omp_sched_kind), parameter :: omp_sched_static = 1
integer (omp_sched_kind), parameter :: omp_sched_dynamic = 2
@@ -268,7 +270,7 @@
function omp_get_ancestor_thread_num_8 (level)
use omp_lib_kinds
integer (8), intent (in) :: level
- integer (omp_integer_kind) :: omp_get_ancestor_thread_num
+ integer (omp_integer_kind) :: omp_get_ancestor_thread_num_8
end function omp_get_ancestor_thread_num_8
end interface
@@ -281,7 +283,7 @@
function omp_get_team_size_8 (level)
use omp_lib_kinds
integer (8), intent (in) :: level
- integer (omp_integer_kind) :: omp_get_team_size
+ integer (omp_integer_kind) :: omp_get_team_size_8
end function omp_get_team_size_8
end interface
diff --git a/libgomp/task.c b/libgomp/task.c
index 903948ceca3..ce991b8dca2 100644
--- a/libgomp/task.c
+++ b/libgomp/task.c
@@ -43,6 +43,7 @@ gomp_init_task (struct gomp_task *task, struct gomp_task *parent_task,
task->icv = *prev_icv;
task->kind = GOMP_TASK_IMPLICIT;
task->in_taskwait = false;
+ task->in_tied_task = false;
task->children = NULL;
gomp_sem_init (&task->taskwait_sem, 0);
}
@@ -103,6 +104,8 @@ GOMP_task (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),
gomp_init_task (&task, thr->task, gomp_icv (false));
task.kind = GOMP_TASK_IFFALSE;
+ if (thr->task)
+ task.in_tied_task = thr->task->in_tied_task;
thr->task = &task;
if (__builtin_expect (cpyfn != NULL, 0))
{
@@ -134,6 +137,7 @@ GOMP_task (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),
& ~(uintptr_t) (arg_align - 1));
gomp_init_task (task, parent, gomp_icv (false));
task->kind = GOMP_TASK_IFFALSE;
+ task->in_tied_task = parent->in_tied_task;
thr->task = task;
if (cpyfn)
cpyfn (arg, data);
@@ -143,6 +147,7 @@ GOMP_task (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),
task->kind = GOMP_TASK_WAITING;
task->fn = fn;
task->fn_data = arg;
+ task->in_tied_task = true;
gomp_mutex_lock (&team->task_lock);
if (parent->children)
{
@@ -170,9 +175,10 @@ GOMP_task (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),
task->prev_queue = task;
team->task_queue = task;
}
- if (team->task_count++ == 0)
- gomp_team_barrier_set_task_pending (&team->barrier);
- do_wake = team->task_running_count < team->nthreads;
+ ++team->task_count;
+ gomp_team_barrier_set_task_pending (&team->barrier);
+ do_wake = team->task_running_count + !parent->in_tied_task
+ < team->nthreads;
gomp_mutex_unlock (&team->task_lock);
if (do_wake)
gomp_team_barrier_wake (&team->barrier, 1);
diff --git a/libgomp/testsuite/libgomp.c/reduction-5.c b/libgomp/testsuite/libgomp.c/reduction-5.c
new file mode 100644
index 00000000000..de87d9f6dc8
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/reduction-5.c
@@ -0,0 +1,78 @@
+/* PR middle-end/36506 */
+
+extern void abort (void);
+
+int
+main (void)
+{
+ int sum = 0, prod = 1;
+#pragma omp parallel
+ #pragma omp sections reduction (+:sum)
+ {
+ #pragma omp section
+ sum += 2;
+ #pragma omp section
+ sum += 2;
+ #pragma omp section
+ sum += 2;
+ }
+ if (sum != 6)
+ abort ();
+ sum = 0;
+#pragma omp parallel sections reduction (+:sum)
+ {
+ #pragma omp section
+ sum += 2;
+ #pragma omp section
+ sum += 2;
+ #pragma omp section
+ sum += 2;
+ }
+ if (sum != 6)
+ abort ();
+ sum = 0;
+#pragma omp parallel
+ #pragma omp sections reduction (+:sum) reduction (*:prod)
+ {
+ #pragma omp section
+ {
+ sum += 2;
+ prod *= 2;
+ }
+ #pragma omp section
+ {
+ sum += 2;
+ prod *= 2;
+ }
+ #pragma omp section
+ {
+ sum += 2;
+ prod *= 2;
+ }
+ }
+ if (sum != 6 || prod != 8)
+ abort ();
+ sum = 0;
+ prod = 1;
+#pragma omp parallel sections reduction (+:sum) reduction (*:prod)
+ {
+ #pragma omp section
+ {
+ sum += 2;
+ prod *= 2;
+ }
+ #pragma omp section
+ {
+ sum += 2;
+ prod *= 2;
+ }
+ #pragma omp section
+ {
+ sum += 2;
+ prod *= 2;
+ }
+ }
+ if (sum != 6 || prod != 8)
+ abort ();
+ return 0;
+}