Skip to content
Snippets Groups Projects
  1. Jan 02, 2025
  2. Jan 03, 2024
  3. Jan 16, 2023
  4. Oct 12, 2022
    • Jakub Jelinek's avatar
      libgomp: Add omp_in_explicit_task support · 0ec4e93f
      Jakub Jelinek authored
      This is pretty straightforward, if gomp_thread ()->task is NULL,
      it can't be explicit task, otherwise if
      gomp_thread ()->task->kind == GOMP_TASK_IMPLICIT, it is an implicit
      task, otherwise explicit task.
      
      2022-10-12  Jakub Jelinek  <jakub@redhat.com>
      
      	* omp.h.in (omp_in_explicit_task): Declare.
      	* omp_lib.h.in (omp_in_explicit_task): Likewise.
      	* omp_lib.f90.in (omp_in_explicit_task): New interface.
      	* libgomp.map (OMP_5.2): New symbol version, export
      	omp_in_explicit_task and omp_in_explicit_task_.
      	* task.c (omp_in_explicit_task): New function.
      	* fortran.c (omp_in_explicit_task): Add ialias_redirect.
      	(omp_in_explicit_task_): New function.
      	* libgomp.texi (OpenMP 5.2): Mark omp_in_explicit_task as implemented.
      	* testsuite/libgomp.c-c++-common/task-in-explicit-1.c: New test.
      	* testsuite/libgomp.c-c++-common/task-in-explicit-2.c: New test.
      	* testsuite/libgomp.c-c++-common/task-in-explicit-3.c: New test.
      0ec4e93f
    • Jakub Jelinek's avatar
      libgomp: Fix up creation of artificial teams · a58a965e
      Jakub Jelinek authored
      When not in explicit parallel/target/teams construct, we in some cases create
      an artificial parallel with a single thread (either to handle target nowait
      or for task reduction purposes).  In those cases, it handled again artificially
      created implicit task (created by gomp_new_icv for cases where we needed to write
      to some ICVs), but as the testcases show, didn't take into account possibility
      of this being done from explicit task(s).  The code would destroy/free the previous
      task and replace it with the new implicit task.  If task is an explicit task
      (when teams is NULL, all explicit tasks behave like if (0)), it is a pointer to
      a local stack variable, so freeing it doesn't work, and additionally we shouldn't
      lose the explicit tasks - the new implicit task should instead replace the
      ancestor task which is the first implicit one.
      
      2022-10-12  Jakub Jelinek  <jakub@redhat.com>
      
      	* task.c (gomp_create_artificial_team): Fix up handling of invocations
      	from within explicit task.
      	* target.c (GOMP_target_ext): Likewise.
      	* testsuite/libgomp.c/task-7.c: New test.
      	* testsuite/libgomp.c/task-8.c: New test.
      	* testsuite/libgomp.c-c++-common/task-reduction-17.c: New test.
      	* testsuite/libgomp.c-c++-common/task-reduction-18.c: New test.
      a58a965e
  5. May 25, 2022
    • Jakub Jelinek's avatar
      libgomp: Fix occassional hangs with taskwait nowait depend · c125f504
      Jakub Jelinek authored
      Richi reported occassional hangs with taskwait-depend-nowait-1.*
      tests and I've finally manged to reproduce.  The problem is if
      taskwait depend without nowait is encountered soon after
      taskwait depend nowait and the former depends on the latter and there
      is no other work to do, the taskwait depend without nowait is put
      to sleep, but the empty_task optimization in
      gomp_task_run_post_handle_dependers wouldn't wake it up in that
      case.  gomp_task_run_post_handle_dependers normally does some wakeups
      because it schedules more work (another task), which is not the
      case of empty_task, but we need to do the wakeups that would be done
      upon task completion so that we awake sleeping threads when the
      last child is done.
      So, the taskwait-depend-nowait-1.* testcase is fixed with the
      else if (__builtin_expect (task->parent_depends_on, 0) part of
      the patch.
      The new testcase can hang on another problem, if the empty task
      is the last task of a taskgroup, we need to use atomic store
      like elsewhere to decrease the counter to 0, and wake up taskgroup
      end if needed.
      Yet another spot which can sleep is normal taskwait (without depend),
      but I believe nothing needs to be done for that - in that case we
      await solely until the children's queue has no tasks, tasks still
      waiting for dependencies aren't accounted in that, but the reason
      is that if taskwait should wait for something, there needs to be at least
      one active child doing something (in the children queue), which then
      possibly awakes some of its siblings when the dependencies are met,
      or in the empty task case awakes further dependencies, but in any
      case the child that finished is still handled as active child and
      will awake taskwait at the end if there is nothing further to
      do.
      Last sleeping case are barriers, but that is handled by ++ret and
      awaking the barrier.
      
      2022-05-25  Jakub Jelinek  <jakub@redhat.com>
      
      	* task.c (gomp_task_run_post_handle_dependers): If empty_task
      	is the last task taskwait depend depends on, wake it up.
      	Similarly if it is the last child of a taskgroup, use atomic
      	store instead of decrement and awak taskgroup wait if any.
      	* testsuite/libgomp.c-c++-common/taskwait-depend-nowait-2.c: New test.
      c125f504
  6. May 24, 2022
    • Jakub Jelinek's avatar
      openmp: Add taskwait nowait depend support [PR105378] · b4383691
      Jakub Jelinek authored
      This patch adds support for (so far C/C++)
        #pragma omp taskwait nowait depend(...)
      directive, which is like
        #pragma omp task depend(...)
        ;
      but slightly optimized on the library side, so that it creates
      the task only for the purpose of dependency tracking and doesn't actually
      schedule it and wait for it when the dependencies are satisfied, instead
      makes its dependencies satisfied right away.
      
      2022-05-24  Jakub Jelinek  <jakub@redhat.com>
      
      	PR c/105378
      gcc/
      	* omp-builtins.def (BUILT_IN_GOMP_TASKWAIT_DEPEND_NOWAIT): New
      	builtin.
      	* gimplify.cc (gimplify_omp_task): Diagnose taskwait with nowait
      	clause but no depend clauses.
      	* omp-expand.cc (expand_taskwait_call): Use
      	BUILT_IN_GOMP_TASKWAIT_DEPEND_NOWAIT rather than
      	BUILT_IN_GOMP_TASKWAIT_DEPEND if nowait clause is present.
      gcc/c/
      	* c-parser.cc (OMP_TASKWAIT_CLAUSE_MASK): Add nowait clause.
      gcc/cp/
      	* parser.cc (OMP_TASKWAIT_CLAUSE_MASK): Add nowait clause.
      gcc/testsuite/
      	* c-c++-common/gomp/taskwait-depend-nowait-1.c: New test.
      libgomp/
      	* libgomp_g.h (GOMP_taskwait_depend_nowait): Declare.
      	* libgomp.map (GOMP_taskwait_depend_nowait): Export at GOMP_5.1.1.
      	* task.c (empty_task): New function.
      	(gomp_task_run_post_handle_depend_hash): Declare earlier.
      	(gomp_task_run_post_handle_depend): Declare.
      	(GOMP_task): Optimize fn == empty_task if there is nothing to wait
      	for.
      	(gomp_task_run_post_handle_dependers): Optimize task->fn == empty_task.
      	(GOMP_taskwait_depend_nowait): New function.
      	* testsuite/libgomp.c-c++-common/taskwait-depend-nowait-1.c: New test.
      b4383691
  7. May 20, 2022
    • Marcel Vollweiler's avatar
      libgomp: Add new runtime routines omp_target_memcpy_async and omp_target_memcpy_rect_async · 6c420193
      Marcel Vollweiler authored
      This patch adds two new OpenMP runtime routines: omp_target_memcpy_async and
      omp_target_memcpy_rect_async. Both functions are introduced in OpenMP 5.1 as
      asynchronous variants of omp_target_memcpy and omp_target_memcpy_rect.
      
      In contrast to the synchronous variants, the asynchronous functions have two
      additional function parameters to allow the specification of task dependences:
      
      	int depobj_count
      	omp_depend_t *depobj_list
      
      	integer(c_int), value :: depobj_count
      	integer(omp_depend_kind), optional :: depobj_list(*)
      
      The implementation splits the synchronous functions into two parts: (a) check
      and (b) copy. Then (a) is used in the asynchronous functions for the sequential
      part, and the actual copy process (b) is executed in a new created task. The
      sequential part (a) takes into account the requirements for the return values:
      
      "The routine returns zero if successful. Otherwise, it returns a non-zero
      value." (omp_target_memcpy_async, OpenMP 5.1 spec, section 3.8.7)
      
      "An application can determine the number of inclusive dimensions supported by an
      implementation by passing NULL pointers (or C_NULL_PTR, for Fortran) for both
      dst and src. The routine returns the number of dimensions supported by the
      implementation for the specified device numbers. No copy operation is
      performed." (omp_target_memcpy_rect_async, OpenMP 5.1 spec, section 3.8.8)
      
      Due to asynchronicity an error is thrown if the asynchronous memcpy is not
      successful (in contrast to the synchronous functions which use a return
      value unequal to zero).
      
      gcc/ChangeLog:
      
      	* omp-low.cc (omp_runtime_api_call): Added target_memcpy_async and
      	target_memcpy_rect_async to omp_runtime_apis array.
      
      libgomp/ChangeLog:
      
      	* libgomp.map: Added omp_target_memcpy_async and
      	omp_target_memcpy_rect_async.
      	* libgomp.texi: Both functions are now supported.
      	* omp.h.in: Added omp_target_memcpy_async and
      	omp_target_memcpy_rect_async.
      	* omp_lib.f90.in: Added interfaces for both new functions.
      	* omp_lib.h.in: Likewise.
      	* target.c (ialias_redirect): Added for GOMP_task.
      	(omp_target_memcpy): Restructured into check and copy part.
      	(omp_target_memcpy_check): New helper function for omp_target_memcpy and
      	omp_target_memcpy_async that checks requirements.
      	(omp_target_memcpy_copy): New helper function for omp_target_memcpy and
      	omp_target_memcpy_async that performs the memcpy.
      	(omp_target_memcpy_async_helper): New helper function that is used in
      	omp_target_memcpy_async for the asynchronous task.
      	(omp_target_memcpy_async): Added.
      	(omp_target_memcpy_rect): Restructured into check and copy part.
      	(omp_target_memcpy_rect_check): New helper function for
      	omp_target_memcpy_rect and omp_target_memcpy_rect_async that checks
      	requirements.
      	(omp_target_memcpy_rect_copy): New helper function for
      	omp_target_memcpy_rect and omp_target_memcpy_rect_async that performs
      	the memcpy.
      	(omp_target_memcpy_rect_async_helper): New helper function that is used
      	in omp_target_memcpy_rect_async for the asynchronous task.
      	(omp_target_memcpy_rect_async): Added.
      	* task.c (ialias): Added for GOMP_task.
      	* testsuite/libgomp.c-c++-common/target-memcpy-async-1.c: New test.
      	* testsuite/libgomp.c-c++-common/target-memcpy-async-2.c: New test.
      	* testsuite/libgomp.c-c++-common/target-memcpy-rect-async-1.c: New test.
      	* testsuite/libgomp.c-c++-common/target-memcpy-rect-async-2.c: New test.
      	* testsuite/libgomp.fortran/target-memcpy-async-1.f90: New test.
      	* testsuite/libgomp.fortran/target-memcpy-async-2.f90: New test.
      	* testsuite/libgomp.fortran/target-memcpy-rect-async-1.f90: New test.
      	* testsuite/libgomp.fortran/target-memcpy-rect-async-2.f90: New test.
      6c420193
  8. May 17, 2022
    • Jakub Jelinek's avatar
      openmp: Add support for inoutset depend-kind · 2c16eb31
      Jakub Jelinek authored
      This patch adds support for inoutset depend-kind in depend
      clauses.  It is very similar to the in depend-kind in that
      a task with a dependency with that depend-kind is dependent
      on all previously created sibling tasks with matching address
      unless they have the same depend-kind.
      In the in depend-kind case everything is dependent except
      for in -> in dependency, for inoutset everything is
      dependent except for inoutset -> inoutset dependency.
      mutexinoutset is also similar (everything is dependent except
      for mutexinoutset -> mutexinoutset dependency), but there is
      also the additional restriction that only one task with
      mutexinoutset for each address can be scheduled at once (i.e.
      mutual exclusitivty).  For now we support mutexinoutset
      the same as inout/out, but the inoutset support is full.
      
      In order not to bump the ABI for dependencies each time
      (we've bumped it already once, the old ABI supports only
      inout/out and in depend-kind, the new ABI supports
      inout/out, mutexinoutset, in and depobj), this patch arranges
      for inoutset to be at least for the time being always handled
      as if it was specified through depobj even when it is not.
      So it uses the new ABI for that and inoutset are represented
      like depobj - pointer to a pair of pointers where the first one
      will be the actual address of the object mentioned in depend
      clause and second pointer will be (void *) GOMP_DEPEND_INOUTSET.
      
      2022-05-17  Jakub Jelinek  <jakub@redhat.com>
      
      gcc/
      	* tree-core.h (enum omp_clause_depend_kind): Add
      	OMP_CLAUSE_DEPEND_INOUTSET.
      	* tree-pretty-print.cc (dump_omp_clause): Handle
      	OMP_CLAUSE_DEPEND_INOUTSET.
      	* gimplify.cc (gimplify_omp_depend): Likewise.
      	* omp-low.cc (lower_depend_clauses): Likewise.
      gcc/c-family/
      	* c-omp.cc (c_finish_omp_depobj): Handle
      	OMP_CLAUSE_DEPEND_INOUTSET.
      gcc/c/
      	* c-parser.cc (c_parser_omp_clause_depend): Parse
      	inoutset depend-kind.
      	(c_parser_omp_depobj): Likewise.
      gcc/cp/
      	* parser.cc (cp_parser_omp_clause_depend): Parse
      	inoutset depend-kind.
      	(cp_parser_omp_depobj): Likewise.
      	* cxx-pretty-print.cc (cxx_pretty_printer::statement): Handle
      	OMP_CLAUSE_DEPEND_INOUTSET.
      gcc/testsuite/
      	* c-c++-common/gomp/all-memory-1.c (boo): Add test with
      	inoutset depend-kind.
      	* c-c++-common/gomp/all-memory-2.c (boo): Likewise.
      	* c-c++-common/gomp/depobj-1.c (f1): Likewise.
      	(f2): Adjusted expected diagnostics.
      	* g++.dg/gomp/depobj-1.C (f4): Adjust expected diagnostics.
      include/
      	* gomp-constants.h (GOMP_DEPEND_INOUTSET): Define.
      libgomp/
      	* libgomp.h (struct gomp_task_depend_entry): Change is_in type
      	from bool to unsigned char.
      	* task.c (gomp_task_handle_depend): Handle GOMP_DEPEND_INOUTSET.
      	Ignore dependencies where
      	task->depend[i].is_in && task->depend[i].is_in == ent->is_in
      	rather than just task->depend[i].is_in && ent->is_in.  Remember
      	whether GOMP_DEPEND_IN loop is needed and guard the loop with that
      	conditional.
      	(gomp_task_maybe_wait_for_dependencies): Handle GOMP_DEPEND_INOUTSET.
      	Ignore dependencies where elem.is_in && elem.is_in == ent->is_in
      	rather than just elem.is_in && ent->is_in.
      	* testsuite/libgomp.c-c++-common/depend-1.c (test): Add task with
      	inoutset depend-kind.
      	* testsuite/libgomp.c-c++-common/depend-2.c (test): Likewise.
      	* testsuite/libgomp.c-c++-common/depend-3.c (test): Likewise.
      	* testsuite/libgomp.c-c++-common/depend-inoutset-1.c: New test.
      2c16eb31
  9. May 12, 2022
    • Jakub Jelinek's avatar
      openmp: Add omp_all_memory support (C/C++ only so far) · 7f78783d
      Jakub Jelinek authored
      The ugly part is that OpenMP 5.1 made omp_all_memory a reserved identifier
      which isn't allowed to be used anywhere but in the depend clause, this is
      against how everything else has been handled in OpenMP so far (where
      some identifiers could have special meaning in some OpenMP clauses or
      pragmas but not elsewhere).
      The patch handles it by making it a conditional keyword (for -fopenmp
      only) and emitting a better diagnostics when it is used in a primary
      expression.  Having a nicer diagnostics when e.g. trying to do
      int omp_all_memory;
      or
      int *omp_all_memory[10];
      etc. would mean changing too many spots and hooking into name lookups
      to reject declaring any such symbols would be too ugly and I'm afraid
      there are way too many spots where one can introduce a name
      (variables, functions, namespaces, struct, enum, enumerators, template
      arguments, ...).
      
      Otherwise, the handling is quite simple, normal depend clauses lower
      into addresses of variables being handed over to the library, for
      omp_all_memory I'm using NULL pointers.  omp_all_memory can only be
      used with inout or out depend kinds and means that a task is dependent
      on all previously created sibling tasks that have any dependency (of
      any depend kind) and that any later created sibling tasks will be
      dependent on it if they have any dependency.
      
      2022-05-12  Jakub Jelinek  <jakub@redhat.com>
      
      gcc/
      	* gimplify.cc (gimplify_omp_depend): Don't build_fold_addr_expr
      	if null_pointer_node.
      	(gimplify_scan_omp_clauses): Likewise.
      	* tree-pretty-print.cc (dump_omp_clause): Print null_pointer_node
      	as omp_all_memory.
      gcc/c-family/
      	* c-common.h (enum rid): Add RID_OMP_ALL_MEMORY.
      	* c-omp.cc (c_finish_omp_depobj): Don't build_fold_addr_expr
      	if null_pointer_node.
      gcc/c/
      	* c-parser.cc (c_parse_init): Register omp_all_memory as keyword
      	if flag_openmp.
      	(c_parser_postfix_expression): Diagnose uses of omp_all_memory
      	in postfix expressions.
      	(c_parser_omp_variable_list): Handle omp_all_memory in depend
      	clause.
      	* c-typeck.cc (c_finish_omp_clauses): Handle omp_all_memory
      	keyword in depend clause as null_pointer_node, diagnose invalid
      	uses.
      gcc/cp/
      	* lex.cc (init_reswords): Register omp_all_memory as keyword
      	if flag_openmp.
      	* parser.cc (cp_parser_primary_expression): Diagnose uses of
      	omp_all_memory in postfix expressions.
      	(cp_parser_omp_var_list_no_open): Handle omp_all_memory in depend
      	clause.
      	* semantics.cc (finish_omp_clauses): Handle omp_all_memory
      	keyword in depend clause as null_pointer_node, diagnose invalid
      	uses.
      	* pt.cc (tsubst_omp_clause_decl): Pass through omp_all_memory.
      gcc/testsuite/
      	* c-c++-common/gomp/all-memory-1.c: New test.
      	* c-c++-common/gomp/all-memory-2.c: New test.
      	* c-c++-common/gomp/all-memory-3.c: New test.
      	* g++.dg/gomp/all-memory-1.C: New test.
      	* g++.dg/gomp/all-memory-2.C: New test.
      libgomp/
      	* libgomp.h (struct gomp_task): Add depend_all_memory member.
      	* task.c (gomp_init_task): Initialize depend_all_memory.
      	(gomp_task_handle_depend): Handle omp_all_memory.
      	(gomp_task_run_post_handle_depend_hash): Clear
      	parent->depend_all_memory if equal to current task.
      	(gomp_task_maybe_wait_for_dependencies): Handle omp_all_memory.
      	* testsuite/libgomp.c-c++-common/depend-1.c: New test.
      	* testsuite/libgomp.c-c++-common/depend-2.c: New test.
      	* testsuite/libgomp.c-c++-common/depend-3.c: New test.
      7f78783d
  10. Feb 08, 2022
    • Jakub Jelinek's avatar
      libgomp: Fix segfault with posthumous orphan tasks [PR104385] · 0af7ef05
      Jakub Jelinek authored
      The following patch fixes crashes with posthumous orphan tasks.
      When a parent task finishes, gomp_clear_parent clears the parent
      pointers of its children tasks present in the parent->children_queue.
      But children that are still waiting for dependencies aren't in that
      queue yet, they will be added there only when the sibling they are
      waiting for exits.  Unfortunately we were adding those tasks into
      the queues with the original task->parent which then causes crashes
      because that task is gone and freed.  The following patch fixes that
      by clearing the parent field when we schedule such task for running
      by adding it into the queues and we know that the sibling task which
      is about to finish has NULL parent.
      
      2022-02-08  Jakub Jelinek  <jakub@redhat.com>
      
      	PR libgomp/104385
      	* task.c (gomp_task_run_post_handle_dependers): If parent is NULL,
      	clear task->parent.
      	* testsuite/libgomp.c/pr104385.c: New test.
      0af7ef05
  11. Jan 03, 2022
  12. Nov 15, 2021
    • Jakub Jelinek's avatar
      openmp: Add support for thread_limit clause on target · aea72386
      Jakub Jelinek authored
      OpenMP 5.1 says that thread_limit clause can also appear on target,
      and similarly to teams should affect the thread-limit-var ICV.
      On combined target teams, the clause goes to both.
      
      We actually passed thread_limit internally on target already before,
      but only used it for gcn/ptx offloading to hint how many threads should be
      created and for ptx didn't set thread_limit_var in that case.
      Similarly for host fallback.
      Also, I found that we weren't copying the args array that contains encoded
      thread_limit and num_teams clause for target (etc.) for async target.
      
      2021-11-15  Jakub Jelinek  <jakub@redhat.com>
      
      gcc/
      	* gimplify.c (optimize_target_teams): Only add OMP_CLAUSE_THREAD_LIMIT
      	to OMP_TARGET_CLAUSES if it isn't there already.
      gcc/c-family/
      	* c-omp.c (c_omp_split_clauses) <case OMP_CLAUSE_THREAD_LIMIT>:
      	Duplicate to both OMP_TARGET and OMP_TEAMS.
      gcc/c/
      	* c-parser.c (OMP_TARGET_CLAUSE_MASK): Add
      	PRAGMA_OMP_CLAUSE_THREAD_LIMIT.
      gcc/cp/
      	* parser.c (OMP_TARGET_CLAUSE_MASK): Add
      	PRAGMA_OMP_CLAUSE_THREAD_LIMIT.
      libgomp/
      	* task.c (gomp_create_target_task): Copy args array as well.
      	* target.c (gomp_target_fallback): Add args argument.
      	Set gomp_icv (true)->thread_limit_var if thread_limit is present.
      	(GOMP_target): Adjust gomp_target_fallback caller.
      	(GOMP_target_ext): Likewise.
      	(gomp_target_task_fn): Likewise.
      	* config/nvptx/team.c (gomp_nvptx_main): Set
      	gomp_global_icv.thread_limit_var.
      	* testsuite/libgomp.c-c++-common/thread-limit-1.c: New test.
      aea72386
  13. May 17, 2021
    • Kwok Cheung Yeung's avatar
      openmp: Notify team barrier of pending tasks in omp_fulfill_event · ba886d0c
      Kwok Cheung Yeung authored
      The team barrier should be notified of any new tasks that become runnable
      as the result of a completing task, otherwise the barrier threads might
      not resume processing available tasks, resulting in a hang.
      
      2021-05-17  Kwok Cheung Yeung  <kcy@codesourcery.com>
      
      	libgomp/
      	* task.c (omp_fulfill_event): Call gomp_team_barrier_set_task_pending
      	if new tasks generated.
      	* testsuite/libgomp.c-c++-common/task-detach-13.c: New.
      ba886d0c
  14. Feb 25, 2021
    • Kwok Cheung Yeung's avatar
      openmp: Fix intermittent hanging of task-detach-6 libgomp tests [PR98738] · d656bfda
      Kwok Cheung Yeung authored
      This adds support for the task detach clause to taskwait and taskgroup, and
      simplifies the handling of the detach clause by moving most of the extra
      handling required for detach tasks to omp_fulfill_event.
      
      2021-02-25  Kwok Cheung Yeung  <kcy@codesourcery.com>
      	    Jakub Jelinek  <jakub@redhat.com>
      
      	libgomp/
      
      	PR libgomp/98738
      	* libgomp.h (enum gomp_task_kind): Add GOMP_TASK_DETACHED.
      	(struct gomp_task): Replace detach and completion_sem fields with
      	union containing completion_sem and detach_team.  Add deferred_p
      	field.
      	(struct gomp_team): Remove task_detach_queue.
      	* task.c: Include assert.h.
      	(gomp_init_task): Initialize deferred_p and completion_sem fields.
      	Rearrange initialization order of fields.
      	(task_fulfilled_p): Delete.
      	(GOMP_task): Use address of task as the event handle.  Remove
      	initialization of detach field.  Initialize deferred_p field.
      	Use automatic local for completion_sem.  Initialize detach_team field
      	for deferred tasks.
      	(gomp_barrier_handle_tasks): Remove handling of task_detach_queue.
      	Set kind of suspended detach task to GOMP_TASK_DETACHED and
      	decrement task_running_count.  Move finish_cancelled block out of
      	else branch.  Relocate call to gomp_team_barrier_done.
      	(GOMP_taskwait): Handle tasks with completion events that have not
      	been fulfilled.
      	(GOMP_taskgroup_end): Likewise.
      	(omp_fulfill_event): Use address of task as event handle.  Post to
      	completion_sem for undeferred tasks.  Clear detach_team if task
      	has not finished.  For finished tasks, handle post-execution tasks,
      	call gomp_team_barrier_wake if necessary, and free task.
      	* team.c (gomp_new_team): Remove initialization of task_detach_queue.
      	(free_team): Remove free of task_detach_queue.
      	* testsuite/libgomp.c-c++-common/task-detach-1.c: Fix formatting.
      	* testsuite/libgomp.c-c++-common/task-detach-2.c: Fix formatting.
      	* testsuite/libgomp.c-c++-common/task-detach-3.c: Fix formatting.
      	* testsuite/libgomp.c-c++-common/task-detach-4.c: Fix formatting.
      	* testsuite/libgomp.c-c++-common/task-detach-5.c: Fix formatting.
      	Change data-sharing of detach events on enclosing parallel to private.
      	* testsuite/libgomp.c-c++-common/task-detach-6.c: Likewise.  Remove
      	taskwait directive.
      	* testsuite/libgomp.c-c++-common/task-detach-7.c: New.
      	* testsuite/libgomp.c-c++-common/task-detach-8.c: New.
      	* testsuite/libgomp.c-c++-common/task-detach-9.c: New.
      	* testsuite/libgomp.c-c++-common/task-detach-10.c: New.
      	* testsuite/libgomp.c-c++-common/task-detach-11.c: New.
      	* testsuite/libgomp.fortran/task-detach-1.f90: Fix formatting.
      	* testsuite/libgomp.fortran/task-detach-2.f90: Fix formatting.
      	* testsuite/libgomp.fortran/task-detach-3.f90: Fix formatting.
      	* testsuite/libgomp.fortran/task-detach-4.f90: Fix formatting.
      	* testsuite/libgomp.fortran/task-detach-5.f90: Fix formatting.
      	Change data-sharing of detach events on enclosing parallel to private.
      	* testsuite/libgomp.fortran/task-detach-6.f90: Likewise.  Remove
      	taskwait directive.
      	* testsuite/libgomp.fortran/task-detach-7.f90: New.
      	* testsuite/libgomp.fortran/task-detach-8.f90: New.
      	* testsuite/libgomp.fortran/task-detach-9.f90: New.
      	* testsuite/libgomp.fortran/task-detach-10.f90: New.
      	* testsuite/libgomp.fortran/task-detach-11.f90: New.
      d656bfda
  15. Jan 20, 2021
    • Jakub Jelinek's avatar
      libgomp: Fix up GOMP_task on s390x · 0bb27b81
      Jakub Jelinek authored
      On Wed, Jan 20, 2021 at 05:04:39PM +0100, Florian Weimer wrote:
      > Sorry, this appears to cause OpenMP task state corruption in RPM.  We
      > have only seen this on s390x.
      
      Haven't actually verified it, but my suspection is that this is a caller
      stack corruption.
      
      We play with fire with the GOMP_task API/ABI extensions, the GOMP_task
      function used to be:
      void
      GOMP_task (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),
                 long arg_size, long arg_align, bool if_clause, unsigned flags);
      and later:
      void
      GOMP_task (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),
                 long arg_size, long arg_align, bool if_clause, unsigned flags,
                 void **depend);
      and later:
      void
      GOMP_task (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),
                 long arg_size, long arg_align, bool if_clause, unsigned flags,
                 void **depend, int priority);
      and now:
      void
      GOMP_task (void (*fn) (void *), void *data, void (*cpyfn) (void *, void *),
                 long arg_size, long arg_align, bool if_clause, unsigned flags,
                 void **depend, int priority, void *detach)
      and which of those depend, priority and detach argument is present depends
      on the bits in flags.
      I'm afraid the compiler just decided to spill the detach = NULL store in
        if ((flags & GOMP_TASK_FLAG_DETACH) == 0)
          detach = NULL;
      on s390x into the argument stack slot.  Not a problem if the caller passes
      all those 10 arguments, but if not, can clobber random stack location.
      
      This hack should fix it up.  Priority doesn't need changing, but I've
      changed it anyway just to be safe.  With the patch none of the 3 arguments
      are ever modified, so I'd hope gcc doesn't decide to spill something
      unrelated there.
      
      2021-01-20  Jakub Jelinek  <jakub@redhat.com>
      
      	* task.c (GOMP_task): Rename priority argument to priority_arg,
      	add priority automatic variable and modify that variable.  Instead of
      	clearing detach argument when GOMP_TASK_FLAG_DETACH bit is not set,
      	check flags for that bit.
      0bb27b81
  16. Jan 18, 2021
    • Jakub Jelinek's avatar
      libgomp: Don't access gomp_sem_t as int using atomics unconditionally · d3b41bde
      Jakub Jelinek authored
      This patch introduces gomp_sem_getcount wrapper, which uses sem_getvalue
      for POSIX and atomic loads for linux futex and accel.  rtems for now
      remains broken.
      
      2021-01-18  Jakub Jelinek  <jakub@redhat.com>
      
      	* config/linux/sem.h (gomp_sem_getcount): New function.
      	* config/posix/sem.h (gomp_sem_getcount): New function.
      	* config/posix/sem.c (gomp_sem_getcount): New function.
      	* config/accel/sem.h (gomp_sem_getcount): New function.
      	* task.c (task_fulfilled_p): Use gomp_sem_getcount.
      	(omp_fulfill_event): Likewise.
      d3b41bde
  17. Jan 16, 2021
    • Kwok Cheung Yeung's avatar
      openmp: Add support for the OpenMP 5.0 task detach clause · a6d22fb2
      Kwok Cheung Yeung authored
      2021-01-16  Kwok Cheung Yeung  <kcy@codesourcery.com>
      
      	gcc/
      	* builtin-types.def
      	(BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT): Rename
      	to...
      	(BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT_PTR):
      	...this.  Add extra argument.
      	* gimplify.c (omp_default_clause): Ensure that event handle is
      	firstprivate in a task region.
      	(gimplify_scan_omp_clauses): Handle OMP_CLAUSE_DETACH.
      	(gimplify_adjust_omp_clauses): Likewise.
      	* omp-builtins.def (BUILT_IN_GOMP_TASK): Change function type to
      	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT_PTR.
      	* omp-expand.c (expand_task_call): Add GOMP_TASK_FLAG_DETACH to flags
      	if detach clause specified.  Add detach argument when generating
      	call to	GOMP_task.
      	* omp-low.c (scan_sharing_clauses): Setup data environment for detach
      	clause.
      	(finish_taskreg_scan): Move field for variable containing the event
      	handle to the front of the struct.
      	* tree-core.h (enum omp_clause_code): Add OMP_CLAUSE_DETACH.  Fix
      	ordering.
      	* tree-nested.c (convert_nonlocal_omp_clauses): Handle
      	OMP_CLAUSE_DETACH clause.
      	(convert_local_omp_clauses): Handle OMP_CLAUSE_DETACH clause.
      	* tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_DETACH.
      	* tree.c (omp_clause_num_ops): Add entry for OMP_CLAUSE_DETACH.
      	Fix ordering.
      	(omp_clause_code_name): Add entry for OMP_CLAUSE_DETACH.  Fix
      	ordering.
      	(walk_tree_1): Handle OMP_CLAUSE_DETACH.
      
      	gcc/c-family/
      	* c-pragma.h (pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_DETACH.
      	Redefine PRAGMA_OACC_CLAUSE_DETACH.
      
      	gcc/c/
      	* c-parser.c (c_parser_omp_clause_detach): New.
      	(c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_DETACH clause.
      	(OMP_TASK_CLAUSE_MASK): Add mask for PRAGMA_OMP_CLAUSE_DETACH.
      	* c-typeck.c (c_finish_omp_clauses): Handle PRAGMA_OMP_CLAUSE_DETACH
      	clause.  Prevent use of detach with mergeable and overriding the
      	data sharing mode of the event handle.
      
      	gcc/cp/
      	* parser.c (cp_parser_omp_clause_detach): New.
      	(cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_DETACH.
      	(OMP_TASK_CLAUSE_MASK): Add mask for PRAGMA_OMP_CLAUSE_DETACH.
      	* pt.c (tsubst_omp_clauses): Handle OMP_CLAUSE_DETACH clause.
      	* semantics.c (finish_omp_clauses): Handle OMP_CLAUSE_DETACH clause.
      	Prevent use of detach with mergeable and overriding the	data sharing
      	mode of the event handle.
      
      	gcc/fortran/
      	* dump-parse-tree.c (show_omp_clauses): Handle detach clause.
      	* frontend-passes.c (gfc_code_walker): Walk detach expression.
      	* gfortran.h (struct gfc_omp_clauses): Add detach field.
      	(gfc_c_intptr_kind): New.
      	* openmp.c (gfc_free_omp_clauses): Free detach clause.
      	(gfc_match_omp_detach): New.
      	(enum omp_mask1): Add OMP_CLAUSE_DETACH.
      	(enum omp_mask2): Remove OMP_CLAUSE_DETACH.
      	(gfc_match_omp_clauses): Handle OMP_CLAUSE_DETACH for OpenMP.
      	(OMP_TASK_CLAUSES): Add OMP_CLAUSE_DETACH.
      	(resolve_omp_clauses): Prevent use of detach with mergeable and
      	overriding the data sharing mode of the event handle.
      	* trans-openmp.c (gfc_trans_omp_clauses): Handle detach clause.
      	* trans-types.c (gfc_c_intptr_kind): New.
      	(gfc_init_kinds): Initialize gfc_c_intptr_kind.
      	* types.def
      	(BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT): Rename
      	to...
      	(BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT_PTR):
      	...this.  Add extra argument.
      
      	gcc/testsuite/
      	* c-c++-common/gomp/task-detach-1.c: New.
      	* g++.dg/gomp/task-detach-1.C: New.
      	* gcc.dg/gomp/task-detach-1.c: New.
      	* gfortran.dg/gomp/task-detach-1.f90: New.
      
      	include/
      	* gomp-constants.h (GOMP_TASK_FLAG_DETACH): New.
      
      	libgomp/
      	* fortran.c (omp_fulfill_event_): New.
      	* libgomp.h (struct gomp_task): Add detach and completion_sem fields.
      	(struct gomp_team): Add task_detach_queue and task_detach_count
      	fields.
      	* libgomp.map (OMP_5.0.1): Add omp_fulfill_event and omp_fulfill_event_.
      	* libgomp_g.h (GOMP_task): Add extra argument.
      	* omp.h.in (enum omp_event_handle_t): New.
      	(omp_fulfill_event): New.
      	* omp_lib.f90.in (omp_event_handle_kind): New.
      	(omp_fulfill_event): New.
      	* omp_lib.h.in (omp_event_handle_kind): New.
      	(omp_fulfill_event): Declare.
      	* priority_queue.c (priority_tree_find): New.
      	(priority_list_find): New.
      	(priority_queue_find): New.
      	* priority_queue.h (priority_queue_predicate): New.
      	(priority_queue_find): New.
      	* task.c (gomp_init_task): Initialize detach field.
      	(task_fulfilled_p): New.
      	(GOMP_task): Add detach argument.  Ignore detach argument if
      	GOMP_TASK_FLAG_DETACH not set in flags.  Initialize completion_sem
      	field.	Copy address of completion_sem into detach argument and
      	into the start of the data record.  Wait for detach event if task
      	not deferred.
      	(gomp_barrier_handle_tasks): Queue tasks with unfulfilled events.
      	Remove completed tasks and requeue dependent tasks.
      	(omp_fulfill_event): New.
      	* team.c (gomp_new_team): Initialize task_detach_queue and
      	task_detach_count fields.
      	(free_team): Free task_detach_queue field.
      	* testsuite/libgomp.c-c++-common/task-detach-1.c: New testcase.
      	* testsuite/libgomp.c-c++-common/task-detach-2.c: New testcase.
      	* testsuite/libgomp.c-c++-common/task-detach-3.c: New testcase.
      	* testsuite/libgomp.c-c++-common/task-detach-4.c: New testcase.
      	* testsuite/libgomp.c-c++-common/task-detach-5.c: New testcase.
      	* testsuite/libgomp.c-c++-common/task-detach-6.c: New testcase.
      	* testsuite/libgomp.fortran/task-detach-1.f90: New testcase.
      	* testsuite/libgomp.fortran/task-detach-2.f90: New testcase.
      	* testsuite/libgomp.fortran/task-detach-3.f90: New testcase.
      	* testsuite/libgomp.fortran/task-detach-4.f90: New testcase.
      	* testsuite/libgomp.fortran/task-detach-5.f90: New testcase.
      	* testsuite/libgomp.fortran/task-detach-6.f90: New testcase.
      a6d22fb2
  18. Jan 04, 2021
  19. Jan 01, 2020
  20. Dec 11, 2019
    • Tobias Burnus's avatar
      libgomp – spelling fixes, incl. omp_lib.h.in · 93d90219
      Tobias Burnus authored
              * omp_lib.h.in: Fix spelling of function declaration
              omp_get_cancell(l)ation.
              * libgomp.texi (acc_is_present, acc_async_test, acc_async_test_all):
              Fix typos.
              * env.c: Fix comment typos.
              * oacc-host.c: Likewise.
              * ordered.c: Likewise.
              * task.c: Likewise.
              * team.c: Likewise.
              * config/gcn/task.c: Likewise.
              * config/gcn/team.c: Likewise.
              * config/nvptx/task.c: Likewise.
              * config/nvptx/team.c: Likewise.
              * plugin/plugin-gcn.c: Likewise.
              * testsuite/libgomp.fortran/jacobi.f: Likewise.
              * testsuite/libgomp.hsa.c/tiling-2.c: Likewise.
              * testsuite/libgomp.oacc-c-c++-common/enter_exit-lib.c: Likewise.
      
      From-SVN: r279218
      93d90219
  21. Jan 01, 2019
  22. Nov 08, 2018
    • Jakub Jelinek's avatar
      builtin-types.def (BT_FN_VOID_BOOL, [...]): New. · 28567c40
      Jakub Jelinek authored
      	* builtin-types.def (BT_FN_VOID_BOOL, BT_FN_VOID_SIZE_SIZE_PTR,
      	BT_FN_UINT_UINT_PTR_PTR, BT_FN_UINT_OMPFN_PTR_UINT_UINT,
      	BT_FN_BOOL_UINT_LONGPTR_LONG_LONG_LONGPTR_LONGPTR_PTR_PTR,
      	BT_FN_BOOL_UINT_ULLPTR_LONG_ULL_ULLPTR_ULLPTR_PTR_PTR,
      	BT_FN_BOOL_LONG_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR_PTR_PTR,
      	BT_FN_BOOL_BOOL_ULL_ULL_ULL_LONG_ULL_ULLPTR_ULLPTR_PTR_PTR): New.
      	* gengtype.c (open_base_files): Add omp-general.h.
      	* gimple.c (gimple_build_omp_critical):
      	(gimple_build_omp_taskgroup): Add CLAUSES argument.  Call
      	gimple_omp_taskgroup_set_clauses.
      	(gimple_build_omp_atomic_load): Add mo argument, call
      	gimple_omp_atomic_set_memory_order.
      	(gimple_build_omp_atomic_store): Likewise.
      	(gimple_copy): Adjust handling of GIMPLE_OMP_TASKGROUP.
      	* gimple.def (GIMPLE_OMP_TASKGROUP): Use GSS_OMP_SINGLE_LAYOUT
      	instead of GSS_OMP.
      	(GIMPLE_OMP_TEAMS): Use GSS_OMP_PARALLEL_LAYOUT instead
      	of GSS_OMP_SINGLE_LAYOUT, adjust comments.
      	* gimple.h (enum gf_mask): Add GF_OMP_TEAMS_HOST, GF_OMP_TASK_TASKWAIT
      	and GF_OMP_ATOMIC_MEMORY_ORDER.  Remove GF_OMP_ATOMIC_SEQ_CST, use
      	different value for GF_OMP_ATOMIC_NEED_VALUE.
      	(struct gimple_statement_omp_taskreg): Add GIMPLE_OMP_TEAMS to
      	comments.
      	(struct gimple_statement_omp_single_layout): And remove here.
      	(struct gomp_teams): Inherit from gimple_statement_omp_taskreg rather
      	than gimple_statement_omp_single_layout.
      	(is_a_helper <gimple_statement_omp_taskreg *>::test): Allow
      	GIMPLE_OMP_TEAMS.
      	(is_a_helper <const gimple_statement_omp_taskreg *>::test): Likewise.
      	(gimple_omp_subcode): Formatting fix.
      	(gimple_omp_teams_child_fn, gimple_omp_teams_child_fn_ptr,
      	gimple_omp_teams_set_child_fn, gimple_omp_teams_data_arg,
      	gimple_omp_teams_data_arg_ptr, gimple_omp_teams_set_data_arg,
      	gimple_omp_teams_host, gimple_omp_teams_set_host,
      	gimple_omp_task_taskwait_p, gimple_omp_task_set_taskwait_p,
      	gimple_omp_taskgroup_clauses, gimple_omp_taskgroup_clauses_ptr,
      	gimple_omp_taskgroup_set_clauses): New inline functions.
      	(gimple_build_omp_atomic_load): Add enum omp_memory_order argument.
      	(gimple_build_omp_atomic_store): Likewise.
      	(gimple_omp_atomic_seq_cst_p): Remove.
      	(gimple_omp_atomic_memory_order): New function.
      	(gimple_omp_atomic_set_seq_cst): Remove.
      	(gimple_omp_atomic_set_memory_order): New function.
      	(gimple_build_omp_taskgroup): Add clauses argument.
      	* gimple-pretty-print.c (dump_gimple_omp_taskgroup): New function.
      	(dump_gimple_omp_task): Print taskwait with depend clauses.
      	(dump_gimple_omp_atomic_load, dump_gimple_omp_atomic_store): Use
      	dump_omp_atomic_memory_order.
      	(pp_gimple_stmt_1): Handle GIMPLE_OMP_TASKGROUP.
      	* gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP_ALLOC_ONLY,
      	GOVD_MAP_FROM_ONLY and GOVD_NONTEMPORAL.
      	(enum omp_region_type): Reserve bits 1 and 2 for auxiliary flags,
      	renumber values of most of ORT_* enumerators, add ORT_HOST_TEAMS,
      	ORT_COMBINED_HOST_TEAMS, ORT_TASKGROUP, ORT_TASKLOOP and
      	ORT_UNTIED_TASKLOOP enumerators.
      	(enum gimplify_defaultmap_kind): New.
      	(struct gimplify_omp_ctx): Remove target_map_scalars_firstprivate and
      	target_map_pointers_as_0len_arrays members, add defaultmap.
      	(new_omp_context): Initialize defaultmap member.
      	(gimple_add_tmp_var): Handle ORT_TASKGROUP like ORT_WORKSHARE.
      	(maybe_fold_stmt): Don't fold even in host teams regions.
      	(omp_firstprivatize_variable): Handle ORT_TASKGROUP like
      	ORT_WORKSHARE.  Test ctx->defaultmap[GDMK_SCALAR] instead of
      	ctx->omp_firstprivatize_variable.
      	(omp_add_variable): Don't add private/firstprivate for VLAs in
      	ORT_TASKGROUP.
      	(omp_default_clause): Print "taskloop" rather than "task" if
      	ORT_*TASKLOOP.
      	(omp_notice_variable): Handle ORT_TASKGROUP like ORT_WORKSHARE.
      	Handle new defaultmap clause kinds.
      	(omp_is_private): Handle ORT_TASKGROUP like ORT_WORKSHARE.  Allow simd
      	iterator to be lastprivate or private.  Fix up diagnostics if linear
      	is used on collapse>1 simd iterator.
      	(omp_check_private): Handle ORT_TASKGROUP like ORT_WORKSHARE.
      	(gimplify_omp_depend): New function.
      	(gimplify_scan_omp_clauses): Add shared clause on parallel for
      	combined parallel master taskloop{, simd} if taskloop has
      	firstprivate, lastprivate or reduction clause.  Handle
      	OMP_CLAUSE_REDUCTION_TASK diagnostics.  Adjust tests for
      	ORT_COMBINED_TEAMS.  Gimplify depend clauses with iterators.  Handle
      	cancel and simd OMP_CLAUSE_IF_MODIFIERs.  Handle
      	OMP_CLAUSE_NONTEMPORAL.  Handle new defaultmap clause kinds.  Handle
      	OMP_CLAUSE_{TASK,IN}_REDUCTION.  Diagnose invalid conditional
      	lastprivate.
      	(gimplify_adjust_omp_clauses_1): Ignore GOVD_NONTEMPORAL.  Handle
      	GOVD_MAP_ALLOC_ONLY and GOVD_MAP_FROM_ONLY.  
      	(gimplify_adjust_omp_clauses): Handle OMP_CLAUSE_NONTEMPORAL.  Handle
      	OMP_CLAUSE_{TASK,IN}_REDUCTION.
      	(gimplify_omp_task): Handle taskwait with depend clauses.
      	(gimplify_omp_for): Add shared clause on parallel for combined
      	parallel master taskloop{, simd} if taskloop has firstprivate,
      	lastprivate or reduction clause.  Use ORT_TASKLOOP or
      	ORT_UNTIED_TASKLOOP instead of ORT_TASK or ORT_UNTIED_TASK.  Adjust
      	tests for ORT_COMBINED_TEAMS.  Handle C++ range for loops with
      	NULL TREE_PURPOSE in OMP_FOR_ORIG_DECLS.  Firstprivatize
      	__for_end and __for_range temporaries on OMP_PARALLEL for
      	distribute parallel for{, simd}.  Move OMP_CLAUSE_REDUCTION
      	and OMP_CLAUSE_IN_REDUCTION from taskloop to the task construct
      	sandwiched in between two taskloops.
      	(computable_teams_clause): Test ctx->defaultmap[GDMK_SCALAR]
      	instead of ctx->omp_firstprivatize_variable.
      	(gimplify_omp_workshare): Set ort to ORT_HOST_TEAMS or
      	ORT_COMBINED_HOST_TEAMS if not inside of target construct.  If
      	host teams, use gimplify_and_return_first etc. for body like
      	for target or target data constructs, and at the end call
      	gimple_omp_teams_set_host on the GIMPLE_OMP_TEAMS object.
      	(gimplify_omp_atomic): Use OMP_ATOMIC_MEMORY_ORDER instead
      	of OMP_ATOMIC_SEQ_CST, pass it as new argument to
      	gimple_build_omp_atomic_load and gimple_build_omp_atomic_store, remove
      	gimple_omp_atomic_set_seq_cst calls.
      	(gimplify_expr) <case OMP_TASKGROUP>: Move handling into a separate
      	case, handle taskgroup clauses.
      	* lto-streamer-out.c (hash_tree): Handle
      	OMP_CLAUSE_{TASK,IN}_REDUCTION.
      	* Makefile.in (GTFILES): Add omp-general.h.
      	* omp-builtins.def (BUILT_IN_GOMP_TASKWAIT_DEPEND,
      	BUILT_IN_GOMP_LOOP_NONMONOTONIC_RUNTIME_START,
      	BUILT_IN_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_START,
      	BUILT_IN_GOMP_LOOP_START, BUILT_IN_GOMP_LOOP_ORDERED_START,
      	BUILT_IN_GOMP_LOOP_DOACROSS_START,
      	BUILT_IN_GOMP_LOOP_NONMONOTONIC_RUNTIME_NEXT,
      	BUILT_IN_GOMP_LOOP_MAYBE_NONMONOTONIC_RUNTIME_NEXT,
      	BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_START,
      	BUILT_IN_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_START,
      	BUILT_IN_GOMP_LOOP_ULL_START, BUILT_IN_GOMP_LOOP_ULL_ORDERED_START,
      	BUILT_IN_GOMP_LOOP_ULL_DOACROSS_START,
      	BUILT_IN_GOMP_LOOP_ULL_NONMONOTONIC_RUNTIME_NEXT,
      	BUILT_IN_GOMP_LOOP_ULL_MAYBE_NONMONOTONIC_RUNTIME_NEXT,
      	BUILT_IN_GOMP_PARALLEL_LOOP_NONMONOTONIC_RUNTIME,
      	BUILT_IN_GOMP_PARALLEL_LOOP_MAYBE_NONMONOTONIC_RUNTIME,
      	BUILT_IN_GOMP_PARALLEL_REDUCTIONS, BUILT_IN_GOMP_SECTIONS2_START,
      	BUILT_IN_GOMP_TEAMS_REG, BUILT_IN_GOMP_TASKGROUP_REDUCTION_REGISTER,
      	BUILT_IN_GOMP_TASKGROUP_REDUCTION_UNREGISTER,
      	BUILT_IN_GOMP_TASK_REDUCTION_REMAP,
      	BUILT_IN_GOMP_WORKSHARE_TASK_REDUCTION_UNREGISTER): New builtins.
      	* omp-expand.c (workshare_safe_to_combine_p): Return false for
      	non-worksharing loops.
      	(omp_adjust_chunk_size): Don't adjust anything if chunk_size is zero.
      	(determine_parallel_type): Don't combine parallel with worksharing
      	which has _reductemp_ clause.
      	(expand_parallel_call): Emit the GOMP_*nonmonotonic_runtime* or
      	GOMP_*maybe_nonmonotonic_runtime* builtins instead of GOMP_*runtime*
      	if there is nonmonotonic modifier or if there is no modifier and no
      	ordered clause.  For dynamic and guided schedule without monotonic
      	and nonmonotonic modifier, default to nonmonotonic.
      	(expand_omp_for): Likewise.  Adjust expand_omp_for_generic caller, use
      	GOMP_loop{,_ull}{,_ordered,_doacross}_start builtins if there are
      	task reductions.
      	(expand_task_call): Add GOMP_TASK_FLAG_REDUCTION flag to flags if
      	there are any reduction clauses.
      	(expand_taskwait_call): New function.
      	(expand_teams_call): New function.
      	(expand_omp_taskreg): Allow GIMPLE_OMP_TEAMS and call
      	expand_teams_call for it.  Formatting fix.  Handle taskwait with
      	depend clauses.
      	(expand_omp_for_generic): Add SCHED_ARG argument.  Handle expansion
      	of worksharing loops with task reductions.
      	(expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Handle
      	expansion of worksharing loops with task reductions.
      	(expand_omp_sections): Handle expansion of sections with task
      	reductions.
      	(expand_omp_synch): For host teams call expand_omp_taskreg.
      	(omp_memory_order_to_memmodel): New function.
      	(expand_omp_atomic_load, expand_omp_atomic_store,
      	expand_omp_atomic_fetch_op): Use it and gimple_omp_atomic_memory_order
      	instead of gimple_omp_atomic_seq_cst_p.
      	(build_omp_regions_1, omp_make_gimple_edges): Treat taskwait with
      	depend clauses as a standalone directive.
      	* omp-general.c (enum omp_requires): New variable.
      	(omp_extract_for_data): Initialize have_reductemp member.  Allow
      	NE_EXPR even in OpenMP loops, transform them into LT_EXPR or
      	GT_EXPR loops depending on incr sign.  Formatting fixes.
      	* omp-general.h (struct omp_for_data): Add have_reductemp member.
      	(enum omp_requires): New enum.
      	(omp_requires_mask): Declare.
      	* omp-grid.c (grid_eliminate_combined_simd_part): Formatting fix.
      	Fix comment typos.
      	* omp-low.c (struct omp_context): Add task_reductions and
      	task_reduction_map fields.
      	(is_host_teams_ctx): New function.
      	(is_taskreg_ctx): Return true also if is_host_teams_ctx.
      	(use_pointer_for_field): Use is_global_var instead of
      	TREE_STATIC || DECL_EXTERNAL, and apply only if not privatized
      	in outer contexts.
      	(build_outer_var_ref): Ignore taskgroup outer contexts.
      	(delete_omp_context): Release task_reductions and task_reduction_map.
      	(scan_sharing_clauses): Don't add any fields for reduction clause on
      	taskloop.  Handle OMP_CLAUSE__REDUCTEMP_.  Handle
      	OMP_CLAUSE_{IN,TASK}_REDUCTION and OMP_CLAUSE_REDUCTION with task
      	modifier.  Don't ignore shared clauses in is_host_teams_ctx contexts.
      	Handle OMP_CLAUSE_NONTEMPORAL.
      	(add_taskreg_looptemp_clauses): Add OMP_CLAUSE__REDUCTEMP_ clause if
      	needed.
      	(scan_omp_parallel): Add _reductemp_ clause if there are any reduction
      	clauses with task modifier.
      	(scan_omp_task): Handle taskwait with depend clauses.
      	(finish_taskreg_scan): Move field corresponding to _reductemp_ clause
      	first.  Move also OMP_CLAUSE__REDUCTEMP_ clause in front if present.
      	Handle GIMPLE_OMP_TEAMS like GIMPLE_OMP_PARALLEL.
      	(scan_omp_for): Fix comment formatting.
      	(scan_omp_teams): Handle host teams constructs.
      	(check_omp_nesting_restrictions): Allow teams with no outer
      	OpenMP context.  Adjust diagnostics for teams strictly nested into
      	some explicit OpenMP construct other than target.  Allow OpenMP atomics
      	inside of simd regions.
      	(scan_omp_1_stmt): Call scan_sharing_clauses for taskgroups.
      	(scan_omp_1_stmt) <case GIMPLE_OMP_TEAMS>: Temporarily bump
      	taskreg_nesting_level while scanning host teams construct.
      	(task_reduction_read): New function.
      	(lower_rec_input_clauses): Handle OMP_CLAUSE_REDUCTION on taskloop
      	construct.  Handle OMP_CLAUSE_IN_REDUCTION and OMP_CLAUSE__REDUCTEMP_
      	clauses.  Handle OMP_CLAUSE_REDUCTION with task modifier.  Remove
      	second argument create_tmp_var if it is NULL.  Don't ignore shared
      	clauses in is_host_teams_ctx contexts.  Handle
      	OMP_CLAUSE_FIRSTPRIVATE_NO_REFERENCE on OMP_CLAUSE_FIRSTPRIVATE
      	clauses.
      	(lower_reduction_clauses): Ignore reduction clauses with task
      	modifier.  Remove second argument create_tmp_var if it is NULL.
      	Initialize OMP_ATOMIC_MEMORY_ORDER to relaxed.
      	(lower_send_clauses): Ignore reduction clauses with task modifier.
      	Handle OMP_CLAUSE__REDUCTEMP_.  Don't send anything for
      	OMP_CLAUSE_REDUCTION on taskloop.  Handle OMP_CLAUSE_IN_REDUCTION.
      	(maybe_add_implicit_barrier_cancel): Add OMP_RETURN argument, don't
      	rely that it is the last stmt in body so far.  Ignore outer taskgroup
      	contexts.
      	(omp_task_reductions_find_first, omp_task_reduction_iterate,
      	lower_omp_task_reductions): New functions.
      	(lower_omp_sections): Handle reduction clauses with taskgroup
      	modifiers.  Adjust maybe_add_implicit_barrier_cancel caller.
      	(lower_omp_single): Adjust maybe_add_implicit_barrier_cancel caller.
      	(lower_omp_for): Likewise.  Handle reduction clauses with taskgroup
      	modifiers.
      	(lower_omp_taskgroup): Handle taskgroup reductions.
      	(create_task_copyfn): Copy over OMP_CLAUSE__REDUCTEMP_ pointer.
      	Handle OMP_CLAUSE_IN_REDUCTION and OMP_CLAUSE_REDUCTION clauses.
      	(lower_depend_clauses): If there are any
      	OMP_CLAUSE_DEPEND_DEPOBJ or OMP_CLAUSE_DEPEND_MUTEXINOUTSET
      	depend clauses, use a new array format.  If OMP_CLAUSE_DEPEND_LAST is
      	seen, assume lowering is done already and return early.  Set kind
      	on artificial depend clause to OMP_CLAUSE_DEPEND_LAST.
      	(lower_omp_taskreg): Handle reduction clauses with task modifier on
      	parallel construct.  Handle reduction clause on taskloop construct.
      	Handle taskwait with depend clauses.
      	(lower_omp_1): Use lower_omp_taskreg instead of lower_omp_teams
      	for host teams constructs.
      	* tree.c (omp_clause_num_ops): Add in_reduction, task_reduction,
      	nontemporal and _reductemp_ clause entries.
      	(omp_clause_code_name): Likewise.
      	(walk_tree_1): Handle OMP_CLAUSE_{IN,TASK}_REDUCTION,
      	OMP_CLAUSE_NONTEMPORAL and OMP_CLAUSE__REDUCTEMP_.
      	* tree-core.h (enum omp_clause_code): Add
      	OMP_CLAUSE_{{IN,TASK}_REDUCTION,NONTEMPORAL,_REDUCTEMP_}.
      	(enum omp_clause_defaultmap_kind, enum omp_memory_order): New.
      	(struct tree_base): Add omp_atomic_memory_order field into union.
      	Remove OMP_ATOMIC_SEQ_CST comment.
      	(enum omp_clause_depend_kind): Add OMP_CLAUSE_DEPEND_MUTEXINOUTSET
      	and OMP_CLAUSE_DEPEND_DEPOBJ.
      	(struct tree_omp_clause): Add subcode.defaultmap_kind.
      	* tree.def (OMP_TASKGROUP): Add another operand, move next to other
      	OpenMP constructs with body and clauses operands.
      	* tree.h (OMP_BODY): Use OMP_MASTER instead of OMP_TASKGROUP.
      	(OMP_CLAUSES): Use OMP_TASKGROUP instead of OMP_SINGLE.
      	(OMP_TASKGROUP_CLAUSES): Define.
      	(OMP_CLAUSE_DECL): Use OMP_CLAUSE__REDUCTEMP_ instead of
      	OMP_CLAUSE__LOOPTEMP_.
      	(OMP_ATOMIC_SEQ_CST): Remove.
      	(OMP_ATOMIC_MEMORY_ORDER, OMP_CLAUSE_FIRSTPRIVATE_NO_REFERENCE,
      	OMP_CLAUSE_LASTPRIVATE_CONDITIONAL): Define.
      	(OMP_CLAUSE_REDUCTION_CODE, OMP_CLAUSE_REDUCTION_INIT,
      	OMP_CLAUSE_REDUCTION_MERGE, OMP_CLAUSE_REDUCTION_PLACEHOLDER,
      	OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER,
      	OMP_CLAUSE_REDUCTION_OMP_ORIG_REF): Handle
      	OMP_CLAUSE_{,IN_,TASK_}REDUCTION.
      	(OMP_CLAUSE_REDUCTION_TASK, OMP_CLAUSE_REDUCTION_INSCAN,
      	OMP_CLAUSE_DEFAULTMAP_KIND, OMP_CLAUSE_DEFAULTMAP_CATEGORY,
      	OMP_CLAUSE_DEFAULTMAP_BEHAVIOR, OMP_CLAUSE_DEFAULTMAP_SET_KIND):
      	Define.
      	* tree-inline.c (remap_gimple_stmt): Remap taskgroup clauses.
      	* tree-nested.c (convert_nonlocal_omp_clauses): Handle
      	OMP_CLAUSE__REDUCTEMP_, OMP_CLAUSE_NONTEMPORAL.
      	(convert_local_omp_clauses): Likewise.  Remove useless test.
      	* tree-parloops.c (create_call_for_reduction_1): Pass
      	OMP_MEMORY_ORDER_RELAXED as new argument to
      	dump_gimple_omp_atomic_load and dump_gimple_omp_atomic_store.
      	* tree-pretty-print.c (dump_omp_iterators): New function.
      	(dump_omp_clause): Handle OMP_CLAUSE__REDUCTEMP_,
      	OMP_CLAUSE_NONTEMPORAL, OMP_CLAUSE_{TASK,IN}_REDUCTION.  Print
      	reduction modifiers.  Handle OMP_CLAUSE_DEPEND_DEPOBJ and
      	OMP_CLAUSE_DEPEND_MUTEXINOUTSET.  Print iterators in depend clauses.
      	Print __internal__ for OMP_CLAUSE_DEPEND_LAST.  Handle cancel and
      	simd OMP_CLAUSE_IF_MODIFIERs.  Handle new kinds of
      	OMP_CLAUSE_DEFAULTMAP. Print conditional: for
      	OMP_CLAUSE_LASTPRIVATE_CONDITIONAL.
      	(dump_omp_atomic_memory_order): New function.
      	(dump_generic_node): Use it.  Print taskgroup clauses.  Print
      	taskwait with depend clauses.
      	* tree-pretty-print.h (dump_omp_atomic_memory_order): Declare.
      	* tree-streamer-in.c (unpack_ts_omp_clause_value_fields):
      	Handle OMP_CLAUSE_{TASK,IN}_REDUCTION.
      	* tree-streamer-out.c (pack_ts_omp_clause_value_fields,
      	write_ts_omp_clause_tree_pointers): Likewise.
      gcc/c-family/
      	* c-common.h (c_finish_omp_taskgroup): Add CLAUSES argument.
      	(c_finish_omp_atomic): Replace bool SEQ_CST argument with
      	enum omp_memory_order MEMORY_ORDER.
      	(c_finish_omp_flush): Add MO argument.
      	(c_omp_depend_t_p, c_finish_omp_depobj): Declare.
      	(c_finish_omp_for): Add FINAL_P argument.
      	* c-omp.c: Include memmodel.h.
      	(c_finish_omp_taskgroup): Add CLAUSES argument.  Set
      	OMP_TASKGROUP_CLAUSES to it.
      	(c_finish_omp_atomic): Replace bool SEQ_CST argument with
      	enum omp_memory_order MEMORY_ORDER.  Set OMP_ATOMIC_MEMORY_ORDER
      	instead of OMP_ATOMIC_SEQ_CST.
      	(c_omp_depend_t_p, c_finish_omp_depobj): New functions.
      	(c_finish_omp_flush): Add MO argument, if not MEMMODEL_LAST, emit
      	__atomic_thread_fence call with the given value.
      	(check_omp_for_incr_expr): Formatting fixes.
      	(c_finish_omp_for): Add FINAL_P argument.  Allow NE_EXPR
      	even in OpenMP loops, diagnose if NE_EXPR and incr expression
      	is not constant expression 1 or -1.  Transform NE_EXPR loops
      	with iterators pointers to VLA into LT_EXPR or GT_EXPR loops.
      	(c_omp_check_loop_iv_r): Look for orig decl of C++ range for
      	loops too.
      	(c_omp_split_clauses): Add support for combined
      	#pragma omp parallel master and
      	#pragma omp {,parallel }master taskloop{, simd} constructs.
      	Handle OMP_CLAUSE_IN_REDUCTION.  Handle OMP_CLAUSE_REDUCTION_TASK.
      	Handle OMP_CLAUSE_NONTEMPORAL.  Handle splitting OMP_CLAUSE_IF
      	also to OMP_SIMD.  Copy OMP_CLAUSE_LASTPRIVATE_CONDITIONAL.
      	(c_omp_predetermined_sharing): Don't return
      	OMP_CLAUSE_DEFAULT_SHARED for const qualified decls.
      	* c-pragma.c (omp_pragmas): Add PRAGMA_OMP_DEPOBJ and
      	PRAGMA_OMP_REQUIRES.
      	* c-pragma.h (enum pragma_kind): Likewise.
      	(enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_NONTEMPORAL
      	and PRAGMA_OMP_CLAUSE_{IN,TASK}_REDUCTION.
      gcc/c/
      	* c-parser.c: Include memmode.h.
      	(c_parser_omp_depobj, c_parser_omp_requires): New functions.
      	(c_parser_pragma): Handle PRAGMA_OMP_DEPOBJ and PRAGMA_OMP_REQUIRES.
      	(c_parser_omp_clause_name): Handle nontemporal, in_reduction and
      	task_reduction clauses.
      	(c_parser_omp_variable_list): Handle OMP_CLAUSE_{IN,TASK}_REDUCTION.
      	For OMP_CLAUSE_DEPEND, parse clause operands as either an array
      	section, or lvalue assignment expression.
      	(c_parser_omp_clause_if): Handle cancel and simd modifiers.
      	(c_parser_omp_clause_lastprivate): Parse optional
      	conditional: modifier.
      	(c_parser_omp_clause_hint): Require constant integer expression rather
      	than just integer expression.
      	(c_parser_omp_clause_defaultmap): Parse new kinds of defaultmap
      	clause.
      	(c_parser_omp_clause_reduction): Add IS_OMP and KIND arguments.
      	Parse reduction modifiers.  Pass KIND to c_parser_omp_variable_list.
      	(c_parser_omp_clause_nontemporal, c_parser_omp_iterators): New
      	functions.
      	(c_parser_omp_clause_depend): Parse iterator modifier and handle
      	iterators.  Parse mutexinoutset and depobj kinds.
      	(c_parser_oacc_all_clauses): Adjust c_parser_omp_clause_reduction
      	callers.
      	(c_parser_omp_all_clauses): Likewise.  Handle
      	PRAGMA_OMP_CLAUSE_NONTEMPORAL and
      	PRAGMA_OMP_CLAUSE_{IN,TASK}_REDUCTION.
      	(c_parser_omp_atomic): Parse hint and memory order clauses.  Handle
      	default memory order from requires directive if any.  Adjust
      	c_finish_omp_atomic caller.
      	(c_parser_omp_critical): Allow comma in between (name) and hint clause.
      	(c_parser_omp_flush): Parse flush with memory-order-clause.
      	(c_parser_omp_for_loop): Allow NE_EXPR even in
      	OpenMP loops, adjust c_finish_omp_for caller.
      	(OMP_SIMD_CLAUSE_MASK): Add if and nontemporal clauses.
      	(c_parser_omp_master): Add p_name, mask and cclauses arguments.
      	Allow to be called while parsing combined parallel master.
      	Parse combined master taskloop{, simd}.
      	(c_parser_omp_parallel): Parse combined
      	parallel master{, taskloop{, simd}} constructs.
      	(OMP_TASK_CLAUSE_MASK): Add in_reduction clause.
      	(OMP_TASKGROUP_CLAUSE_MASK): Define.
      	(c_parser_omp_taskgroup): Add LOC argument.  Parse taskgroup clauses.
      	(OMP_TASKWAIT_CLAUSE_MASK): Define.
      	(c_parser_omp_taskwait): Handle taskwait with depend clauses.
      	(c_parser_omp_teams): Force a BIND_EXPR with BLOCK
      	around teams body.  Use SET_EXPR_LOCATION.
      	(c_parser_omp_target_data): Allow target data
      	with only use_device_ptr clauses.
      	(c_parser_omp_target): Use SET_EXPR_LOCATION.  Set
      	OMP_REQUIRES_TARGET_USED bit in omp_requires_mask.
      	(c_parser_omp_requires): New function.
      	(c_finish_taskloop_clauses): New function.
      	(OMP_TASKLOOP_CLAUSE_MASK): Add reduction and in_reduction clauses.
      	(c_parser_omp_taskloop): Use c_finish_taskloop_clauses.  Add forward
      	declaration.  Disallow in_reduction clause when combined with parallel
      	master.
      	(c_parser_omp_construct): Adjust c_parser_omp_master and
      	c_parser_omp_taskgroup callers.
      	* c-typeck.c (c_finish_omp_cancel): Diagnose if clause with modifier
      	other than cancel.
      	(handle_omp_array_sections_1): Handle OMP_CLAUSE_{IN,TASK}_REDUCTION
      	like OMP_CLAUSE_REDUCTION.
      	(handle_omp_array_sections): Likewise.  Call save_expr on array
      	reductions before calling build_index_type.  Handle depend clauses
      	with iterators.
      	(struct c_find_omp_var_s): New type.
      	(c_find_omp_var_r, c_omp_finish_iterators): New functions.
      	(c_finish_omp_clauses): Don't diagnose nonmonotonic clause
      	with static, runtime or auto schedule kinds.  Call save_expr for whole
      	array reduction sizes.  Diagnose reductions with zero sized elements
      	or variable length structures.  Diagnose nogroup clause used with
      	reduction clause(s).  Handle depend clause with
      	OMP_CLAUSE_DEPEND_DEPOBJ.  Diagnose bit-fields.  Require
      	omp_depend_t type for OMP_CLAUSE_DEPEND_DEPOBJ kinds and
      	some different type for other kinds.  Use build_unary_op with
      	ADDR_EXPR and build_indirect_ref instead of c_mark_addressable.
      	Handle depend clauses with iterators.  Remove no longer needed special
      	case that predetermined const qualified vars may be specified in
      	firstprivate clause.  Complain if const qualified vars are mentioned
      	in data-sharing clauses other than firstprivate or shared.  Use
      	error_at with OMP_CLAUSE_LOCATION (c) as first argument instead of
      	error.  Formatting fix.  Handle OMP_CLAUSE_NONTEMPORAL and
      	OMP_CLAUSE_{IN,TASK}_REDUCTION.  Allow any lvalue as
      	OMP_CLAUSE_DEPEND operand (besides array section), adjust diagnostics.
      gcc/cp/
      	* constexpr.c (potential_constant_expression_1): Handle OMP_DEPOBJ.
      	* cp-gimplify.c (cp_genericize_r): Handle
      	OMP_CLAUSE_{IN,TASK}_REDUCTION.
      	(cxx_omp_predetermined_sharing_1): Don't return
      	OMP_CLAUSE_DEFAULT_SHARED for const qualified decls with no mutable
      	member.  Return OMP_CLAUSE_DEFAULT_FIRSTPRIVATE for this pointer.
      	* cp-objcp-common.c (cp_common_init_ts): Handle OMP_DEPOBJ.
      	* cp-tree.def (OMP_DEPOBJ): New tree code.
      	* cp-tree.h (OMP_ATOMIC_DEPENDENT_P): Return true also for first
      	argument being OMP_CLAUSE.
      	(OMP_DEPOBJ_DEPOBJ, OMP_DEPOBJ_CLAUSES): Define.
      	(cp_convert_omp_range_for, cp_finish_omp_range_for): Declare.
      	(finish_omp_atomic): Add LOC, CLAUSES and MO arguments.  Remove
      	SEQ_CST argument.
      	(finish_omp_for_block): Declare.
      	(finish_omp_flush): Add MO argument.
      	(finish_omp_depobj): Declare.
      	* cxx-pretty-print.c (cxx_pretty_printer::statement): Handle
      	OMP_DEPOBJ.
      	* dump.c (cp_dump_tree): Likewise.
      	* lex.c (cxx_init): Likewise.
      	* parser.c: Include memmodel.h.
      	(cp_parser_for): Pass false as new is_omp argument to
      	cp_parser_range_for.
      	(cp_parser_range_for): Add IS_OMP argument, return before finalizing
      	if it is true.
      	(cp_parser_omp_clause_name): Handle nontemporal, in_reduction and
      	task_reduction clauses.
              (cp_parser_omp_var_list_no_open): Handle
      	OMP_CLAUSE_{IN,TASK}_REDUCTION.  For OMP_CLAUSE_DEPEND, parse clause
      	operands as either an array section, or lvalue assignment expression.
      	(cp_parser_omp_clause_if): Handle cancel and simd modifiers.
      	(cp_parser_omp_clause_defaultmap): Parse new kinds of defaultmap
      	clause.
      	(cp_parser_omp_clause_reduction): Add IS_OMP and KIND arguments.
      	Parse reduction modifiers.  Pass KIND to c_parser_omp_variable_list.
      	(cp_parser_omp_clause_lastprivate, cp_parser_omp_iterators): New
      	functions.
      	(cp_parser_omp_clause_depend): Parse iterator modifier and handle
      	iterators.  Parse mutexinoutset and depobj kinds.
      	(cp_parser_oacc_all_clauses): Adjust cp_parser_omp_clause_reduction
      	callers.
      	(cp_parser_omp_all_clauses): Likewise.  Handle
      	PRAGMA_OMP_CLAUSE_NONTEMPORAL and
      	PRAGMA_OMP_CLAUSE_{IN,TASK}_REDUCTION.  Call
      	cp_parser_omp_clause_lastprivate for OpenMP lastprivate clause.
      	(cp_parser_omp_atomic): Pass pragma_tok->location as
      	LOC to finish_omp_atomic.  Parse hint and memory order clauses.
      	Handle default memory order from requires directive if any.  Adjust
      	finish_omp_atomic caller.
      	(cp_parser_omp_critical): Allow comma in between (name) and hint
      	clause.
      	(cp_parser_omp_depobj): New function.
      	(cp_parser_omp_flush): Parse flush with memory-order-clause.
      	(cp_parser_omp_for_cond): Allow NE_EXPR even in OpenMP loops.
      	(cp_convert_omp_range_for, cp_finish_omp_range_for): New functions.
      	(cp_parser_omp_for_loop): Parse C++11 range for loops among omp
      	loops.  Handle OMP_CLAUSE_IN_REDUCTION like OMP_CLAUSE_REDUCTION.
      	(OMP_SIMD_CLAUSE_MASK): Add if and nontemporal clauses.
      	(cp_parser_omp_simd, cp_parser_omp_for): Call keep_next_level before
      	begin_omp_structured_block and call finish_omp_for_block on
      	finish_omp_structured_block result.
      	(cp_parser_omp_master): Add p_name, mask and cclauses arguments.
      	Allow to be called while parsing combined parallel master.
      	Parse combined master taskloop{, simd}.
      	(cp_parser_omp_parallel): Parse combined
      	parallel master{, taskloop{, simd}} constructs.
      	(cp_parser_omp_single): Use SET_EXPR_LOCATION.
      	(OMP_TASK_CLAUSE_MASK): Add in_reduction clause.
      	(OMP_TASKWAIT_CLAUSE_MASK): Define.
      	(cp_parser_omp_taskwait): Handle taskwait with depend clauses.
      	(OMP_TASKGROUP_CLAUSE_MASK): Define.
      	(cp_parser_omp_taskgroup): Parse taskgroup clauses, adjust
      	c_finish_omp_taskgroup caller.
      	(cp_parser_omp_distribute): Call keep_next_level before
      	begin_omp_structured_block and call finish_omp_for_block on
      	finish_omp_structured_block result.
      	(cp_parser_omp_teams): Force a BIND_EXPR with BLOCK around teams
      	body.
      	(cp_parser_omp_target_data): Allow target data with only
      	use_device_ptr clauses.
      	(cp_parser_omp_target): Set OMP_REQUIRES_TARGET_USED bit in
      	omp_requires_mask.
      	(cp_parser_omp_requires): New function.
      	(OMP_TASKLOOP_CLAUSE_MASK): Add reduction and in_reduction clauses.
      	(cp_parser_omp_taskloop): Add forward declaration.  Disallow
      	in_reduction clause when combined with parallel master.  Call
      	keep_next_level before begin_omp_structured_block and call
      	finish_omp_for_block on finish_omp_structured_block result.
      	(cp_parser_omp_construct): Adjust cp_parser_omp_master caller.
      	(cp_parser_pragma): Handle PRAGMA_OMP_DEPOBJ and PRAGMA_OMP_REQUIRES.
      	* pt.c (tsubst_omp_clause_decl): Add iterators_cache argument.
      	Adjust recursive calls.  Handle iterators.
      	(tsubst_omp_clauses): Handle OMP_CLAUSE_{IN,TASK}_REDUCTION and
      	OMP_CLAUSE_NONTEMPORAL.  Adjust tsubst_omp_clause_decl callers.
      	(tsubst_decomp_names):
      	(tsubst_omp_for_iterator): Change orig_declv into a reference.
      	Handle range for loops.  Move orig_declv handling after declv/initv
      	handling.
      	(tsubst_expr): Force a BIND_EXPR with BLOCK around teams body.
      	Adjust finish_omp_atomic caller.  Call keep_next_level before
      	begin_omp_structured_block.  Call cp_finish_omp_range_for for range
      	for loops and use {begin,finish}_omp_structured_block instead of
      	{push,pop}_stmt_list if there are any range for loops.  Call
      	finish_omp_for_block on finish_omp_structured_block result.
      	Handle OMP_DEPOBJ.  Handle taskwait with depend clauses.  For
      	OMP_ATOMIC call tsubst_omp_clauses on clauses if any, adjust
      	finish_omp_atomic caller.  Use OMP_ATOMIC_MEMORY_ORDER rather
      	than OMP_ATOMIC_SEQ_CST.  Handle clauses on OMP_TASKGROUP.
      	(dependent_omp_for_p): Always return true for range for loops if
      	processing_template_decl.  Return true if class type iterator
      	does not have INTEGER_CST increment.
      	* semantics.c: Include memmodel.h.
      	(handle_omp_array_sections_1): Handle OMP_CLAUSE_{IN,TASK}_REDUCTION
      	like OMP_CLAUSE_REDUCTION.
      	(handle_omp_array_sections): Likewise.  Call save_expr on array
      	reductions before calling build_index_type.  Handle depend clauses
      	with iterators.
      	(finish_omp_reduction_clause): Call save_expr for whole array
      	reduction sizes.  Don't mark OMP_CLAUSE_DECL addressable if it has
      	reference type.  Do mark decl_placeholder addressable if needed.
      	Use error_at with OMP_CLAUSE_LOCATION (c) as first argument instead
      	of error.
      	(cp_omp_finish_iterators): New function.
      	(finish_omp_clauses): Don't diagnose nonmonotonic clause with static,
      	runtime or auto schedule kinds.  Diagnose nogroup clause used with
      	reduction clause(s).  Handle depend clause with
      	OMP_CLAUSE_DEPEND_DEPOBJ.  Diagnose bit-fields.  Require
      	omp_depend_t type for OMP_CLAUSE_DEPEND_DEPOBJ kinds and
      	some different type for other kinds.  Use cp_build_addr_expr
      	and cp_build_indirect_ref instead of cxx_mark_addressable.
      	Handle depend clauses with iterators.  Only handle static data members
      	in the special case that const qualified vars may be specified in
      	firstprivate clause.  Complain if const qualified vars without mutable
      	members are mentioned in data-sharing clauses other than firstprivate
      	or shared.  Use error_at with OMP_CLAUSE_LOCATION (c) as first
      	argument instead of error.  Diagnose more than one nontemporal clause
      	refering to the same variable.  Use error_at rather than error for
      	priority and hint clause diagnostics.  Fix pasto for hint clause.
      	Diagnose hint expression that doesn't fold into INTEGER_CST.
      	Diagnose if clause with modifier other than cancel.  Handle
      	OMP_CLAUSE_{IN,TASK}_REDUCTION like OMP_CLAUSE_REDUCTION.  Allow any
      	lvalue as OMP_CLAUSE_DEPEND operand (besides array section), adjust
      	diagnostics.
      	(handle_omp_for_class_iterator): Don't create a new TREE_LIST if one
      	has been created already for range for, just fill TREE_PURPOSE and
      	TREE_VALUE.  Call cp_fully_fold on incr.
      	(finish_omp_for): Don't check cond/incr if cond is global_namespace.
      	Pass to c_omp_check_loop_iv_exprs orig_declv if non-NULL.  Don't
      	use IS_EMPTY_STMT on NULL pre_body.  Adjust c_finish_omp_for caller.
      	(finish_omp_for_block): New function.
      	(finish_omp_atomic): Add LOC argument, pass it through
      	to c_finish_omp_atomic and set it as location of OMP_ATOMIC* trees.
      	Remove SEQ_CST argument.  Add CLAUSES and MO arguments.  Adjust
      	c_finish_omp_atomic caller.  Stick clauses if any into first argument
      	of wrapping OMP_ATOMIC.
      	(finish_omp_depobj): New function.
      	(finish_omp_flush): Add MO argument, if not
      	MEMMODEL_LAST, emit __atomic_thread_fence call with the given value.
      	(finish_omp_cancel): Diagnose if clause with modifier other than
      	cancel.
      gcc/fortran/
      	* trans-openmp.c (gfc_trans_omp_clauses): Use
      	OMP_CLAUSE_DEFAULTMAP_SET_KIND.
      	(gfc_trans_omp_atomic): Set OMP_ATOMIC_MEMORY_ORDER
      	rather than OMP_ATOMIC_SEQ_CST.
      	(gfc_trans_omp_taskgroup): Build OMP_TASKGROUP using
      	make_node instead of build1_loc.
      	* types.def (BT_FN_VOID_BOOL, BT_FN_VOID_SIZE_SIZE_PTR,
      	BT_FN_UINT_UINT_PTR_PTR, BT_FN_UINT_OMPFN_PTR_UINT_UINT,
      	BT_FN_BOOL_UINT_LONGPTR_LONG_LONG_LONGPTR_LONGPTR_PTR_PTR,
      	BT_FN_BOOL_UINT_ULLPTR_LONG_ULL_ULLPTR_ULLPTR_PTR_PTR,
      	BT_FN_BOOL_LONG_LONG_LONG_LONG_LONG_LONGPTR_LONGPTR_PTR_PTR,
      	BT_FN_BOOL_BOOL_ULL_ULL_ULL_LONG_ULL_ULLPTR_ULLPTR_PTR_PTR): New.
      	(BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR_PTR): Formatting fix.
      gcc/testsuite/
      	* c-c++-common/gomp/atomic-17.c: New test.
      	* c-c++-common/gomp/atomic-18.c: New test.
      	* c-c++-common/gomp/atomic-19.c: New test.
      	* c-c++-common/gomp/atomic-20.c: New test.
      	* c-c++-common/gomp/atomic-21.c: New test.
      	* c-c++-common/gomp/atomic-22.c: New test.
      	* c-c++-common/gomp/clauses-1.c (r2): New variable.
      	(foo): Add ntm argument and test if and nontemporal clauses on
      	constructs with simd.
      	(bar): Put taskloop simd inside of taskgroup with task_reduction,
      	use in_reduction clause instead of reduction.  Add another
      	taskloop simd without nogroup clause, but with reduction clause and
      	a new in_reduction.  Add ntm and i3 arguments.  Test if and
      	nontemporal clauses on constructs with simd.  Change if clauses on
      	some constructs from specific to the particular constituents to one
      	without a modifier.  Add new tests for combined host teams and for
      	new parallel master and {,parallel }master taskloop{, simd} combined
      	constructs.
      	(baz): New function with host teams tests.
      	* gcc.dg/gomp/combined-1.c: Moved to ...
      	* c-c++-common/gomp/combined-1.c: ... here.  Adjust expected library
      	call.
      	* c-c++-common/gomp/combined-2.c: New test.
      	* c-c++-common/gomp/combined-3.c: New test.
      	* c-c++-common/gomp/critical-1.c: New test.
      	* c-c++-common/gomp/critical-2.c: New test.
      	* c-c++-common/gomp/default-1.c: New test.
      	* c-c++-common/gomp/defaultmap-1.c: New test.
      	* c-c++-common/gomp/defaultmap-2.c: New test.
      	* c-c++-common/gomp/defaultmap-3.c: New test.
      	* c-c++-common/gomp/depend-5.c: New test.
      	* c-c++-common/gomp/depend-6.c: New test.
      	* c-c++-common/gomp/depend-iterator-1.c: New test.
      	* c-c++-common/gomp/depend-iterator-2.c: New test.
      	* c-c++-common/gomp/depobj-1.c: New test.
      	* c-c++-common/gomp/flush-1.c: New test.
      	* c-c++-common/gomp/flush-2.c: New test.
      	* c-c++-common/gomp/for-1.c: New test.
      	* c-c++-common/gomp/for-2.c: New test.
      	* c-c++-common/gomp/for-3.c: New test.
      	* c-c++-common/gomp/for-4.c: New test.
      	* c-c++-common/gomp/for-5.c: New test.
      	* c-c++-common/gomp/for-6.c: New test.
      	* c-c++-common/gomp/for-7.c: New test.
      	* c-c++-common/gomp/if-1.c (foo): Add some further tests.
      	* c-c++-common/gomp/if-2.c (foo): Likewise.  Expect slightly different
      	diagnostics wording in one case.
      	* c-c++-common/gomp/if-3.c: New test.
      	* c-c++-common/gomp/master-combined-1.c: New test.
      	* c-c++-common/gomp/master-combined-2.c: New test.
      	* c-c++-common/gomp/nontemporal-1.c: New test.
      	* c-c++-common/gomp/nontemporal-2.c: New test.
      	* c-c++-common/gomp/reduction-task-1.c: New test.
      	* c-c++-common/gomp/reduction-task-2.c: New test.
      	* c-c++-common/gomp/requires-1.c: New test.
      	* c-c++-common/gomp/requires-2.c: New test.
      	* c-c++-common/gomp/requires-3.c: New test.
      	* c-c++-common/gomp/requires-4.c: New test.
      	* c-c++-common/gomp/schedule-modifiers-1.c (bar): Don't expect
      	diagnostics for nonmonotonic modifier with static, runtime or auto
      	schedule kinds.
      	* c-c++-common/gomp/simd7.c: New test.
      	* c-c++-common/gomp/target-data-1.c: New test.
      	* c-c++-common/gomp/taskloop-reduction-1.c: New test.
      	* c-c++-common/gomp/taskwait-depend-1.c: New test.
      	* c-c++-common/gomp/teams-1.c: New test.
      	* c-c++-common/gomp/teams-2.c: New test.
      	* gcc.dg/gomp/appendix-a/a.24.1.c: Update from OpenMP examples.  Add
      	shared(c) clause.
      	* gcc.dg/gomp/atomic-5.c (f1): Add another expected error.
      	* gcc.dg/gomp/clause-1.c: Adjust expected diagnostics for const
      	qualified vars without mutable member no longer being predeterined
      	shared.
      	* gcc.dg/gomp/sharing-1.c: Likewise.
      	* g++.dg/gomp/clause-3.C: Likewise.
      	* g++.dg/gomp/member-2.C: Likewise.
      	* g++.dg/gomp/predetermined-1.C: Likewise.
      	* g++.dg/gomp/private-1.C: Likewise.
      	* g++.dg/gomp/sharing-1.C: Likewise.
      	* g++.dg/gomp/sharing-2.C: Likewise.  Add a few tests with aggregate
      	const static data member without mutable elements.
      	* gcc.dg/gomp/for-4.c: Expected nonmonotonic functions in the dumps.
      	* gcc.dg/gomp/for-5.c: Likewise.
      	* gcc.dg/gomp/for-6.c: Change expected library call.
      	* gcc.dg/gomp/pr39495-2.c (foo): Don't expect errors on !=.
      	* gcc.dg/gomp/reduction-2.c: New test.
      	* gcc.dg/gomp/simd-1.c: New test.
      	* gcc.dg/gomp/teams-1.c: Adjust expected diagnostic lines.
      	* g++.dg/gomp/atomic-18.C: New test.
      	* g++.dg/gomp/atomic-19.C: New test.
      	* g++.dg/gomp/atomic-5.C (f1): Adjust expected lines of read-only
      	variable messages.  Add another expected error.
      	* g++.dg/gomp/critical-3.C: New test.
      	* g++.dg/gomp/depend-iterator-1.C: New test.
      	* g++.dg/gomp/depend-iterator-2.C: New test.
      	* g++.dg/gomp/depobj-1.C: New test.
      	* g++.dg/gomp/doacross-1.C: New test.
      	* g++.dg/gomp/for-21.C: New test.
      	* g++.dg/gomp/for-4.C: Expected nonmonotonic functions in the dumps.
      	* g++.dg/gomp/for-5.C: Likewise.
      	* g++.dg/gomp/for-6.C: Change expected library call.
      	* g++.dg/gomp/loop-4.C: New test.
      	* g++.dg/gomp/pr33372-1.C: Adjust location of the expected
      	diagnostics.
      	* g++.dg/gomp/pr33372-3.C: Likewise.
      	* g++.dg/gomp/pr39495-2.C (foo): Don't expect errors on !=.
      	* g++.dg/gomp/simd-2.C: New test.
      	* g++.dg/gomp/tpl-atomic-2.C: Adjust expected diagnostic lines.
      include/
      	* gomp-constants.h (GOMP_TASK_FLAG_REDUCTION,
      	GOMP_DEPEND_IN, GOMP_DEPEND_OUT, GOMP_DEPEND_INOUT,
      	GOMP_DEPEND_MUTEXINOUTSET): Define.
      libgomp/
      	* affinity.c (gomp_display_affinity_place): New function.
      	* affinity-fmt.c: New file.
      	* alloc.c (gomp_aligned_alloc, gomp_aligned_free): New functions.
      	* config/linux/affinity.c (gomp_display_affinity_place): New function.
      	* config/nvptx/icv-device.c (omp_get_num_teams, omp_get_team_num):
      	Move these functions to ...
      	* config/nvptx/teams.c: ... here.  New file.
      	* config/nvptx/target.c (omp_pause_resource, omp_pause_resource_all):
      	New functions.
      	* config/nvptx/team.c (gomp_team_start, gomp_pause_host): New
      	functions.
      	* configure.ac: Check for aligned_alloc, posix_memalign, memalign
      	and _aligned_malloc.
      	(HAVE_UNAME, HAVE_GETHOSTNAME, HAVE_GETPID): Add new tests.
      	* configure.tgt: Add -DUSING_INITIAL_EXEC_TLS to XCFLAGS for Linux.
      	* env.c (gomp_display_affinity_var, gomp_affinity_format_var,
      	gomp_affinity_format_len): New variables.
      	(parse_schedule): Parse monotonic and nonmonotonic modifiers in
      	OMP_SCHEDULE variable.  Set GFS_MONOTONIC for monotonic schedules.
      	(handle_omp_display_env): Display monotonic/nonmonotonic schedule
      	modifiers.  Display (non-default) chunk sizes.  Print
      	OMP_DISPLAY_AFFINITY and OMP_AFFINITY_FORMAT.
      	(initialize_env): Don't call pthread_attr_setdetachstate.  Handle
      	OMP_DISPLAY_AFFINITY and OMP_AFFINITY_FORMAT env vars.
      	* fortran.c: Include stdio.h and string.h.
      	(omp_pause_resource, omp_pause_resource_all): Add ialias_redirect.
      	(omp_get_schedule_, omp_get_schedule_8_): Mask off GFS_MONOTONIC bit.
      	(omp_set_affinity_format_, omp_get_affinity_format_,
      	omp_display_affinity_, omp_capture_affinity_, omp_pause_resource_,
      	omp_pause_resource_all_): New functions.
      	* icv.c (omp_set_schedule): Mask off omp_sched_monotonic bit in
      	switch.
      	* icv-device.c (omp_get_num_teams, omp_get_team_num): Move these
      	functions to ...
      	* teams.c: ... here.  New file.
      	* libgomp_g.h: Include gstdint.h.
      	(GOMP_loop_nonmonotonic_runtime_start,
      	GOMP_loop_maybe_nonmonotonic_runtime_start, GOMP_loop_start,
      	GOMP_loop_ordered_start, GOMP_loop_nonmonotonic_runtime_next,
      	GOMP_loop_maybe_nonmonotonic_runtime_next, GOMP_loop_doacross_start,
      	GOMP_parallel_loop_nonmonotonic_runtime,
      	GOMP_parallel_loop_maybe_nonmonotonic_runtime,
      	GOMP_loop_ull_nonmonotonic_runtime_start,
      	GOMP_loop_ull_maybe_nonmonotonic_runtime_start, GOMP_loop_ull_start,
      	GOMP_loop_ull_ordered_start, GOMP_loop_ull_nonmonotonic_runtime_next,
      	GOMP_loop_ull_maybe_nonmonotonic_runtime_next,
      	GOMP_loop_ull_doacross_start, GOMP_parallel_reductions,
      	GOMP_taskwait_depend, GOMP_taskgroup_reduction_register,
      	GOMP_taskgroup_reduction_unregister, GOMP_task_reduction_remap,
      	GOMP_workshare_task_reduction_unregister, GOMP_sections2_start,
      	GOMP_teams_reg): Declare.
      	* libgomp.h (GOMP_HAVE_EFFICIENT_ALIGNED_ALLOC): Define unless
      	gomp_aligned_alloc uses fallback implementation.
      	(gomp_aligned_alloc, gomp_aligned_free): Declare.
      	(enum gomp_schedule_type): Add GFS_MONOTONIC.
      	(struct gomp_doacross_work_share): Add extra field.
      	(struct gomp_work_share): Add task_reductions field.
      	(struct gomp_taskgroup): Add workshare and reductions fields.
      	(GOMP_NEEDS_THREAD_HANDLE): Define if needed.
      	(gomp_thread_handle): New typedef.
      	(gomp_display_affinity_place, gomp_set_affinity_format,
      	gomp_display_string, gomp_display_affinity,
      	gomp_display_affinity_thread): Declare.
      	(gomp_doacross_init, gomp_doacross_ull_init): Add size_t argument.
      	(gomp_parallel_reduction_register, gomp_workshare_taskgroup_start,
      	gomp_workshare_task_reduction_register): Declare.
      	(gomp_team_start): Add taskgroup argument.
      	(gomp_pause_host): Declare.
      	(gomp_init_work_share, gomp_work_share_start): Change bool argument
      	to size_t.
      	(gomp_thread_self, gomp_thread_to_pthread_t): New inline functions.
      	* libgomp.map (GOMP_5.0): Export GOMP_loop_start,
      	GOMP_loop_ordered_start, GOMP_loop_doacross_start,
      	GOMP_loop_ull_start, GOMP_loop_ull_ordered_start,
      	GOMP_loop_ull_doacross_start,
      	GOMP_workshare_task_reduction_unregister, GOMP_sections2_start,
      	GOMP_loop_maybe_nonmonotonic_runtime_next,
      	GOMP_loop_maybe_nonmonotonic_runtime_start,
      	GOMP_loop_nonmonotonic_runtime_next,
      	GOMP_loop_nonmonotonic_runtime_start,
      	GOMP_loop_ull_maybe_nonmonotonic_runtime_next,
      	GOMP_loop_ull_maybe_nonmonotonic_runtime_start,
      	GOMP_loop_ull_nonmonotonic_runtime_next,
      	GOMP_loop_ull_nonmonotonic_runtime_start,
      	GOMP_parallel_loop_maybe_nonmonotonic_runtime,
      	GOMP_parallel_loop_nonmonotonic_runtime, GOMP_parallel_reductions,
      	GOMP_taskgroup_reduction_register,
      	GOMP_taskgroup_reduction_unregister, GOMP_task_reduction_remap,
      	GOMP_teams_reg and GOMP_taskwait_depend.
      	(OMP_5.0): Export omp_pause_resource{,_all}{,_},
      	omp_{capture,display}_affinity{,_}, and
      	omp_[gs]et_affinity_format{,_}.
      	* loop.c: Include string.h.
      	(GOMP_loop_runtime_next): Add ialias.
      	(GOMP_taskgroup_reduction_register): Add ialias_redirect.
      	(gomp_loop_static_start, gomp_loop_dynamic_start,
      	gomp_loop_guided_start, gomp_loop_ordered_static_start,
      	gomp_loop_ordered_dynamic_start, gomp_loop_ordered_guided_start,
      	gomp_loop_doacross_static_start, gomp_loop_doacross_dynamic_start,
      	gomp_loop_doacross_guided_start): Adjust gomp_work_share_start
      	or gomp_doacross_init callers.
      	(gomp_adjust_sched, GOMP_loop_start, GOMP_loop_ordered_start,
      	GOMP_loop_doacross_start): New functions.
      	(GOMP_loop_runtime_start, GOMP_loop_ordered_runtime_start,
      	GOMP_loop_doacross_runtime_start, GOMP_parallel_loop_runtime_start):
      	Mask off GFS_MONOTONIC bit.
      	(GOMP_loop_maybe_nonmonotonic_runtime_next,
      	GOMP_loop_maybe_nonmonotonic_runtime_start,
      	GOMP_loop_nonmonotonic_runtime_next,
      	GOMP_loop_nonmonotonic_runtime_start,
      	GOMP_parallel_loop_maybe_nonmonotonic_runtime,
      	GOMP_parallel_loop_nonmonotonic_runtime): New aliases or wrapper
      	functions.
      	(gomp_parallel_loop_start): Pass NULL as taskgroup to
      	gomp_team_start.
      	* loop_ull.c: Include string.h.
      	(GOMP_loop_ull_runtime_next): Add ialias.
      	(GOMP_taskgroup_reduction_register): Add ialias_redirect.
      	(gomp_loop_ull_static_start, gomp_loop_ull_dynamic_start,
      	gomp_loop_ull_guided_start, gomp_loop_ull_ordered_static_start,
      	gomp_loop_ull_ordered_dynamic_start,
      	gomp_loop_ull_ordered_guided_start,
      	gomp_loop_ull_doacross_static_start,
      	gomp_loop_ull_doacross_dynamic_start,
      	gomp_loop_ull_doacross_guided_start): Adjust gomp_work_share_start
      	and gomp_doacross_ull_init callers.
      	(gomp_adjust_sched, GOMP_loop_ull_start, GOMP_loop_ull_ordered_start,
      	GOMP_loop_ull_doacross_start): New functions.
      	(GOMP_loop_ull_runtime_start,
      	GOMP_loop_ull_ordered_runtime_start,
      	GOMP_loop_ull_doacross_runtime_start): Mask off GFS_MONOTONIC bit.
      	(GOMP_loop_ull_maybe_nonmonotonic_runtime_next,
      	GOMP_loop_ull_maybe_nonmonotonic_runtime_start,
      	GOMP_loop_ull_nonmonotonic_runtime_next,
      	GOMP_loop_ull_nonmonotonic_runtime_start): Likewise.
      	* Makefile.am (libgomp_la_SOURCES): Add teams.c and affinity-fmt.c.
      	* omp.h.in (enum omp_sched_t): Add omp_sched_monotonic.
      	(omp_pause_resource_t, omp_depend_t): New typedefs.
      	(enum omp_lock_hint_t): Renamed to ...
      	(enum omp_sync_hint_t): ... this.  Define omp_sync_hint_*
      	enumerators using numbers and omp_lock_hint_* as their aliases.
      	(omp_lock_hint_t): New typedef.  Rename to ...
      	(omp_sync_hint_t): ... this.
      	(omp_init_lock_with_hint, omp_init_nest_lock_with_hint): Use
      	omp_sync_hint_t instead of omp_lock_hint_t.
      	(omp_pause_resource, omp_pause_resource_all, omp_set_affinity_format,
      	omp_get_affinity_format, omp_display_affinity, omp_capture_affinity):
      	Declare.
      	(omp_target_is_present, omp_target_disassociate_ptr):
      	Change first argument from void * to const void *.
      	(omp_target_memcpy, omp_target_memcpy_rect): Change second argument
      	from void * to const void *.
      	(omp_target_associate_ptr): Change first and second arguments from
      	void * to const void *.
      	* omp_lib.f90.in (omp_pause_resource_kind, omp_pause_soft,
      	omp_pause_hard): New parameters.
      	(omp_pause_resource, omp_pause_resource_all, omp_set_affinity_format,
      	omp_get_affinity_format, omp_display_affinity, omp_capture_affinity):
      	New interfaces.
      	* omp_lib.h.in (omp_pause_resource_kind, omp_pause_soft,
      	omp_pause_hard): New parameters.
      	(omp_pause_resource, omp_pause_resource_all, omp_set_affinity_format,
      	omp_get_affinity_format, omp_display_affinity, omp_capture_affinity):
      	New externals.
      	* ordered.c (gomp_doacross_init, gomp_doacross_ull_init): Add
      	EXTRA argument.  If not needed to prepare array, if extra is 0,
      	clear ws->doacross, otherwise allocate just doacross structure and
      	extra payload.  If array is needed, allocate also extra payload.
      	(GOMP_doacross_post, GOMP_doacross_wait, GOMP_doacross_ull_post,
      	GOMP_doacross_ull_wait): Handle doacross->array == NULL like
      	doacross == NULL.
      	* parallel.c (GOMP_parallel_start): Pass NULL as taskgroup to
      	gomp_team_start.
      	(GOMP_parallel): Likewise.  Formatting fix.
      	(GOMP_parallel_reductions): New function.
      	(GOMP_cancellation_point): If taskgroup has workshare
      	flag set, check cancelled of prev taskgroup if any.
      	(GOMP_cancel): If taskgroup has workshare flag set, set cancelled
      	on prev taskgroup if any.
      	* sections.c: Include string.h.
      	(GOMP_taskgroup_reduction_register): Add ialias_redirect.
      	(GOMP_sections_start): Adjust gomp_work_share_start caller.
      	(GOMP_sections2_start): New function.
      	(GOMP_parallel_sections_start, GOMP_parallel_sections):
      	Pass NULL as taskgroup to gomp_team_start.
      	* single.c (GOMP_single_start, GOMP_single_copy_start): Adjust
      	gomp_work_share_start callers.
      	* target.c (GOMP_target_update_ext, GOMP_target_enter_exit_data):
      	If taskgroup has workshare flag set, check cancelled on prev
      	taskgroup if any.  Guard all cancellation tests with
      	gomp_cancel_var test.
      	(omp_target_is_present, omp_target_disassociate_ptr):
      	Change ptr argument from void * to const void *.
      	(omp_target_memcpy): Change src argument from void * to const void *.
      	(omp_target_memcpy_rect): Likewise.
      	(omp_target_memcpy_rect_worker): Likewise.  Use const char * casts
      	instead of char * where needed.
      	(omp_target_associate_ptr): Change host_ptr and device_ptr arguments
      	from void * to const void *.
      	(omp_pause_resource, omp_pause_resource_all): New functions.
      	* task.c (gomp_task_handle_depend): Handle new depend array format
      	in addition to the old.  Handle mutexinoutset kinds the same as
      	inout for now, handle unspecified kinds.
      	(gomp_create_target_task): If taskgroup has workshare flag set, check
      	cancelled on prev taskgroup if any.  Guard all cancellation tests with
      	gomp_cancel_var test.  Handle new depend array format count in
      	addition to the old.
      	(GOMP_task): Likewise.  Adjust function comment.
      	(gomp_task_run_pre): If taskgroup has workshare flag set, check
      	cancelled on prev taskgroup if any.  Guard all cancellation tests with
      	gomp_cancel_var test.
      	(GOMP_taskwait_depend): New function.
      	(gomp_task_maybe_wait_for_dependencies): Handle new depend array
      	format in addition to the old.  Handle mutexinoutset kinds the same as
      	inout for now, handle unspecified kinds.  Fix a function comment typo.
      	(gomp_taskgroup_init): New function.
      	(GOMP_taskgroup_start): Use it.
      	(gomp_reduction_register, gomp_create_artificial_team,
      	GOMP_taskgroup_reduction_register,
      	GOMP_taskgroup_reduction_unregister, GOMP_task_reduction_remap,
      	gomp_parallel_reduction_register,
      	gomp_workshare_task_reduction_register,
      	gomp_workshare_taskgroup_start,
      	GOMP_workshare_task_reduction_unregister): New functions.
      	* taskloop.c (GOMP_taskloop): If taskgroup has workshare flag set,
      	check cancelled on prev taskgroup if any.  Guard all cancellation
      	tests with gomp_cancel_var test.  Handle GOMP_TASK_FLAG_REDUCTION flag
      	by calling GOMP_taskgroup_reduction_register.
      	* team.c (gomp_thread_attr): Remove comment.
      	(struct gomp_thread_start_data): Add handle field.
      	(gomp_thread_start): Call pthread_detach.
      	(gomp_new_team): Adjust gomp_init_work_share caller.
      	(gomp_free_pool_helper): Call pthread_detach.
      	(gomp_team_start): Add taskgroup argument, initialize implicit
      	tasks' taskgroup field to that.  Don't call
      	pthread_attr_setdetachstate.  Handle OMP_DISPLAY_AFFINITY env var.
      	(gomp_team_end): Determine nesting by thr->ts.level != 0
      	rather than thr->ts.team != NULL.
      	(gomp_pause_pool_helper, gomp_pause_host): New functions.
      	* work.c (alloc_work_share): Use gomp_aligned_alloc instead of
      	gomp_malloc if GOMP_HAVE_EFFICIENT_ALIGNED_ALLOC is defined.
      	(gomp_init_work_share): Change ORDERED argument from bool to size_t,
      	if more than 1 allocate also extra payload at the end of array.  Never
      	keep ordered_team_ids NULL, set it to inline_ordered_team_ids instead.
      	(gomp_work_share_start): Change ORDERED argument from bool to size_t,
      	return true instead of ws.
      	* Makefile.in: Regenerated.
      	* configure: Regenerated.
      	* config.h.in: Regenerated.
      	* testsuite/libgomp.c/cancel-for-2.c (foo): Use cancel modifier
      	in some cases.
      	* testsuite/libgomp.c-c++-common/cancel-parallel-1.c: New test.
      	* testsuite/libgomp.c-c++-common/cancel-taskgroup-3.c: New test.
      	* testsuite/libgomp.c-c++-common/depend-iterator-1.c: New test.
      	* testsuite/libgomp.c-c++-common/depend-iterator-2.c: New test.
      	* testsuite/libgomp.c-c++-common/depend-mutexinout-1.c: New test.
      	* testsuite/libgomp.c-c++-common/depend-mutexinout-2.c: New test.
      	* testsuite/libgomp.c-c++-common/depobj-1.c: New test.
      	* testsuite/libgomp.c-c++-common/display-affinity-1.c: New test.
      	* testsuite/libgomp.c-c++-common/for-10.c: New test.
      	* testsuite/libgomp.c-c++-common/for-11.c: New test.
      	* testsuite/libgomp.c-c++-common/for-12.c: New test.
      	* testsuite/libgomp.c-c++-common/for-13.c: New test.
      	* testsuite/libgomp.c-c++-common/for-14.c: New test.
      	* testsuite/libgomp.c-c++-common/for-15.c: New test.
      	* testsuite/libgomp.c-c++-common/for-2.h: If CONDNE macro is defined,
      	define a different N(test), don't define N(f0) to N(f14), but instead
      	define N(f20) to N(f34) using != comparisons.
      	* testsuite/libgomp.c-c++-common/for-7.c: New test.
      	* testsuite/libgomp.c-c++-common/for-8.c: New test.
      	* testsuite/libgomp.c-c++-common/for-9.c: New test.
      	* testsuite/libgomp.c-c++-common/master-combined-1.c: New test.
      	* testsuite/libgomp.c-c++-common/pause-1.c: New test.
      	* testsuite/libgomp.c-c++-common/pause-2.c: New test.
      	* testsuite/libgomp.c-c++-common/pr66199-10.c: New test.
      	* testsuite/libgomp.c-c++-common/pr66199-11.c: New test.
      	* testsuite/libgomp.c-c++-common/pr66199-12.c: New test.
      	* testsuite/libgomp.c-c++-common/pr66199-13.c: New test.
      	* testsuite/libgomp.c-c++-common/pr66199-14.c: New test.
      	* testsuite/libgomp.c-c++-common/simd-1.c: New test.
      	* testsuite/libgomp.c-c++-common/taskloop-reduction-1.c: New test.
      	* testsuite/libgomp.c-c++-common/taskloop-reduction-2.c: New test.
      	* testsuite/libgomp.c-c++-common/taskloop-reduction-3.c: New test.
      	* testsuite/libgomp.c-c++-common/taskloop-reduction-4.c: New test.
      	* testsuite/libgomp.c-c++-common/task-reduction-11.c: New test.
      	* testsuite/libgomp.c-c++-common/task-reduction-12.c: New test.
      	* testsuite/libgomp.c-c++-common/task-reduction-1.c: New test.
      	* testsuite/libgomp.c-c++-common/task-reduction-2.c: New test.
      	* testsuite/libgomp.c-c++-common/task-reduction-3.c: New test.
      	* testsuite/libgomp.c-c++-common/task-reduction-4.c: New test.
      	* testsuite/libgomp.c-c++-common/task-reduction-5.c: New test.
      	* testsuite/libgomp.c-c++-common/task-reduction-6.c: New test.
      	* testsuite/libgomp.c-c++-common/task-reduction-7.c: New test.
      	* testsuite/libgomp.c-c++-common/task-reduction-8.c: New test.
      	* testsuite/libgomp.c-c++-common/task-reduction-9.c: New test.
      	* testsuite/libgomp.c-c++-common/taskwait-depend-1.c: New test.
      	* testsuite/libgomp.c++/depend-1.C: New test.
      	* testsuite/libgomp.c++/depend-iterator-1.C: New test.
      	* testsuite/libgomp.c++/depobj-1.C: New test.
      	* testsuite/libgomp.c++/for-16.C: New test.
      	* testsuite/libgomp.c++/for-21.C: New test.
      	* testsuite/libgomp.c++/for-22.C: New test.
      	* testsuite/libgomp.c++/for-23.C: New test.
      	* testsuite/libgomp.c++/for-24.C: New test.
      	* testsuite/libgomp.c++/for-25.C: New test.
      	* testsuite/libgomp.c++/for-26.C: New test.
      	* testsuite/libgomp.c++/taskloop-reduction-1.C: New test.
      	* testsuite/libgomp.c++/taskloop-reduction-2.C: New test.
      	* testsuite/libgomp.c++/taskloop-reduction-3.C: New test.
      	* testsuite/libgomp.c++/taskloop-reduction-4.C: New test.
      	* testsuite/libgomp.c++/task-reduction-10.C: New test.
      	* testsuite/libgomp.c++/task-reduction-11.C: New test.
      	* testsuite/libgomp.c++/task-reduction-12.C: New test.
      	* testsuite/libgomp.c++/task-reduction-13.C: New test.
      	* testsuite/libgomp.c++/task-reduction-14.C: New test.
      	* testsuite/libgomp.c++/task-reduction-15.C: New test.
      	* testsuite/libgomp.c++/task-reduction-16.C: New test.
      	* testsuite/libgomp.c++/task-reduction-17.C: New test.
      	* testsuite/libgomp.c++/task-reduction-18.C: New test.
      	* testsuite/libgomp.c++/task-reduction-19.C: New test.
      	* testsuite/libgomp.c/task-reduction-1.c: New test.
      	* testsuite/libgomp.c++/task-reduction-1.C: New test.
      	* testsuite/libgomp.c/task-reduction-2.c: New test.
      	* testsuite/libgomp.c++/task-reduction-2.C: New test.
      	* testsuite/libgomp.c++/task-reduction-3.C: New test.
      	* testsuite/libgomp.c++/task-reduction-4.C: New test.
      	* testsuite/libgomp.c++/task-reduction-5.C: New test.
      	* testsuite/libgomp.c++/task-reduction-6.C: New test.
      	* testsuite/libgomp.c++/task-reduction-7.C: New test.
      	* testsuite/libgomp.c++/task-reduction-8.C: New test.
      	* testsuite/libgomp.c++/task-reduction-9.C: New test.
      	* testsuite/libgomp.c/teams-1.c: New test.
      	* testsuite/libgomp.c/teams-2.c: New test.
      	* testsuite/libgomp.c/thread-limit-4.c: New test.
      	* testsuite/libgomp.c/thread-limit-5.c: New test.
      	* testsuite/libgomp.fortran/display-affinity-1.f90: New test.
      
      From-SVN: r265930
      28567c40
  23. Jan 03, 2018
  24. Jan 01, 2017
  25. Apr 12, 2016
    • Jakub Jelinek's avatar
      omp-low.c (lower_omp_target): Use GOMP_MAP_FIRSTPRIVATE_INT regardless whether... · 21f3a236
      Jakub Jelinek authored
      omp-low.c (lower_omp_target): Use GOMP_MAP_FIRSTPRIVATE_INT regardless whether there are depend clauses or not.
      
      	* omp-low.c (lower_omp_target): Use GOMP_MAP_FIRSTPRIVATE_INT
      	regardless whether there are depend clauses or not.
      
      	* libgomp.h (struct gomp_target_task): Remove firstprivate_copies
      	field.
      	* target.c (gomp_target_fallback_firstprivate,
      	gomp_target_unshare_firstprivate): Removed.
      	(GOMP_target_ext): Copy firstprivate vars into gomp_allocaed memory
      	before waiting for dependencies.
      	(gomp_target_task_fn): Don't copy firstprivate vars here.
      	* task.c (GOMP_PLUGIN_target_task_completion): Don't free
      	firstprivate_copies here.
      	(gomp_create_target_task): Don't initialize firstprivate_copies field.
      	* testsuite/libgomp.c/target-25.c (main): Use map (to:) instead of
      	explicit/implicit firstprivate.
      
      From-SVN: r234894
      21f3a236
  26. Jan 20, 2016
  27. Jan 19, 2016
    • Martin Jambor's avatar
      Merge of HSA · b2b40051
      Martin Jambor authored
      2016-01-19  Martin Jambor  <mjambor@suse.cz>
      	    Martin Liska  <mliska@suse.cz>
      	    Michael Matz <matz@suse.de>
      
      libgomp/
      	* plugin/Makefrag.am: Add HSA plugin requirements.
      	* plugin/configfrag.ac (HSA_RUNTIME_INCLUDE): New variable.
      	(HSA_RUNTIME_LIB): Likewise.
      	(HSA_RUNTIME_CPPFLAGS): Likewise.
      	(HSA_RUNTIME_INCLUDE): New substitution.
      	(HSA_RUNTIME_LIB): Likewise.
      	(HSA_RUNTIME_LDFLAGS): Likewise.
      	(hsa-runtime): New configure option.
      	(hsa-runtime-include): Likewise.
      	(hsa-runtime-lib): Likewise.
      	(PLUGIN_HSA): New substitution variable.
      	Fill HSA_RUNTIME_INCLUDE and HSA_RUNTIME_LIB according to the new
      	configure options.
      	(PLUGIN_HSA_CPPFLAGS): Likewise.
      	(PLUGIN_HSA_LDFLAGS): Likewise.
      	(PLUGIN_HSA_LIBS): Likewise.
      	Check that we have access to HSA run-time.
      	* libgomp-plugin.h (offload_target_type): New element
      	OFFLOAD_TARGET_TYPE_HSA.
      	* libgomp.h (gomp_target_task): New fields firstprivate_copies and
      	args.
      	(bool gomp_create_target_task): Updated.
      	(gomp_device_descr): Extra parameter of run_func and async_run_func,
      	new field can_run_func.
      	* libgomp_g.h (GOMP_target_ext): Update prototype.
      	* oacc-host.c (host_run): Added a new parameter args.
      	* target.c (calculate_firstprivate_requirements): New function.
      	(copy_firstprivate_data): Likewise.
      	(gomp_target_fallback_firstprivate): Use them.
      	(gomp_target_unshare_firstprivate): New function.
      	(gomp_get_target_fn_addr): Allow returning NULL for shared memory
      	devices.
      	(GOMP_target): Do host fallback for all shared memory devices.  Do not
      	pass any args to plugins.
      	(GOMP_target_ext): Introduce device-specific argument parameter args.
      	Allow host fallback if device shares memory.  Do not remap data if
      	device has shared memory.
      	(gomp_target_task_fn): Likewise.  Also treat shared memory devices
      	like host fallback for mappings.
      	(GOMP_target_data): Treat shared memory devices like host fallback.
      	(GOMP_target_data_ext): Likewise.
      	(GOMP_target_update): Likewise.
      	(GOMP_target_update_ext): Likewise.  Also pass NULL as args to
      	gomp_create_target_task.
      	(GOMP_target_enter_exit_data): Likewise.
      	(omp_target_alloc): Treat shared memory devices like host fallback.
      	(omp_target_free): Likewise.
      	(omp_target_is_present): Likewise.
      	(omp_target_memcpy): Likewise.
      	(omp_target_memcpy_rect): Likewise.
      	(omp_target_associate_ptr): Likewise.
      	(gomp_load_plugin_for_device): Also load can_run.
      	* task.c (GOMP_PLUGIN_target_task_completion): Free
      	firstprivate_copies.
      	(gomp_create_target_task): Accept new argument args and store it to
      	ttask.
      	* plugin/plugin-hsa.c: New file.
      
      gcc/
      	* Makefile.in (OBJS): Add new source files.
      	(GTFILES): Add hsa.c.
      	* common.opt (disable_hsa): New variable.
      	(-Whsa): New warning.
      	* config.in (ENABLE_HSA): New.
      	* configure.ac: Treat hsa differently from other accelerators.
      	(OFFLOAD_TARGETS): Define ENABLE_OFFLOADING according to
      	$enable_offloading.
      	(ENABLE_HSA): Define ENABLE_HSA according to $enable_hsa.
      	* doc/install.texi (Configuration): Document --with-hsa-runtime,
      	--with-hsa-runtime-include, --with-hsa-runtime-lib and
      	--with-hsa-kmt-lib.
      	* doc/invoke.texi (-Whsa): Document.
      	(hsa-gen-debug-stores): Likewise.
      	* lto-wrapper.c (compile_images_for_offload_targets): Do not attempt
      	to invoke offload compiler for hsa acclerator.
      	* opts.c (common_handle_option): Determine whether HSA offloading
      	should be performed.
      	* params.def (PARAM_HSA_GEN_DEBUG_STORES): New parameter.
      	* builtin-types.def (BT_FN_VOID_UINT_PTR_INT_PTR): New.
      	(BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR_INT_INT): Removed.
      	(BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR_PTR): New.
      	* gimple-low.c (lower_stmt): Also handle GIMPLE_OMP_GRID_BODY.
      	* gimple-pretty-print.c (dump_gimple_omp_for): Also handle
      	GF_OMP_FOR_KIND_GRID_LOOP.
      	(dump_gimple_omp_block): Also handle GIMPLE_OMP_GRID_BODY.
      	(pp_gimple_stmt_1): Likewise.
      	* gimple-walk.c (walk_gimple_stmt): Likewise.
      	* gimple.c (gimple_build_omp_grid_body): New function.
      	(gimple_copy): Also handle GIMPLE_OMP_GRID_BODY.
      	* gimple.def (GIMPLE_OMP_GRID_BODY): New.
      	* gimple.h (enum gf_mask): Added GF_OMP_PARALLEL_GRID_PHONY,
      	GF_OMP_FOR_KIND_GRID_LOOP, GF_OMP_FOR_GRID_PHONY and
      	GF_OMP_TEAMS_GRID_PHONY.
      	(gimple_statement_omp_single_layout): Updated comments.
      	(gimple_build_omp_grid_body): New function.
      	(gimple_has_substatements): Also handle GIMPLE_OMP_GRID_BODY.
      	(gimple_omp_for_grid_phony): New function.
      	(gimple_omp_for_set_grid_phony): Likewise.
      	(gimple_omp_parallel_grid_phony): Likewise.
      	(gimple_omp_parallel_set_grid_phony): Likewise.
      	(gimple_omp_teams_grid_phony): Likewise.
      	(gimple_omp_teams_set_grid_phony): Likewise.
      	(gimple_return_set_retbnd): Also handle GIMPLE_OMP_GRID_BODY.
      	* omp-builtins.def (BUILT_IN_GOMP_OFFLOAD_REGISTER): New.
      	(BUILT_IN_GOMP_OFFLOAD_UNREGISTER): Likewise.
      	(BUILT_IN_GOMP_TARGET): Updated type.
      	* omp-low.c: Include symbol-summary.h, hsa.h and params.h.
      	(adjust_for_condition): New function.
      	(get_omp_for_step_from_incr): Likewise.
      	(extract_omp_for_data): Moved parts to adjust_for_condition and
      	get_omp_for_step_from_incr.
      	(build_outer_var_ref): Handle GIMPLE_OMP_GRID_BODY.
      	(fixup_child_record_type): Bail out if receiver_decl is NULL.
      	(scan_sharing_clauses): Handle OMP_CLAUSE__GRIDDIM_.
      	(scan_omp_parallel): Do not create child functions for phony
      	constructs.
      	(check_omp_nesting_restrictions): Handle GIMPLE_OMP_GRID_BODY.
      	(scan_omp_1_op): Checking assert we are not remapping to
      	ERROR_MARK.  Also also handle GIMPLE_OMP_GRID_BODY.
      	(parallel_needs_hsa_kernel_p): New function.
      	(expand_parallel_call): Register apprpriate parallel child
      	functions as HSA kernels.
      	(grid_launch_attributes_trees): New type.
      	(grid_attr_trees): New variable.
      	(grid_create_kernel_launch_attr_types): New function.
      	(grid_insert_store_range_dim): Likewise.
      	(grid_get_kernel_launch_attributes): Likewise.
      	(get_target_argument_identifier_1): Likewise.
      	(get_target_argument_identifier): Likewise.
      	(get_target_argument_value): Likewise.
      	(push_target_argument_according_to_value): Likewise.
      	(get_target_arguments): Likewise.
      	(expand_omp_target): Call get_target_arguments instead of looking
      	up for teams and thread limit.
      	(grid_expand_omp_for_loop): New function.
      	(grid_arg_decl_map): New type.
      	(grid_remap_kernel_arg_accesses): New function.
      	(grid_expand_target_kernel_body): New function.
      	(expand_omp): Call it.
      	(lower_omp_for): Do not emit phony constructs.
      	(lower_omp_taskreg): Do not emit phony constructs but create for them
      	a temporary variable receiver_decl.
      	(lower_omp_taskreg): Do not emit phony constructs.
      	(lower_omp_teams): Likewise.
      	(lower_omp_grid_body): New function.
      	(lower_omp_1): Call it.
      	(grid_reg_assignment_to_local_var_p): New function.
      	(grid_seq_only_contains_local_assignments): Likewise.
      	(grid_find_single_omp_among_assignments_1): Likewise.
      	(grid_find_single_omp_among_assignments): Likewise.
      	(grid_find_ungridifiable_statement): Likewise.
      	(grid_target_follows_gridifiable_pattern): Likewise.
      	(grid_remap_prebody_decls): Likewise.
      	(grid_copy_leading_local_assignments): Likewise.
      	(grid_process_kernel_body_copy): Likewise.
      	(grid_attempt_target_gridification): Likewise.
      	(grid_gridify_all_targets_stmt): Likewise.
      	(grid_gridify_all_targets): Likewise.
      	(execute_lower_omp): Call grid_gridify_all_targets.
      	(make_gimple_omp_edges): Handle GIMPLE_OMP_GRID_BODY.
      	* tree-core.h (omp_clause_code): Added OMP_CLAUSE__GRIDDIM_.
      	(tree_omp_clause): Added union field dimension.
      	* tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE__GRIDDIM_.
      	* tree.c (omp_clause_num_ops): Added number of arguments of
      	OMP_CLAUSE__GRIDDIM_.
      	(omp_clause_code_name): Added name of OMP_CLAUSE__GRIDDIM_.
      	(walk_tree_1): Handle OMP_CLAUSE__GRIDDIM_.
      	* tree.h (OMP_CLAUSE_GRIDDIM_DIMENSION): New.
      	(OMP_CLAUSE_SET_GRIDDIM_DIMENSION): Likewise.
      	(OMP_CLAUSE_GRIDDIM_SIZE): Likewise.
      	(OMP_CLAUSE_GRIDDIM_GROUP): Likewise.
      	* passes.def: Schedule pass_ipa_hsa and pass_gen_hsail.
      	* tree-pass.h (make_pass_gen_hsail): Declare.
      	(make_pass_ipa_hsa): Likewise.
      	* ipa-hsa.c: New file.
      	* lto-section-in.c (lto_section_name): Add hsa section name.
      	* lto-streamer.h (lto_section_type): Add hsa section.
      	* timevar.def (TV_IPA_HSA): New.
              * hsa-brig-format.h: New file.
      	* hsa-brig.c: New file.
      	* hsa-dump.c: Likewise.
      	* hsa-gen.c: Likewise.
      	* hsa.c: Likewise.
      	* hsa.h: Likewise.
      	* toplev.c (compile_file): Call hsa_output_brig.
      	* hsa-regalloc.c: New file.
      
      gcc/fortran/
      	* types.def (BT_FN_VOID_UINT_PTR_INT_PTR): New.
      	(BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR_INT_INT): Removed.
      	(BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR_PTR): New.
      
      gcc/lto/
      	* lto-partition.c: Include "hsa.h"
      	(add_symbol_to_partition_1): Put hsa implementations into the
      	same partition as host implementations.
      
      liboffloadmic/
      	* plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_async_run): New
      	unused parameter.
      	(GOMP_OFFLOAD_run): Likewise.
      
      include/
      	* gomp-constants.h (GOMP_DEVICE_HSA): New macro.
      	(GOMP_VERSION_HSA): Likewise.
      	(GOMP_TARGET_ARG_DEVICE_MASK): Likewise.
      	(GOMP_TARGET_ARG_DEVICE_ALL): Likewise.
      	(GOMP_TARGET_ARG_SUBSEQUENT_PARAM): Likewise.
      	(GOMP_TARGET_ARG_ID_MASK): Likewise.
      	(GOMP_TARGET_ARG_NUM_TEAMS): Likewise.
      	(GOMP_TARGET_ARG_THREAD_LIMIT): Likewise.
      	(GOMP_TARGET_ARG_VALUE_SHIFT): Likewise.
      	(GOMP_TARGET_ARG_HSA_KERNEL_ATTRIBUTES): Likewise.
      
      From-SVN: r232549
      b2b40051
  28. Jan 15, 2016
  29. Jan 04, 2016
  30. Nov 27, 2015
  31. Nov 14, 2015
    • Jakub Jelinek's avatar
      omp-low.c (lower_omp_ordered): Add argument to GOMP_SMD_ORDERED_* internal calls - 0 if... · e4606348
      Jakub Jelinek authored
      gcc/
      2015-11-14  Jakub Jelinek  <jakub@redhat.com>
      
      	* omp-low.c (lower_omp_ordered): Add argument to GOMP_SMD_ORDERED_*
      	internal calls - 0 if ordered simd and 1 for ordered threads simd.
      	* tree-vectorizer.c (adjust_simduid_builtins): If GOMP_SIMD_ORDERED_*
      	argument is 1, replace it with GOMP_ordered_* call instead of removing
      	it.
      gcc/c/
      2015-11-14  Jakub Jelinek  <jakub@redhat.com>
      
      	* c-typeck.c (c_finish_omp_clauses): Don't mark
      	GOMP_MAP_FIRSTPRIVATE_POINTER decls addressable.
      gcc/cp/
      2015-11-14  Jakub Jelinek  <jakub@redhat.com>
      
      	* semantics.c (finish_omp_clauses): Don't mark
      	GOMP_MAP_FIRSTPRIVATE_POINTER decls addressable.
      libgomp/
      2015-11-14  Jakub Jelinek  <jakub@redhat.com>
      	    Aldy Hernandez  <aldyh@redhat.com>
      	    Ilya Verbin  <ilya.verbin@intel.com>
      
      	* ordered.c (gomp_doacross_init, GOMP_doacross_post,
      	GOMP_doacross_wait, gomp_doacross_ull_init, GOMP_doacross_ull_post,
      	GOMP_doacross_ull_wait): For GFS_GUIDED don't divide number of
      	iterators or IV by chunk size.
      	* parallel.c (gomp_resolve_num_threads): Don't assume that
      	if thr->ts.team is non-NULL, then pool must be non-NULL.
      	* libgomp-plugin.h (GOMP_PLUGIN_target_task_completion): Declare.
      	* libgomp.map (GOMP_PLUGIN_1.1): New symbol version, export
      	GOMP_PLUGIN_target_task_completion.
      	* Makefile.am (libgomp_la_SOURCES): Add priority_queue.c.
      	* Makefile.in: Regenerate.
      	* libgomp.h: Shuffle prototypes and forward definitions around so
      	priority queues can be defined.
      	(enum gomp_task_kind): Add GOMP_TASK_ASYNC_RUNNING.
      	(enum gomp_target_task_state): New enum.
      	(struct gomp_target_task): Add state, tgt, task and team fields.
      	(gomp_create_target_task): Change return type to bool, add
      	state argument.
      	(gomp_target_task_fn): Change return type to bool.
      	(struct gomp_device_descr): Add async_run_func.
      	(struct gomp_task): Remove children, next_child, prev_child,
      	next_queue, prev_queue, next_taskgroup, prev_taskgroup.
      	Add pnode field.
      	(struct gomp_taskgroup): Remove children.
      	Add taskgroup_queue.
      	(struct gomp_team): Change task_queue type to a priority queue.
      	(splay_compare): Define inline.
      	(priority_queue_offset): New.
      	(priority_node_to_task): New.
      	(task_to_priority_node): New.
      	* oacc-mem.c: Do not include splay-tree.h.
      	* priority_queue.c: New file.
      	* priority_queue.h: New file.
      	* splay-tree.c: Do not include splay-tree.h.
      	(splay_tree_foreach_internal): New.
      	(splay_tree_foreach): New.
      	* splay-tree.h: Become re-entrant if splay_tree_prefix is defined.
      	(splay_tree_callback): Define typedef.
      	* target.c (splay_compare): Move to libgomp.h.
      	(GOMP_target): Don't adjust *thr in any way around running offloaded
      	task.
      	(GOMP_target_ext): Likewise.  Handle target nowait.
      	(GOMP_target_update_ext, GOMP_target_enter_exit_data): Check
      	return value from gomp_create_target_task, if false, fallthrough
      	as if no dependencies exist.
      	(gomp_target_task_fn): Change return type to bool, return true
      	if the task should have another part scheduled later.  Handle
      	target nowait.
      	(gomp_load_plugin_for_device): Initialize async_run.
      	* task.c (gomp_init_task): Initialize children_queue.
      	(gomp_clear_parent_in_list): New.
      	(gomp_clear_parent_in_tree): New.
      	(gomp_clear_parent): Handle priorities.
      	(GOMP_task): Likewise.
      	(priority_queue_move_task_first,
      	gomp_target_task_completion, GOMP_PLUGIN_target_task_completion):
      	New functions.
      	(gomp_create_target_task): Use priority queues.  Change return type
      	to bool, add state argument, return false if for async
      	{{enter,exit} data,update} constructs no dependencies need to be
      	waited for, handle target nowait.  Set task->fn to NULL instead of
      	gomp_target_task_fn.
      	(verify_children_queue): Remove.
      	(priority_list_upgrade_task): New.
      	(priority_queue_upgrade_task): New.
      	(verify_task_queue): Remove.
      	(priority_list_downgrade_task): New.
      	(priority_queue_downgrade_task): New.
      	(gomp_task_run_pre): Use priority queues.
      	Abstract code out to priority_queue_downgrade_task.
      	(gomp_task_run_post_handle_dependers): Use priority queues.
      	(gomp_task_run_post_remove_parent): Likewise.
      	(gomp_task_run_post_remove_taskgroup): Likewise.
      	(gomp_barrier_handle_tasks): Likewise.  Handle target nowait target
      	tasks specially.
      	(GOMP_taskwait): Likewise.
      	(gomp_task_maybe_wait_for_dependencies): Likewise.  Abstract code to
      	priority-queue_upgrade_task.
      	(GOMP_taskgroup_start): Use priority queues.
      	(GOMP_taskgroup_end): Likewise.  Handle target nowait target tasks
      	specially.  If taskgroup is NULL, and thr->ts.level is 0, act as a
      	barrier.
      	* taskloop.c (GOMP_taskloop): Handle priorities.
      	* team.c (gomp_new_team): Call priority_queue_init.
      	(free_team): Call priority_queue_free.
      	(gomp_free_thread): Call gomp_team_end if thr->ts.team is artificial
      	team created for target nowait in implicit parallel region.
      	(gomp_team_start): For nested check, test thr->ts.level instead of
      	thr->ts.team != NULL.
      	* testsuite/libgomp.c/doacross-3.c: New test.
      	* testsuite/libgomp.c/ordered-5.c: New test.
      	* testsuite/libgomp.c/priority.c: New test.
      	* testsuite/libgomp.c/target-31.c: New test.
      	* testsuite/libgomp.c/target-32.c: New test.
      	* testsuite/libgomp.c/target-33.c: New test.
      	* testsuite/libgomp.c/target-34.c: New test.
      liboffloadmic/
      2015-11-14  Ilya Verbin  <ilya.verbin@intel.com>
      
      	* runtime/offload_host.cpp (task_completion_callback): New
      	variable.
      	(offload_proxy_task_completed_ooo): Call task_completion_callback.
      	(__offload_register_task_callback): New function.
      	* runtime/offload_host.h (__offload_register_task_callback): New
      	declaration.
      	* plugin/libgomp-plugin-intelmic.cpp (offload): Add async_data
      	argument, handle async offloading.
      	(register_main_image): Call register_main_image.
      	(GOMP_OFFLOAD_init_device, get_target_table, GOMP_OFFLOAD_alloc,
      	GOMP_OFFLOAD_free, GOMP_OFFLOAD_host2dev, GOMP_OFFLOAD_dev2host,
      	GOMP_OFFLOAD_dev2dev) Adjust offload callers.
      	(GOMP_OFFLOAD_async_run): New function.
      	(GOMP_OFFLOAD_run): Implement using GOMP_OFFLOAD_async_run.
      
      From-SVN: r230381
      e4606348
  32. Oct 13, 2015
    • Jakub Jelinek's avatar
      builtin-types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR, [...]): New. · d9a6bd32
      Jakub Jelinek authored
      gcc/
      2015-10-13  Jakub Jelinek  <jakub@redhat.com>
      	    Aldy Hernandez  <aldyh@redhat.com>
      	    Ilya Verbin  <ilya.verbin@intel.com>
      
      	* builtin-types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR,
      	BT_FN_BOOL_UINT_ULLPTR_ULLPTR_ULLPTR,
      	BT_FN_BOOL_UINT_LONGPTR_LONG_LONGPTR_LONGPTR,
      	BT_FN_BOOL_UINT_ULLPTR_ULL_ULLPTR_ULLPTR,
      	BT_FN_VOID_INT_SIZE_PTR_PTR_PTR_UINT_PTR,
      	BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR,
      	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT,
      	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_LONG_LONG_LONG,
      	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_ULL_ULL_ULL,
      	BT_FN_VOID_LONG_VAR, BT_FN_VOID_ULL_VAR): New.
      	(BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR,
      	BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR,
      	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): Remove.
      	* cgraph.h (enum cgraph_simd_clone_arg_type): Add
      	SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP,
      	SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP and
      	SIMD_CLONE_ARG_TYPE_LINEAR_VAL_CONSTANT_STEP.
      	(struct cgraph_simd_clone_arg): Adjust comment.
      	* coretypes.h (struct gomp_ordered): New forward decl.
      	* gimple.c (gimple_build_omp_critical): Add CLAUSES argument,
      	set critical clauses to it.
      	(gimple_build_omp_ordered): Return gomp_ordered * instead of
      	gimple *.  Add CLAUSES argument, set ordered clauses to it.
      	(gimple_copy): Unshare clauses on GIMPLE_OMP_CRITICAL and
      	GIMPLE_OMP_ORDERED.
      	* gimple.def (GIMPLE_OMP_ORDERED): Change from GSS_OMP to
      	GSS_OMP_SINGLE_LAYOUT, move it after GIMPLE_OMP_TEAMS.
      	* gimple.h (enum gf_mask): Add GF_OMP_TASK_TASKLOOP.  Add another bit
      	to GF_OMP_FOR_KIND_MASK mask. Add GF_OMP_FOR_KIND_TASKLOOP, renumber
      	GF_OMP_FOR_KIND_CILKFOR and GF_OMP_FOR_KIND_OACC_LOOP.  Adjust
      	GF_OMP_FOR_SIMD, GF_OMP_FOR_COMBINED and GF_OMP_FOR_COMBINED_INTO.
      	Add another bit to GF_OMP_TARGET_KIND_MASK mask.  Add
      	GF_OMP_TARGET_KIND_ENTER_DATA and GF_OMP_TARGET_KIND_EXIT_DATA,
      	renumber
      	GF_OMP_TARGET_KIND_OACC_{PARALLEL,KERNELS,DATA,UPDATE,ENTER_EXIT_DATA}.
      	(gomp_critical): Add clauses field.
      	(gomp_ordered): New struct.
      	(is_a_helper <gomp_ordered *>::test): New inline.
      	(gimple_build_omp_critical): Add CLAUSES argument.
      	(gimple_build_omp_ordered): Likewise.  Return gomp_ordered *
      	instead of gimple *.
      	(gimple_omp_critical_clauses, gimple_omp_critical_clauses_ptr,
      	gimple_omp_critical_set_clauses, gimple_omp_ordered_clauses,
      	gimple_omp_ordered_clauses_ptr, gimple_omp_ordered_set_clauses,
      	gimple_omp_task_taskloop_p, gimple_omp_task_set_taskloop_p): New
      	inline functions.
      	* gimple-pretty-print.c (dump_gimple_omp_for): Handle taskloop.
      	(dump_gimple_omp_target): Handle enter data and exit data.
      	(dump_gimple_omp_block): Don't handle GIMPLE_OMP_ORDERED here.
      	(dump_gimple_omp_critical): Print clauses.
      	(dump_gimple_omp_ordered): New function.
      	(dump_gimple_omp_task): Handle taskloop.
      	(pp_gimple_stmt_1): Use dump_gimple_omp_ordered for
      	GIMPLE_OMP_ORDERED.
      	* gimple-walk.c (walk_gimple_op): Walk clauses on
      	GIMPLE_OMP_CRITICAL and GIMPLE_OMP_ORDERED.
      	* gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP_0LEN_ARRAY.
      	(enum omp_region_type): Add ORT_COMBINED_TARGET and ORT_NONE.
      	(struct gimplify_omp_ctx): Add loop_iter_var,
      	target_map_scalars_firstprivate, target_map_pointers_as_0len_arrays
      	and target_firstprivatize_array_bases fields.
      	(delete_omp_context): Release loop_iter_var.
      	(gimplify_bind_expr): Handle ORT_NONE.
      	(maybe_fold_stmt): Adjust check for ORT_TARGET for the addition of
      	ORT_COMBINED_TARGET.
      	(is_gimple_stmt): Return true for OMP_TASKLOOP, OMP_TEAMS and
      	OMP_TARGET{,_DATA,_UPDATE,_ENTER_DATA,_EXIT_DATA}.
      	(omp_firstprivatize_variable): Handle ORT_NONE.  Adjust check for
      	ORT_TARGET for the addition of ORT_COMBINED_TARGET.  Handle
      	ctx->target_map_scalars_firstprivate.
      	(omp_add_variable): Handle ORT_NONE.  Allow map clause together with
      	data sharing clauses.  For data sharing clause with VLA decl
      	on omp target/target data don't add firstprivate for the pointer.
      	Call omp_notice_variable on TYPE_SIZE_UNIT only if it is a DECL_P.
      	(omp_notice_threadprivate_variable): Adjust check for ORT_TARGET for
      	the addition of ORT_COMBINED_TARGET.
      	(omp_notice_variable): Handle ORT_NONE.  Adjust check for ORT_TARGET
      	for the addition of ORT_COMBINED_TARGET.  Handle implicit mapping of
      	pointers as zero length array sections and
      	ctx->target_map_scalars_firstprivate mapping of scalars as firstprivate
      	data sharing.
      	(omp_check_private): Handle omp_member_access_dummy_var vars.
      	(find_decl_expr): New function.
      	(gimplify_scan_omp_clauses): Add CODE argument.  For OMP_CLAUSE_IF
      	complain if OMP_CLAUSE_IF_MODIFIER is present and does not match code.
      	Handle OMP_CLAUSE_GANG separately.  Handle
      	OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD,SIMDLEN}
      	clauses.  Diagnose linear clause on combined
      	distribute {, parallel for} simd construct, unless it is the loop
      	iterator.  Handle struct element GOMP_MAP_FIRSTPRIVATE_POINTER.
      	Handle map clauses with COMPONENT_REF.  Initialize
      	ctx->target_map_scalars_firstprivate,
      	ctx->target_firstprivatize_array_bases and
      	ctx->target_map_pointers_as_0len_arrays.  Add firstprivate for
      	linear clause even to target region if combined.  Remove
      	map clauses with GOMP_MAP_FIRSTPRIVATE_POINTER kind from
      	OMP_TARGET_{,ENTER_,EXIT_}DATA.  For GOMP_MAP_FIRSTPRIVATE_POINTER
      	map kind with non-INTEGER_CST OMP_CLAUSE_SIZE firstprivatize the bias.
      	Handle OMP_CLAUSE_DEPEND_{SINK,SOURCE}.  Handle
      	OMP_CLAUSE_{{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT}.
      	For linear clause on worksharing loop combined with parallel add
      	shared clause on the parallel.  Handle OMP_CLAUSE_REDUCTION
      	with MEM_REF OMP_CLAUSE_DECL.  Set DECL_NAME on
      	omp_member_access_dummy_var vars.  Add lastprivate clause to outer
      	taskloop if needed.
      	(gimplify_adjust_omp_clauses_1): Handle GOVD_MAP_0LEN_ARRAY.
      	If gimplify_omp_ctxp->target_firstprivatize_array_bases, use
      	GOMP_MAP_FIRSTPRIVATE_POINTER map kind instead of
      	GOMP_MAP_POINTER.
      	(gimplify_adjust_omp_clauses): Add CODE argument.  Handle removal
      	of GOMP_MAP_FIRSTPRIVATE_POINTER struct elements for struct not seen
      	in target body.  Handle removal of struct mapping if struct is not
      	seen in target body.  Remove GOMP_MAP_STRUCT map clause on
      	OMP_TARGET_EXIT_DATA.  Adjust check for ORT_TARGET for the
      	addition of ORT_COMBINED_TARGET.  Use GOMP_MAP_FIRSTPRIVATE_POINTER
      	instead of GOMP_MAP_POINTER if ctx->target_firstprivatize_array_bases
      	for VLAs.  Set OMP_CLAUSE_MAP_PRIVATE if both data sharing and map
      	clause appear together.  Handle
      	OMP_CLAUSE_{{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT}.  Don't remove map
      	clause if it has map-type-modifier always.  Handle
      	OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD,SIMDLEN}
      	clauses.
      	(gimplify_oacc_cache, gimplify_omp_parallel, gimplify_omp_task):
      	Adjust gimplify_scan_omp_clauses and gimplify_adjust_omp_clauses
      	callers.
      	(gimplify_omp_for): Likewise.  Handle OMP_TASKLOOP.  Initialize
      	loop_iter_var.  Use OMP_FOR_ORIG_DECLS.  Fix handling of lastprivate
      	iterators in doacross loops.
      	(gimplify_omp_workshare): Adjust gimplify_scan_omp_clauses and
      	gimplify_adjust_omp_clauses callers.  Use ORT_COMBINED_TARGET
      	for OMP_TARGET_COMBINED.  Adjust check for ORT_TARGET
      	for the addition of ORT_COMBINED_TARGET.
      	(gimplify_omp_target_update): Adjust gimplify_scan_omp_clauses and
      	gimplify_adjust_omp_clauses callers.  Handle OMP_TARGET_ENTER_DATA
      	and OMP_TARGET_EXIT_DATA.
      	(gimplify_omp_ordered): New function.
      	(gimplify_expr): Handle OMP_TASKLOOP, OMP_TARGET_ENTER_DATA and
      	OMP_TARGET_EXIT_DATA.  Use gimplify_omp_ordered for OMP_ORDERED.
      	Gimplify clauses on OMP_CRITICAL.
      	* internal-fn.c (expand_GOMP_SIMD_ORDERED_START,
      	expand_GOMP_SIMD_ORDERED_END): New functions.
      	* internal-fn.def (GOMP_SIMD_ORDERED_START,
      	GOMP_SIMD_ORDERED_END): New internal functions.
      	* omp-builtins.def (BUILT_IN_GOMP_LOOP_DOACROSS_STATIC_START,
      	BUILT_IN_GOMP_LOOP_DOACROSS_DYNAMIC_START,
      	BUILT_IN_GOMP_LOOP_DOACROSS_GUIDED_START,
      	BUILT_IN_GOMP_LOOP_DOACROSS_RUNTIME_START,
      	BUILT_IN_GOMP_LOOP_ULL_DOACROSS_STATIC_START,
      	BUILT_IN_GOMP_LOOP_ULL_DOACROSS_DYNAMIC_START,
      	BUILT_IN_GOMP_LOOP_ULL_DOACROSS_GUIDED_START,
      	BUILT_IN_GOMP_LOOP_ULL_DOACROSS_RUNTIME_START,
      	BUILT_IN_GOMP_DOACROSS_POST, BUILT_IN_GOMP_DOACROSS_WAIT,
      	BUILT_IN_GOMP_DOACROSS_ULL_POST, BUILT_IN_GOMP_DOACROSS_ULL_WAIT,
      	BUILT_IN_GOMP_TARGET_ENTER_EXIT_DATA, BUILT_IN_GOMP_TASKLOOP,
      	BUILT_IN_GOMP_TASKLOOP_ULL): New built-ins.
      	(BUILT_IN_GOMP_TASK): Add INT argument to the end.
      	(BUILT_IN_GOMP_TARGET): Rename from GOMP_target to GOMP_target_41,
      	adjust type.
      	(BUILT_IN_GOMP_TARGET_DATA): Rename from GOMP_target_data to
      	GOMP_target_data_41, adjust type.
      	(BUILT_IN_GOMP_TARGET_UPDATE): Rename from GOMP_target_update to
      	GOMP_target_update_41, adjust type.
      	* omp-low.c (struct omp_region): Adjust comments, add ord_stmt
      	field.
      	(struct omp_for_data): Add ordered and simd_schedule fields.
      	(omp_member_access_dummy_var, unshare_and_remap_1,
      	unshare_and_remap, is_taskloop_ctx): New functions.
      	(is_taskreg_ctx): Use is_parallel_ctx and is_task_ctx.
      	(extract_omp_for_data): Handle taskloops and doacross loops
      	and simd schedule modifier.
      	(omp_adjust_chunk_size): New function.
      	(get_ws_args_for): Use it.
      	(lookup_sfield): Change first argument to splay_tree_key,
      	add overload with first argument tree.
      	(maybe_lookup_field): Likewise.
      	(use_pointer_for_field): Handle omp_member_access_dummy_var.
      	(omp_copy_decl_2): If var is TREE_ADDRESSABLE listed in
      	task_shared_vars, clear TREE_ADDRESSABLE on the copy.
      	(build_outer_var_ref): Add LASTPRIVATE argument, handle
      	taskloops and omp_member_access_dummy_var vars.
      	(build_sender_ref): Change first argument to splay_tree_key,
      	add overload with first argument tree.
      	(install_var_field): For mask & 8 use &DECL_UID as key instead
      	of the tree itself.
      	(fixup_child_record_type): Const qualify *.omp_data_i.
      	(scan_sharing_clauses): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE,
      	C/C++ array reductions, OMP_CLAUSE_{IS,USE}_DEVICE_PTR clauses,
      	OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,SIMDLEN,THREADS,SIMD} and
      	OMP_CLAUSE_{NOGROUP,DEFAULTMAP} clauses, OMP_CLAUSE__LOOPTEMP_ clause
      	on taskloop, GOMP_MAP_FIRSTPRIVATE_POINTER, OMP_CLAUSE_MAP_PRIVATE.
      	(create_omp_child_function): Set TREE_READONLY on .omp_data_i.
      	(find_combined_for): Allow searching for different GIMPLE_OMP_FOR
      	kinds.
      	(add_taskreg_looptemp_clauses): New function.
      	(scan_omp_parallel): Use it.
      	(scan_omp_task): Likewise.
      	(finish_taskreg_scan): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE.
      	For taskloop, move fields for the first two _LOOPTEMP_ clauses first.
      	(check_omp_nesting_restrictions): Handle GF_OMP_TARGET_KIND_ENTER_DATA
      	and GF_OMP_TARGET_KIND_EXIT_DATA.  Formatting fixes.  Allow the
      	sandwiched taskloop constructs.  Type check
      	OMP_CLAUSE_DEPEND_{KIND,SOURCE}.  Allow ordered simd inside of simd
      	region.  Diagnose depend(source) or depend(sink:...) on
      	target constructs or task/taskloop.
      	(handle_simd_reference): Use get_name.
      	(lower_rec_input_clauses): Likewise.  Ignore all
      	OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE clauses on taskloop construct.
      	Allow _LOOPTEMP_ clause on GOMP_TASK.  Unshare new_var
      	before passing it to omp_clause_{default,copy}_ctor.  Handle
      	OMP_CLAUSE_REDUCTION with MEM_REF OMP_CLAUSE_DECL.  Set
      	lastprivate_firstprivate flag for linear that needs copyin and
      	copyout.  Use BUILT_IN_ALLOCA_WITH_ALIGN instead of BUILT_IN_ALLOCA.
      	(lower_lastprivate_clauses): For OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE
      	on taskloop lookup decl in outer context.  Pass true to
      	build_outer_var_ref lastprivate argument.  Handle
      	OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV lastprivate if the decl is global
      	outside of outer taskloop for.
      	(lower_reduction_clauses): Handle OMP_CLAUSE_REDUCTION with MEM_REF
      	OMP_CLAUSE_DECL.
      	(lower_send_clauses): Ignore first two _LOOPTEMP_ clauses in taskloop
      	GOMP_TASK.  Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE.  Handle
      	omp_member_access_dummy_var vars.  Handle OMP_CLAUSE_REDUCTION
      	with MEM_REF OMP_CLAUSE_DECL.  Use new lookup_sfield overload.
      	(lower_send_shared_vars): Ignore fields with NULL or FIELD_DECL
      	abstract origin.  Handle omp_member_access_dummy_var vars.
      	(expand_parallel_call): Use expand_omp_build_assign.
      	(expand_task_call): Handle taskloop construct expansion.  Add
      	REGION argument.  Use GOMP_TASK_* defines instead of hardcoded
      	integers.  Add priority argument to GOMP_task* calls.  Or in
      	GOMP_TASK_FLAG_PRIORITY into flags if priority is present for
      	GOMP_task call.
      	(expand_omp_build_assign): Add prototype.  Add AFTER
      	argument, if true emit statements after *GSI_P and continue linking.
      	(expand_omp_taskreg): Adjust expand_task_call caller.
      	(expand_omp_for_init_counts): Rename zero_iter_bb argument to
      	zero_iter1_bb and first_zero_iter to first_zero_iter1, add
      	zero_iter2_bb and first_zero_iter2 arguments, handle computation
      	of counts even for ordered loops.
      	(expand_omp_for_init_vars): Handle GOMP_TASK inner_stmt.
      	(expand_omp_ordered_source, expand_omp_ordered_sink,
      	expand_omp_ordered_source_sink, expand_omp_for_ordered_loops): New
      	functions.
      	(expand_omp_for_generic): Use omp_adjust_chunk_size.  Handle linear
      	clauses on worksharing loop.  Handle DOACROSS loop expansion.
      	(expand_omp_for_static_nochunk): Handle linear clauses on
      	worksharing loop.  Adjust expand_omp_for_init_counts
      	callers.
      	(expand_omp_for_static_chunk): Likewise.  Use omp_adjust_chunk_size.
      	(expand_omp_simd): Handle addressable fd->loop.v.  Adjust
      	expand_omp_for_init_counts callers.
      	(expand_omp_taskloop_for_outer, expand_omp_taskloop_for_inner): New
      	functions.
      	(expand_omp_for): Call expand_omp_taskloop_for_* for taskloop.
      	Handle doacross loops.
      	(expand_omp_target): Handle GF_OMP_TARGET_KIND_ENTER_DATA and
      	GF_OMP_TARGET_KIND_EXIT_DATA.  Pass flags and depend arguments to
      	GOMP_target_{41,update_41,enter_exit_data} libcalls.
      	(expand_omp): Don't expand ordered depend constructs here, record
      	ord_stmt instead for later expand_omp_for_generic.
      	(build_omp_regions_1): Handle GF_OMP_TARGET_KIND_ENTER_DATA and
      	GF_OMP_TARGET_KIND_EXIT_DATA.  Treat GIMPLE_OMP_ORDERED with depend
      	clause as stand-alone directive.
      	(lower_omp_ordered_clauses): New function.
      	(lower_omp_ordered): Handle OMP_CLAUSE_SIMD, for OMP_CLAUSE_DEPEND
      	don't lower anything.
      	(lower_omp_for_lastprivate): Use last _looptemp_ clause
      	on taskloop for comparison.
      	(lower_omp_for): Handle taskloop constructs.  Adjust OMP_CLAUSE_DECL
      	and OMP_CLAUSE_LINEAR_STEP so that expand_omp_for_* can use it during
      	expansion for linear adjustments.
      	(create_task_copyfn): Handle OMP_CLAUSE_SHARED_FIRSTPRIVATE.
      	(lower_depend_clauses): Assert not seeing sink/source depend kinds.
      	Set TREE_ADDRESSABLE on array.  Change first argument from gimple *
      	to tree * pointing to the stmt's clauses.
      	(lower_omp_taskreg): Adjust lower_depend_clauses caller.
      	(lower_omp_target): Handle GF_OMP_TARGET_KIND_ENTER_DATA
      	and GF_OMP_TARGET_KIND_EXIT_DATA, depend clauses,
      	GOMP_MAP_{RELEASE,ALWAYS_{TO,FROM,TOFROM},FIRSTPRIVATE_POINTER,STRUCT}
      	map kinds, OMP_CLAUSE_{FIRSTPRIVATE,PRIVATE,{IS,USE}_DEVICE_PTR
      	clauses.  Always use short kind and 8-bit align shift.
      	(lower_omp_regimplify_p): Use IS_TYPE_OR_DECL_P macro.
      	(struct lower_omp_regimplify_operands_data): New type.
      	(lower_omp_regimplify_operands_p, lower_omp_regimplify_operands):
      	New functions.
      	(lower_omp_1): Use lower_omp_regimplify_operands instead of
      	gimple_regimplify_operands.
      	(make_gimple_omp_edges): Handle GF_OMP_TARGET_KIND_ENTER_DATA and
      	GF_OMP_TARGET_KIND_EXIT_DATA.  Treat GIMPLE_OMP_ORDERED with depend
      	clause as stand-alone directive.
      	(simd_clone_clauses_extract): Honor OMP_CLAUSE_LINEAR_KIND.
      	(simd_clone_mangle): Mangle the various linear kinds
      	per the new ABI.
      	(simd_clone_adjust_argument_types): Handle
      	SIMD_CLONE_ARG_TYPE_LINEAR_*_CONSTANT_STEP.
      	(simd_clone_init_simd_arrays): Don't do anything for uval.
      	(simd_clone_adjust): Handle
      	SIMD_CLONE_ARG_TYPE_LINEAR_REF_CONSTANT_STEP like
      	SIMD_CLONE_ARG_TYPE_LINEAR_CONSTANT_STEP.
      	Handle SIMD_CLONE_ARG_TYPE_LINEAR_UVAL_CONSTANT_STEP.
      	* omp-low.h (omp_member_access_dummy_var): New prototype.
      	* passes.def (pass_simduid_cleanup): Schedule another copy of the
      	pass after all optimizations.
      	* tree.c (omp_clause_code_name): Add entries for
      	OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT}
      	and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD}.
      	(omp_clause_num_ops): Likewise.  Bump number of OMP_CLAUSE_REDUCTION
      	arguments to 5 and for OMP_CLAUSE_ORDERED to 1.
      	(walk_tree_1): Adjust for OMP_CLAUSE_ORDERED having 1 argument and
      	OMP_CLAUSE_REDUCTION 5 arguments.  Handle
      	OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT}
      	and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD}
      	clauses.
      	* tree-core.h (enum omp_clause_linear_kind): New.
      	(struct tree_omp_clause): Change type of map_kind
      	from unsigned char to unsigned int.  Add subcode.if_modifier
      	and subcode.linear_kind fields.
      	(enum omp_clause_code): Add
      	OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,DEFAULTMAP,HINT}
      	and OMP_CLAUSE_{PRIORITY,GRAINSIZE,NUM_TASKS,NOGROUP,THREADS,SIMD}.
      	(OMP_CLAUSE_REDUCTION): Document
      	OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER.
      	(enum omp_clause_depend_kind): Add OMP_CLAUSE_DEPEND_{SOURCE,SINK}.
      	* tree.def (OMP_FOR): Add OMP_FOR_ORIG_DECLS operand.
      	(OMP_CRITICAL): Move before OMP_SINGLE.  Add OMP_CRITICAL_CLAUSES
      	operand.
      	(OMP_ORDERED): Move before OMP_SINGLE.  Add OMP_ORDERED_CLAUSES
      	operand.
      	(OMP_TASKLOOP, OMP_TARGET_ENTER_DATA, OMP_TARGET_EXIT_DATA): New tree
      	codes.
      	* tree.h (OMP_BODY): Replace OMP_CRITICAL with OMP_TASKGROUP.
      	(OMP_CLAUSE_SET_MAP_KIND): Cast to unsigned int rather than unsigned
      	char.
      	(OMP_CRITICAL_NAME): Adjust to be 3rd operand instead of 2nd.
      	(OMP_CLAUSE_NUM_TASKS_EXPR): Formatting fix.
      	(OMP_STANDALONE_CLAUSES): Adjust to cover OMP_TARGET_{ENTER,EXIT}_DATA.
      	(OMP_CLAUSE_DEPEND_SINK_NEGATIVE, OMP_TARGET_COMBINED,
      	OMP_CLAUSE_MAP_PRIVATE, OMP_FOR_ORIG_DECLS, OMP_CLAUSE_IF_MODIFIER,
      	OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION, OMP_CRITICAL_CLAUSES,
      	OMP_CLAUSE_PRIVATE_TASKLOOP_IV, OMP_CLAUSE_LASTPRIVATE_TASKLOOP_IV,
      	OMP_CLAUSE_HINT_EXPR, OMP_CLAUSE_SCHEDULE_SIMD,
      	OMP_CLAUSE_LINEAR_KIND, OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER,
      	OMP_CLAUSE_SHARED_FIRSTPRIVATE, OMP_ORDERED_CLAUSES,
      	OMP_TARGET_ENTER_DATA_CLAUSES, OMP_TARGET_EXIT_DATA_CLAUSES,
      	OMP_CLAUSE_NUM_TASKS_EXPR, OMP_CLAUSE_GRAINSIZE_EXPR,
      	OMP_CLAUSE_PRIORITY_EXPR, OMP_CLAUSE_ORDERED_EXPR): Define.
      	* tree-inline.c (remap_gimple_stmt): Handle clauses on
      	GIMPLE_OMP_ORDERED and GIMPLE_OMP_CRITICAL.  For
      	IFN_GOMP_SIMD_ORDERED_{START,END} set has_simduid_loops.
      	* tree-nested.c (convert_nonlocal_omp_clauses): Handle
      	OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,SIMDLEN,PRIORITY,SIMD}
      	and OMP_CLAUSE_{GRAINSIZE,NUM_TASKS,HINT,NOGROUP,THREADS,DEFAULTMAP}
      	clauses.  Handle OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER.
      	(convert_local_omp_clauses): Likewise.
      	* tree-pretty-print.c (dump_omp_clause): Handle
      	OMP_CLAUSE_{TO_DECLARE,LINK,{USE,IS}_DEVICE_PTR,SIMDLEN,PRIORITY,SIMD}
      	and OMP_CLAUSE_{GRAINSIZE,NUM_TASKS,HINT,NOGROUP,THREADS,DEFAULTMAP}
      	clauses.  Handle OMP_CLAUSE_IF_MODIFIER, OMP_CLAUSE_ORDERED_EXPR,
      	OMP_CLAUSE_SCHEDULE_SIMD, OMP_CLAUSE_LINEAR_KIND,
      	OMP_CLAUSE_DEPEND_{SOURCE,SINK}.  Use "delete" for
      	GOMP_MAP_FORCE_DEALLOC.  Handle
      	GOMP_MAP_{ALWAYS_{TO,FROM,TOFROM},RELEASE,FIRSTPRIVATE_POINTER,STRUCT}.
      	(dump_generic_node): Handle OMP_TASKLOOP, OMP_TARGET_{ENTER,EXIT}_DATA
      	and clauses on OMP_ORDERED and OMP_CRITICAL.
      	* tree-vectorizer.c (adjust_simduid_builtins): Adjust comment.
      	Remove IFN_GOMP_SIMD_ORDERED_{START,END}.
      	(vectorize_loops): Adjust comments.
      	(pass_simduid_cleanup::execute): Likewise.
      	* tree-vect-stmts.c (vectorizable_simd_clone_call): Handle
      	SIMD_CLONE_ARG_TYPE_LINEAR_{REF,VAL,UVAL}_CONSTANT_STEP.
      	* wide-int.h (wi::gcd): New.
      gcc/c-family/
      2015-10-13  Jakub Jelinek  <jakub@redhat.com>
      	    Aldy Hernandez  <aldyh@redhat.com>
      
      	* c-common.c (enum c_builtin_type): Define DEF_FUNCTION_TYPE_9,
      	DEF_FUNCTION_TYPE_10 and DEF_FUNCTION_TYPE_11.
      	(c_define_builtins): Likewise.
      	* c-common.h (enum c_omp_clause_split): Add
      	C_OMP_CLAUSE_SPLIT_TASKLOOP.
      	(c_finish_omp_critical, c_finish_omp_ordered): Add CLAUSES argument.
      	(c_finish_omp_for): Add ORIG_DECLV argument.
      	* c-cppbuiltin.c (c_cpp_builtins): Predefine _OPENMP as
      	201511 instead of 201307.
      	* c-omp.c (c_finish_omp_critical): Add CLAUSES argument, set
      	OMP_CRITICAL_CLAUSES to it.
      	(c_finish_omp_ordered): Add CLAUSES argument, set
      	OMP_ORDERED_CLAUSES to it.
      	(c_finish_omp_for): Add ORIG_DECLV argument, set OMP_FOR_ORIG_DECLS
      	to it if OMP_FOR.  Clear DECL_INITIAL on the IVs.
      	(c_omp_split_clauses): Handle OpenMP 4.5 combined/composite
      	constructs and new OpenMP 4.5 clauses.  Clear
      	OMP_CLAUSE_SCHEDULE_SIMD if not combined with OMP_SIMD.  Add
      	verification code.
      	* c-pragma.c (omp_pragmas_simd): Add taskloop.
      	* c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_TASKLOOP.
      	(enum pragma_omp_clause): Add
      	PRAGMA_OMP_CLAUSE_{DEFAULTMAP,GRAINSIZE,HINT,{IS,USE}_DEVICE_PTR}
      	and PRAGMA_OMP_CLAUSE_{LINK,NOGROUP,NUM_TASKS,PRIORITY,SIMD,THREADS}.
      gcc/c/
      2015-10-13  Jakub Jelinek  <jakub@redhat.com>
      	    Aldy Hernandez  <aldyh@redhat.com>
      
      	* c-parser.c (c_parser_pragma): Handle PRAGMA_OMP_ORDERED here.
      	(c_parser_omp_clause_name): Handle OpenMP 4.5 clauses.
      	(c_parser_omp_variable_list): Handle structure elements for
      	map, to and from clauses.  Handle array sections in reduction
      	clause.  Formatting fixes.
      	(c_parser_omp_clause_if): Add IS_OMP argument, handle parsing of
      	if clause modifiers.
      	(c_parser_omp_clause_num_tasks, c_parser_omp_clause_grainsize,
      	c_parser_omp_clause_priority, c_parser_omp_clause_hint,
      	c_parser_omp_clause_defaultmap, c_parser_omp_clause_use_device_ptr,
      	c_parser_omp_clause_is_device_ptr): New functions.
      	(c_parser_omp_clause_ordered): Parse optional parameter.
      	(c_parser_omp_clause_reduction): Handle array reductions.
      	(c_parser_omp_clause_schedule): Parse optional simd modifier.
      	(c_parser_omp_clause_nogroup, c_parser_omp_clause_orderedkind): New
      	functions.
      	(c_parser_omp_clause_linear): Parse linear clause modifiers.
      	(c_parser_omp_clause_depend_sink): New function.
      	(c_parser_omp_clause_depend): Parse source/sink depend kinds.
      	(c_parser_omp_clause_map): Parse release/delete map kinds and
      	optional always modifier.
      	(c_parser_oacc_all_clauses): Adjust c_parser_omp_clause_if
      	and c_finish_omp_clauses callers.
      	(c_parser_omp_all_clauses): Likewise.  Parse OpenMP 4.5 clauses.
      	Parse "to" as OMP_CLAUSE_TO_DECLARE if on declare target directive.
      	(c_parser_oacc_cache): Adjust c_finish_omp_clauses caller.
      	(OMP_CRITICAL_CLAUSE_MASK): Define.
      	(c_parser_omp_critical): Parse critical clauses.
      	(c_parser_omp_for_loop): Handle doacross loops, adjust
      	c_finish_omp_for and c_finish_omp_clauses callers.
      	(OMP_SIMD_CLAUSE_MASK): Add simdlen clause.
      	(c_parser_omp_simd): Allow ordered clause if it has no parameter.
      	(OMP_FOR_CLAUSE_MASK): Add linear clause.
      	(c_parser_omp_for): Disallow ordered clause when combined with
      	distribute.  Disallow linear clause when combined with distribute
      	and not combined with simd.
      	(OMP_ORDERED_CLAUSE_MASK, OMP_ORDERED_DEPEND_CLAUSE_MASK): Define.
      	(c_parser_omp_ordered): Add CONTEXT argument, remove LOC argument,
      	parse clauses and if depend clause is found, don't parse a body.
      	(c_parser_omp_parallel): Disallow copyin clause on target parallel.
      	Allow target parallel without for after it.
      	(OMP_TASK_CLAUSE_MASK): Add priority clause.
      	(OMP_TARGET_DATA_CLAUSE_MASK): Add use_device_ptr clause.
      	(c_parser_omp_target_data): Diagnose no map clauses or clauses with
      	invalid kinds.
      	(OMP_TARGET_UPDATE_CLAUSE_MASK): Add depend and nowait clauses.
      	(OMP_TARGET_ENTER_DATA_CLAUSE_MASK,
      	OMP_TARGET_EXIT_DATA_CLAUSE_MASK): Define.
      	(c_parser_omp_target_enter_data, c_parser_omp_target_exit_data): New
      	functions.
      	(OMP_TARGET_CLAUSE_MASK): Add depend, nowait, private, firstprivate,
      	defaultmap and is_device_ptr clauses.
      	(c_parser_omp_target): Parse target parallel and target simd.  Set
      	OMP_TARGET_COMBINED on combined constructs.  Parse target enter data
      	and target exit data.  Diagnose invalid map kinds.
      	(OMP_DECLARE_TARGET_CLAUSE_MASK): Define.
      	(c_parser_omp_declare_target): Parse OpenMP 4.5 forms of this
      	construct.
      	(c_parser_omp_declare_reduction): Use STRIP_NOPS when checking for
      	&omp_priv.
      	(OMP_TASKLOOP_CLAUSE_MASK): Define.
      	(c_parser_omp_taskloop): New function.
      	(c_parser_omp_construct): Don't handle PRAGMA_OMP_ORDERED here,
      	handle PRAGMA_OMP_TASKLOOP.
      	(c_parser_cilk_for): Adjust c_finish_omp_clauses callers.
      	* c-tree.h (c_finish_omp_clauses): Add two new arguments.
      	* c-typeck.c (handle_omp_array_sections_1): Fix comment typo.
      	Add IS_OMP argument, handle structure element bases, diagnose
      	bitfields, pass IS_OMP recursively, diagnose known zero length
      	array sections in depend clauses, handle array sections in reduction
      	clause, diagnose negative length even for pointers.
      	(handle_omp_array_sections): Add IS_OMP argument, use auto_vec for
      	types, pass IS_OMP down to handle_omp_array_sections_1, handle
      	array sections in reduction clause, set
      	OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION if map could be zero
      	length array section, use GOMP_MAP_FIRSTPRIVATE_POINTER for IS_OMP.
      	(c_finish_omp_clauses): Add IS_OMP and DECLARE_SIMD arguments.
      	Handle new OpenMP 4.5 clauses and new restrictions for the old ones.
      gcc/cp/
      2015-10-13  Jakub Jelinek  <jakub@redhat.com>
      	    Aldy Hernandez  <aldyh@redhat.com>
      
      	* class.c (finish_struct_1): Call finish_omp_declare_simd_methods.
      	* cp-gimplify.c (cp_gimplify_expr): Handle OMP_TASKLOOP.
      	(cp_genericize_r): Likewise.
      	(cxx_omp_finish_clause): Don't diagnose references.
      	(cxx_omp_disregard_value_expr): New function.
      	* cp-objcp-common.h (LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR): Redefine.
      	* cp-tree.h (OMP_FOR_GIMPLIFYING_P): Document for OMP_TASKLOOP.
      	(DECL_OMP_PRIVATIZED_MEMBER): Define.
      	(finish_omp_declare_simd_methods, push_omp_privatization_clauses,
      	pop_omp_privatization_clauses, save_omp_privatization_clauses,
      	restore_omp_privatization_clauses, omp_privatize_field,
      	cxx_omp_disregard_value_expr): New prototypes.
      	(finish_omp_clauses): Add two new arguments.
      	(finish_omp_for): Add ORIG_DECLV argument.
      	* parser.c (cp_parser_lambda_body): Call
      	save_omp_privatization_clauses and restore_omp_privatization_clauses.
      	(cp_parser_omp_clause_name): Handle OpenMP 4.5 clauses.
      	(cp_parser_omp_var_list_no_open): Handle structure elements for
      	map, to and from clauses.  Handle array sections in reduction
      	clause.  Parse this keyword.  Formatting fixes.
      	(cp_parser_omp_clause_if): Add IS_OMP argument, handle parsing of
      	if clause modifiers.
      	(cp_parser_omp_clause_num_tasks, cp_parser_omp_clause_grainsize,
      	cp_parser_omp_clause_priority, cp_parser_omp_clause_hint,
      	cp_parser_omp_clause_defaultmap): New functions.
      	(cp_parser_omp_clause_ordered): Parse optional parameter.
      	(cp_parser_omp_clause_reduction): Handle array reductions.
      	(cp_parser_omp_clause_schedule): Parse optional simd modifier.
      	(cp_parser_omp_clause_nogroup, cp_parser_omp_clause_orderedkind):
      	New functions.
      	(cp_parser_omp_clause_linear): Parse linear clause modifiers.
      	(cp_parser_omp_clause_depend_sink): New function.
      	(cp_parser_omp_clause_depend): Parse source/sink depend kinds.
      	(cp_parser_omp_clause_map): Parse release/delete map kinds and
      	optional always modifier.
      	(cp_parser_oacc_all_clauses): Adjust cp_parser_omp_clause_if
      	and finish_omp_clauses callers.
      	(cp_parser_omp_all_clauses): Likewise.  Parse OpenMP 4.5 clauses.
      	Parse "to" as OMP_CLAUSE_TO_DECLARE if on declare target directive.
      	(OMP_CRITICAL_CLAUSE_MASK): Define.
      	(cp_parser_omp_critical): Parse critical clauses.
      	(cp_parser_omp_for_incr): Use cp_tree_equal if
      	processing_template_decl.
      	(cp_parser_omp_for_loop_init): Return tree instead of bool.  Handle
      	non-static data member iterators.
      	(cp_parser_omp_for_loop): Handle doacross loops, adjust
      	finish_omp_for and finish_omp_clauses callers.
      	(cp_omp_split_clauses): Adjust finish_omp_clauses caller.
      	(OMP_SIMD_CLAUSE_MASK): Add simdlen clause.
      	(cp_parser_omp_simd): Allow ordered clause if it has no parameter.
      	(OMP_FOR_CLAUSE_MASK): Add linear clause.
      	(cp_parser_omp_for): Disallow ordered clause when combined with
      	distribute.  Disallow linear clause when combined with distribute
      	and not combined with simd.
      	(OMP_ORDERED_CLAUSE_MASK, OMP_ORDERED_DEPEND_CLAUSE_MASK): Define.
      	(cp_parser_omp_ordered): Add CONTEXT argument, return bool instead
      	of tree, parse clauses and if depend clause is found, don't parse
      	a body.
      	(cp_parser_omp_parallel): Disallow copyin clause on target parallel.
      	Allow target parallel without for after it.
      	(OMP_TASK_CLAUSE_MASK): Add priority clause.
      	(OMP_TARGET_DATA_CLAUSE_MASK): Add use_device_ptr clause.
      	(cp_parser_omp_target_data): Diagnose no map clauses or clauses with
      	invalid kinds.
      	(OMP_TARGET_UPDATE_CLAUSE_MASK): Add depend and nowait clauses.
      	(OMP_TARGET_ENTER_DATA_CLAUSE_MASK,
      	OMP_TARGET_EXIT_DATA_CLAUSE_MASK): Define.
      	(cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data): New
      	functions.
      	(OMP_TARGET_CLAUSE_MASK): Add depend, nowait, private, firstprivate,
      	defaultmap and is_device_ptr clauses.
      	(cp_parser_omp_target): Parse target parallel and target simd.  Set
      	OMP_TARGET_COMBINED on combined constructs.  Parse target enter data
      	and target exit data.  Diagnose invalid map kinds.
      	(cp_parser_oacc_cache): Adjust finish_omp_clauses caller.
      	(OMP_DECLARE_TARGET_CLAUSE_MASK): Define.
      	(cp_parser_omp_declare_target): Parse OpenMP 4.5 forms of this
      	construct.
      	(OMP_TASKLOOP_CLAUSE_MASK): Define.
      	(cp_parser_omp_taskloop): New function.
      	(cp_parser_omp_construct): Don't handle PRAGMA_OMP_ORDERED here,
      	handle PRAGMA_OMP_TASKLOOP.
      	(cp_parser_pragma): Handle PRAGMA_OMP_ORDERED here directly,
      	handle PRAGMA_OMP_TASKLOOP, call push_omp_privatization_clauses
      	and pop_omp_privatization_clauses around parsing calls.
      	(cp_parser_cilk_for): Adjust finish_omp_clauses caller.
      	* pt.c (apply_late_template_attributes): Adjust tsubst_omp_clauses
      	and finish_omp_clauses callers.
      	(tsubst_omp_clause_decl): Return NULL if decl is NULL.
      	For TREE_LIST, copy over OMP_CLAUSE_DEPEND_SINK_NEGATIVE bit.
      	Use tsubst_expr instead of tsubst_copy, undo convert_from_reference
      	effects.
      	(tsubst_omp_clauses): Add ALLOW_FIELDS argument.  Handle new
      	OpenMP 4.5 clauses.  Use tsubst_omp_clause_decl for more clauses.
      	If ALLOW_FIELDS, handle non-static data members in the clauses.
      	Clear OMP_CLAUSE_LINEAR_STEP if it has been cleared before.
      	(omp_parallel_combined_clauses): New variable.
      	(tsubst_omp_for_iterator): Add ORIG_DECLV argument, recur on
      	OMP_FOR_ORIG_DECLS, handle non-static data member iterators.
      	Improve handling of clauses on combined constructs.
      	(tsubst_expr): Call push_omp_privatization_clauses and
      	pop_omp_privatization_clauses around instantiation of certain
      	OpenMP constructs, improve handling of clauses on combined
      	constructs, handle OMP_TASKLOOP, adjust tsubst_omp_for_iterator,
      	tsubst_omp_clauses and finish_omp_for callers, handle clauses on
      	critical and ordered, handle OMP_TARGET_{ENTER,EXIT}_DATA.
      	(instantiate_decl): Call save_omp_privatization_clauses and
      	restore_omp_privatization_clauses around instantiation.
      	(dependent_omp_for_p): Fix up comment typo.  Handle SCOPE_REF.
      	* semantics.c (omp_private_member_map, omp_private_member_vec,
      	omp_private_member_ignore_next): New variables.
      	(finish_non_static_data_member): Return dummy decl for privatized
      	non-static data members.
      	(omp_clause_decl_field, omp_clause_printable_decl,
      	omp_note_field_privatization, omp_privatize_field): New functions.
      	(handle_omp_array_sections_1): Fix comment typo.
      	Add IS_OMP argument, handle structure element bases, diagnose
      	bitfields, pass IS_OMP recursively, diagnose known zero length
      	array sections in depend clauses, handle array sections in reduction
      	clause, diagnose negative length even for pointers.
      	(handle_omp_array_sections): Add IS_OMP argument, use auto_vec for
      	types, pass IS_OMP down to handle_omp_array_sections_1, handle
      	array sections in reduction clause, set
      	OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION if map could be zero
      	length array section, use GOMP_MAP_FIRSTPRIVATE_POINTER for IS_OMP.
      	(finish_omp_reduction_clause): Handle array sections and arrays.
      	Use omp_clause_printable_decl.
      	(finish_omp_declare_simd_methods, cp_finish_omp_clause_depend_sink):
      	New functions.
      	(finish_omp_clauses): Add ALLOW_FIELDS and DECLARE_SIMD arguments.
      	Handle new OpenMP 4.5 clauses and new restrictions for the old
      	ones, handle non-static data members, reject this keyword when not
      	allowed.
      	(push_omp_privatization_clauses, pop_omp_privatization_clauses,
      	save_omp_privatization_clauses, restore_omp_privatization_clauses):
      	New functions.
      	(handle_omp_for_class_iterator): Handle OMP_TASKLOOP class iterators.
      	Add collapse and ordered arguments.  Fix handling of lastprivate
      	iterators in doacross loops.
      	(finish_omp_for): Add ORIG_DECLV argument, handle doacross loops,
      	adjust c_finish_omp_for, handle_omp_for_class_iterator and
      	finish_omp_clauses callers.  Fill in OMP_CLAUSE_LINEAR_STEP on simd
      	loops with non-static data member iterators.
      gcc/fortran/
      2015-10-13  Jakub Jelinek  <jakub@redhat.com>
      	    Ilya Verbin  <ilya.verbin@intel.com>
      
      	* f95-lang.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10,
      	DEF_FUNCTION_TYPE_11, DEF_FUNCTION_TYPE_VAR_1): Define.
      	* trans-openmp.c (gfc_trans_omp_clauses): Set
      	OMP_CLAUSE_IF_MODIFIER to ERROR_MARK, OMP_CLAUSE_ORDERED_EXPR
      	to NULL.
      	(gfc_trans_omp_critical): Adjust for addition of clauses.
      	(gfc_trans_omp_ordered): Likewise.
      	* types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR,
      	BT_FN_BOOL_UINT_ULLPTR_ULLPTR_ULLPTR,
      	BT_FN_BOOL_UINT_LONGPTR_LONG_LONGPTR_LONGPTR,
      	BT_FN_BOOL_UINT_ULLPTR_ULL_ULLPTR_ULLPTR,
      	BT_FN_VOID_INT_SIZE_PTR_PTR_PTR_UINT_PTR,
      	BT_FN_VOID_INT_OMPFN_SIZE_PTR_PTR_PTR_UINT_PTR,
      	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR_INT,
      	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_LONG_LONG_LONG,
      	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_UINT_LONG_INT_ULL_ULL_ULL,
      	BT_FN_VOID_LONG_VAR, BT_FN_VOID_ULL_VAR): New.
      	(BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR,
      	BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR,
      	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): Remove.
      gcc/lto/
      2015-10-13  Jakub Jelinek  <jakub@redhat.com>
      
      	* lto-lang.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10,
      	DEF_FUNCTION_TYPE_11): Define.
      gcc/jit/
      2015-10-13  Jakub Jelinek  <jakub@redhat.com>
      
      	* jit-builtins.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10,
      	DEF_FUNCTION_TYPE_11): Define.
      	* jit-builtins.h (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10,
      	DEF_FUNCTION_TYPE_11): Define.
      gcc/ada/
      2015-10-13  Jakub Jelinek  <jakub@redhat.com>
      
      	* gcc-interface/utils.c (DEF_FUNCTION_TYPE_9, DEF_FUNCTION_TYPE_10,
      	DEF_FUNCTION_TYPE_11): Define.
      gcc/testsuite/
      2015-10-13  Jakub Jelinek  <jakub@redhat.com>
      	    Aldy Hernandez  <aldyh@redhat.com>
      
      	* c-c++-common/gomp/cancel-1.c (f2): Add map clause to target data.
      	* c-c++-common/gomp/clauses-1.c: New test.
      	* c-c++-common/gomp/clauses-2.c: New test.
      	* c-c++-common/gomp/clauses-3.c: New test.
      	* c-c++-common/gomp/clauses-4.c: New test.
      	* c-c++-common/gomp/declare-target-1.c: New test.
      	* c-c++-common/gomp/declare-target-2.c: New test.
      	* c-c++-common/gomp/depend-3.c: New test.
      	* c-c++-common/gomp/depend-4.c: New test.
      	* c-c++-common/gomp/doacross-1.c: New test.
      	* c-c++-common/gomp/if-1.c: New test.
      	* c-c++-common/gomp/if-2.c: New test.
      	* c-c++-common/gomp/linear-1.c: New test.
      	* c-c++-common/gomp/map-2.c: New test.
      	* c-c++-common/gomp/map-3.c: New test.
      	* c-c++-common/gomp/nesting-1.c (f_omp_parallel,
      	f_omp_target_data): Add map clause to target data.
      	* c-c++-common/gomp/nesting-warn-1.c (f_omp_target): Likewise.
      	* c-c++-common/gomp/ordered-1.c: New test.
      	* c-c++-common/gomp/ordered-2.c: New test.
      	* c-c++-common/gomp/ordered-3.c: New test.
      	* c-c++-common/gomp/pr61486-1.c (foo): Remove linear clause
      	on non-iterator.
      	* c-c++-common/gomp/pr61486-2.c (test, test2): Remove ordered
      	clause and ordered construct where no longer allowed.
      	* c-c++-common/gomp/priority-1.c: New test.
      	* c-c++-common/gomp/reduction-1.c: New test.
      	* c-c++-common/gomp/schedule-simd-1.c: New test.
      	* c-c++-common/gomp/sink-1.c: New test.
      	* c-c++-common/gomp/sink-2.c: New test.
      	* c-c++-common/gomp/sink-3.c: New test.
      	* c-c++-common/gomp/sink-4.c: New test.
      	* c-c++-common/gomp/udr-1.c: New test.
      	* c-c++-common/taskloop-1.c: New test.
      	* c-c++-common/cpp/openmp-define-3.c: Adjust for the new
      	value of _OPENMP macro.
      	* c-c++-common/cilk-plus/PS/body.c (foo): Adjust expected diagnostics.
      	* c-c++-common/goacc-gomp/nesting-fail-1.c (f_acc_parallel,
      	f_acc_kernels, f_acc_data, f_acc_loop): Add map clause to target data.
      	* gcc.dg/gomp/clause-1.c:
      	* gcc.dg/gomp/reduction-1.c: New test.
      	* gcc.dg/gomp/sink-fold-1.c: New test.
      	* gcc.dg/gomp/sink-fold-2.c: New test.
      	* gcc.dg/gomp/sink-fold-3.c: New test.
      	* gcc.dg/vect/vect-simd-clone-15.c: New test.
      	* g++.dg/gomp/clause-1.C (T::test): Remove dg-error on privatization
      	of non-static data members.
      	* g++.dg/gomp/clause-3.C (foo): Remove one dg-error directive.
      	Add some linear clause tests.
      	* g++.dg/gomp/declare-simd-3.C: New test.
      	* g++.dg/gomp/linear-1.C: New test.
      	* g++.dg/gomp/member-1.C: New test.
      	* g++.dg/gomp/member-2.C: New test.
      	* g++.dg/gomp/pr66571-2.C: New test.
      	* g++.dg/gomp/pr67504.C (foo): Add test for ordered clause with
      	dependent argument.
      	* g++.dg/gomp/pr67522.C (foo): Add test for invalid array section
      	in reduction clause.
      	* g++.dg/gomp/reference-1.C: New test.
      	* g++.dg/gomp/sink-1.C: New test.
      	* g++.dg/gomp/sink-2.C: New test.
      	* g++.dg/gomp/sink-3.C: New test.
      	* g++.dg/gomp/task-1.C: Remove both dg-error directives.
      	* g++.dg/gomp/this-1.C: New test.
      	* g++.dg/gomp/this-2.C: New test.
      	* g++.dg/vect/simd-clone-2.cc: New test.
      	* g++.dg/vect/simd-clone-2.h: New test.
      	* g++.dg/vect/simd-clone-3.cc: New test.
      	* g++.dg/vect/simd-clone-4.cc: New test.
      	* g++.dg/vect/simd-clone-4.h: New test.
      	* g++.dg/vect/simd-clone-5.cc: New test.
      include/
      2015-10-13  Jakub Jelinek  <jakub@redhat.com>
      	    Ilya Verbin  <ilya.verbin@intel.com>
      
      	* gomp-constants.h (GOMP_MAP_FLAG_ALWAYS): Define.
      	(enum gomp_map_kind): Add GOMP_MAP_FIRSTPRIVATE,
      	GOMP_MAP_FIRSTPRIVATE_INT, GOMP_MAP_USE_DEVICE_PTR,
      	GOMP_MAP_ZERO_LEN_ARRAY_SECTION, GOMP_MAP_ALWAYS_TO,
      	GOMP_MAP_ALWAYS_FROM, GOMP_MAP_ALWAYS_TOFROM, GOMP_MAP_STRUCT,
      	GOMP_MAP_DELETE_ZERO_LEN_ARRAY_SECTION, GOMP_MAP_DELETE,
      	GOMP_MAP_RELEASE, GOMP_MAP_FIRSTPRIVATE_POINTER.
      	(GOMP_MAP_ALWAYS_TO_P, GOMP_MAP_ALWAYS_FROM_P): Define.
      	(GOMP_TASK_FLAG_UNTIED, GOMP_TASK_FLAG_FINAL, GOMP_TASK_FLAG_MERGEABLE,
      	GOMP_TASK_FLAG_DEPEND, GOMP_TASK_FLAG_PRIORITY, GOMP_TASK_FLAG_UP,
      	GOMP_TASK_FLAG_GRAINSIZE, GOMP_TASK_FLAG_IF, GOMP_TASK_FLAG_NOGROUP,
      	GOMP_TARGET_FLAG_NOWAIT, GOMP_TARGET_FLAG_EXIT_DATA,
      	GOMP_TARGET_FLAG_UPDATE): Define.
      libgomp/
      2015-10-13  Jakub Jelinek  <jakub@redhat.com>
      	    Aldy Hernandez  <aldyh@redhat.com>
      	    Ilya Verbin  <ilya.verbin@intel.com>
      
      	* config/linux/affinity.c (omp_get_place_num_procs,
      	omp_get_place_proc_ids, gomp_get_place_proc_ids_8): New functions.
      	* config/linux/doacross.h: New file.
      	* config/posix/affinity.c (omp_get_place_num_procs,
      	omp_get_place_proc_ids, gomp_get_place_proc_ids_8): New functions.
      	* config/posix/doacross.h: New file.
      	* env.c: Include gomp-constants.h.
      	(struct gomp_task_icv): Rename run_sched_modifier to
      	run_sched_chunk_size.
      	(gomp_max_task_priority_var): New variable.
      	(parse_schedule): Rename run_sched_modifier to run_sched_chunk_size.
      	(handle_omp_display_env): Change _OPENMP value from 201307 to
      	201511.  Print OMP_MAX_TASK_PRIORITY.
      	(initialize_env): Parse OMP_MAX_TASK_PRIORITY.
      	(omp_set_schedule, omp_get_schedule): Rename modifier argument to
      	chunk_size and run_sched_modifier to run_sched_chunk_size.
      	(omp_get_max_task_priority, omp_get_initial_device,
      	omp_get_num_places, omp_get_place_num, omp_get_partition_num_places,
      	omp_get_partition_place_nums): New functions.
      	* fortran.c (omp_set_schedule_, omp_set_schedule_8_,
      	omp_get_schedule_, omp_get_schedule_8_): Rename modifier argument
      	to chunk_size.
      	(omp_get_num_places_, omp_get_place_num_procs_,
      	omp_get_place_num_procs_8_, omp_get_place_proc_ids_,
      	omp_get_place_proc_ids_8_, omp_get_place_num_,
      	omp_get_partition_num_places_, omp_get_partition_place_nums_,
      	omp_get_partition_place_nums_8_, omp_get_initial_device_,
      	omp_get_max_task_priority_): New functions.
      	* libgomp_g.h (GOMP_loop_doacross_static_start,
      	GOMP_loop_doacross_dynamic_start, GOMP_loop_doacross_guided_start,
      	GOMP_loop_doacross_runtime_start, GOMP_loop_ull_doacross_static_start,
      	GOMP_loop_ull_doacross_dynamic_start,
      	GOMP_loop_ull_doacross_guided_start,
      	GOMP_loop_ull_doacross_runtime_start, GOMP_doacross_post,
      	GOMP_doacross_wait, GOMP_doacross_ull_post, GOMP_doacross_wait,
      	GOMP_taskloop, GOMP_taskloop_ull, GOMP_target_41,
      	GOMP_target_data_41, GOMP_target_update_41,
      	GOMP_target_enter_exit_data): New prototypes.
      	(GOMP_task): Add prototype argument.
      	* libgomp.h (_LIBGOMP_CHECKING_): Define to 0 if not yet defined.
      	(struct gomp_doacross_work_share): New type.
      	(struct gomp_work_share): Add doacross field.
      	(struct gomp_task_icv): Rename run_sched_modifier to
      	run_sched_chunk_size.
      	(enum gomp_task_kind): Rename GOMP_TASK_IFFALSE to
      	GOMP_TASK_UNDEFERRED.  Add comments.
      	(struct gomp_task_depend_entry): Add comments.
      	(struct gomp_task): Likewise.
      	(struct gomp_taskgroup): Likewise.
      	(struct gomp_target_task): New type.
      	(struct gomp_team): Add comment.
      	(gomp_get_place_proc_ids_8, gomp_doacross_init,
      	gomp_doacross_ull_init, gomp_task_maybe_wait_for_dependencies,
      	gomp_create_target_task, gomp_target_task_fn): New prototypes.
      	(struct target_var_desc): New type.
      	(struct target_mem_desc): Adjust comment.  Use struct
      	target_var_desc instead of splay_tree_key for list.
      	(REFCOUNT_INFINITY): Define.
      	(struct splay_tree_key_s): Remove copy_from field.
      	(struct gomp_device_descr): Add dev2dev_func field.
      	(enum gomp_map_vars_kind): New enum.
      	(gomp_map_vars): Add one argument.
      	* libgomp.map (OMP_4.5): Export omp_get_max_task_priority,
      	omp_get_max_task_priority_, omp_get_num_places, omp_get_num_places_,
      	omp_get_place_num_procs, omp_get_place_num_procs_,
      	omp_get_place_num_procs_8_, omp_get_place_proc_ids,
      	omp_get_place_proc_ids_, omp_get_place_proc_ids_8_, omp_get_place_num,
      	omp_get_place_num_, omp_get_partition_num_places,
      	omp_get_partition_num_places_, omp_get_partition_place_nums,
      	omp_get_partition_place_nums_, omp_get_partition_place_nums_8_,
      	omp_get_initial_device, omp_get_initial_device_, omp_target_alloc,
      	omp_target_free, omp_target_is_present, omp_target_memcpy,
      	omp_target_memcpy_rect, omp_target_associate_ptr and
      	omp_target_disassociate_ptr.
      	(GOMP_4.0.2): Renamed to ...
      	(GOMP_4.5): ... this.  Export GOMP_target_41, GOMP_target_data_41,
      	GOMP_target_update_41, GOMP_target_enter_exit_data, GOMP_taskloop,
      	GOMP_taskloop_ull, GOMP_loop_doacross_dynamic_start,
      	GOMP_loop_doacross_guided_start, GOMP_loop_doacross_runtime_start,
      	GOMP_loop_doacross_static_start, GOMP_doacross_post,
      	GOMP_doacross_wait, GOMP_loop_ull_doacross_dynamic_start,
      	GOMP_loop_ull_doacross_guided_start,
      	GOMP_loop_ull_doacross_runtime_start,
      	GOMP_loop_ull_doacross_static_start, GOMP_doacross_ull_post and
      	GOMP_doacross_ull_wait.
      	* libgomp.texi: Document omp_get_max_task_priority.
      	Rename modifier argument to chunk_size for omp_set_schedule and
      	omp_get_schedule.  Document OMP_MAX_TASK_PRIORITY env var.
      	* loop.c (GOMP_loop_runtime_start): Adjust for run_sched_modifier
      	to run_sched_chunk_size renaming.
      	(GOMP_loop_ordered_runtime_start): Likewise.
      	(gomp_loop_doacross_static_start, gomp_loop_doacross_dynamic_start,
      	gomp_loop_doacross_guided_start, GOMP_loop_doacross_runtime_start,
      	GOMP_parallel_loop_runtime_start): New functions.
      	(GOMP_parallel_loop_runtime): Adjust for run_sched_modifier
      	to run_sched_chunk_size renaming.
      	(GOMP_loop_doacross_static_start, GOMP_loop_doacross_dynamic_start,
      	GOMP_loop_doacross_guided_start): New functions or aliases.
      	* loop_ull.c (GOMP_loop_ull_runtime_start): Adjust for
      	run_sched_modifier to run_sched_chunk_size renaming.
      	(GOMP_loop_ull_ordered_runtime_start): Likewise.
      	(gomp_loop_ull_doacross_static_start,
      	gomp_loop_ull_doacross_dynamic_start,
      	gomp_loop_ull_doacross_guided_start,
      	GOMP_loop_ull_doacross_runtime_start): New functions.
      	(GOMP_loop_ull_doacross_static_start,
      	GOMP_loop_ull_doacross_dynamic_start,
      	GOMP_loop_ull_doacross_guided_start): New functions or aliases.
      	* oacc-mem.c (acc_map_data, present_create_copy,
      	gomp_acc_insert_pointer): Pass GOMP_MAP_VARS_OPENACC instead of false
      	to gomp_map_vars.
      	(gomp_acc_remove_pointer): Use copy_from from target_var_desc.
      	* oacc-parallel.c (GOACC_data_start): Pass GOMP_MAP_VARS_OPENACC
      	instead of false to gomp_map_vars.
      	(GOACC_parallel_keyed): Likewise.  Use copy_from from target_var_desc.
      	* omp.h.in (omp_lock_hint_t): New type.
      	(omp_init_lock_with_hint, omp_init_nest_lock_with_hint,
      	omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids,
      	omp_get_place_num, omp_get_partition_num_places,
      	omp_get_partition_place_nums, omp_get_initial_device,
      	omp_get_max_task_priority, omp_target_alloc, omp_target_free,
      	omp_target_is_present, omp_target_memcpy, omp_target_memcpy_rect,
      	omp_target_associate_ptr, omp_target_disassociate_ptr): New
      	prototypes.
      	* omp_lib.f90.in (omp_lock_hint_kind): New parameter.
      	(omp_lock_hint_none, omp_lock_hint_uncontended,
      	omp_lock_hint_contended, omp_lock_hint_nonspeculative,
      	omp_lock_hint_speculative): New parameters.
      	(omp_init_lock_with_hint, omp_init_nest_lock_with_hint,
      	omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids,
      	omp_get_place_num, omp_get_partition_num_places,
      	omp_get_partition_place_nums, omp_get_initial_device,
      	omp_get_max_task_priority): New interfaces.
      	(omp_set_schedule, omp_get_schedule): Rename modifier argument
      	to chunk_size.
      	* omp_lib.h.in (omp_lock_hint_kind): New parameter.
      	(omp_lock_hint_none, omp_lock_hint_uncontended,
      	omp_lock_hint_contended, omp_lock_hint_nonspeculative,
      	omp_lock_hint_speculative): New parameters.
      	(omp_init_lock_with_hint, omp_init_nest_lock_with_hint,
      	omp_get_num_places, omp_get_place_num_procs, omp_get_place_proc_ids,
      	omp_get_place_num, omp_get_partition_num_places,
      	omp_get_partition_place_nums, omp_get_initial_device,
      	omp_get_max_task_priority): New functions and subroutines.
      	* ordered.c: Include stdarg.h and string.h.
      	(MAX_COLLAPSED_BITS): Define.
      	(gomp_doacross_init, GOMP_doacross_post, GOMP_doacross_wait,
      	gomp_doacross_ull_init, GOMP_doacross_ull_post,
      	GOMP_doacross_ull_wait): New functions.
      	* target.c: Include errno.h.
      	(resolve_device): If device is not initialized, call
      	gomp_init_device on it.
      	(gomp_map_lookup): New function.
      	(gomp_map_vars_existing): Add tgt_var argument, fill it in.
      	Don't bump refcount if REFCOUNT_INFINITY.  Handle
      	GOMP_MAP_ALWAYS_TO_P.
      	(get_kind): Rename is_openacc argument to short_mapkind.
      	(gomp_map_pointer): Use gomp_map_lookup.
      	(gomp_map_fields_existing): New function.
      	(gomp_map_vars): Rename is_openacc argument to short_mapkind
      	and is_target to pragma_kind.  Handle GOMP_MAP_VARS_ENTER_DATA,
      	handle GOMP_MAP_FIRSTPRIVATE_INT, GOMP_MAP_STRUCT,
      	GOMP_MAP_USE_DEVICE_PTR, GOMP_MAP_ZERO_LEN_ARRAY_SECTION.
      	Adjust for tgt->list changed type and copy_from living in there.
      	(gomp_copy_from_async): Adjust for tgt->list changed type and
      	copy_from living in there.
      	(gomp_unmap_vars): Likewise.
      	(gomp_update): Likewise.  Rename is_openacc argument to
      	short_mapkind.  Don't fail if object is not mapped.
      	(gomp_load_image_to_device): Initialize refcount to
      	REFCOUNT_INFINITY.
      	(gomp_target_fallback): New function.
      	(gomp_get_target_fn_addr): Likewise.
      	(GOMP_target): Adjust gomp_map_vars caller, use
      	gomp_get_target_fn_addr and gomp_target_fallback.
      	(GOMP_target_41): New function.
      	(gomp_target_data_fallback): New function.
      	(GOMP_target_data): Use it, adjust gomp_map_vars caller.
      	(GOMP_target_data_41): New function.
      	(GOMP_target_update): Adjust gomp_update caller.
      	(GOMP_target_update_41): New function.
      	(gomp_exit_data, GOMP_target_enter_exit_data,
      	gomp_target_task_fn, omp_target_alloc, omp_target_free,
      	omp_target_is_present, omp_target_memcpy,
      	omp_target_memcpy_rect_worker, omp_target_memcpy_rect,
      	omp_target_associate_ptr, omp_target_disassociate_ptr,
      	gomp_load_plugin_for_device): New functions.
      	* task.c: Include gomp-constants.h.  Include taskloop.c
      	twice to get GOMP_taskloop and GOMP_taskloop_ull definitions.
      	(gomp_task_handle_depend): New function.
      	(GOMP_task): Use it.  Add priority argument.  Use
      	gomp-constant.h constants instead of hardcoded numbers.
      	Rename GOMP_TASK_IFFALSE to GOMP_TASK_UNDEFERRED.
      	(gomp_create_target_task): New function.
      	(verify_children_queue, verify_taskgroup_queue,
      	verify_task_queue): New functions.
      	(gomp_task_run_pre): Call verify_*_queue functions.
      	If an upcoming tied task is about to leave the sibling or
      	taskgroup queues in an invalid state, adjust appropriately.
      	Remove taskgroup argument.  Add comments.
      	(gomp_task_run_post_handle_dependers): Add comments.
      	(gomp_task_run_post_remove_parent): Likewise.
      	(gomp_barrier_handle_tasks): Adjust gomp_task_run_pre caller.
      	(GOMP_taskwait): Likewise.  Add comments.
      	(gomp_task_maybe_wait_for_dependencies): Fix scheduling
      	problem such that the first non parent_depends_on task does not
      	end up at the end of the children queue.
      	(GOMP_taskgroup_start): Rename GOMP_TASK_IFFALSE to
      	GOMP_TASK_UNDEFERRED.
      	(GOMP_taskgroup_end): Adjust gomp_task_run_pre caller.
      	* taskloop.c: New file.
      	* testsuite/lib/libgomp.exp
      	(check_effective_target_offload_device_nonshared_as): New proc.
      	* testsuite/libgomp.c/affinity-2.c: New test.
      	* testsuite/libgomp.c/doacross-1.c: New test.
      	* testsuite/libgomp.c/doacross-2.c: New test.
      	* testsuite/libgomp.c/examples-4/declare_target-1.c (fib_wrapper):
      	Add map clause to target.
      	* testsuite/libgomp.c/examples-4/declare_target-4.c (accum): Likewise.
      	* testsuite/libgomp.c/examples-4/declare_target-5.c (accum): Likewise.
      	* testsuite/libgomp.c/examples-4/device-1.c (main): Likewise.
      	* testsuite/libgomp.c/examples-4/device-3.c (main): Likewise.
      	* testsuite/libgomp.c/examples-4/target_data-3.c (gramSchmidt):
      	Likewise.
      	* testsuite/libgomp.c/examples-4/teams-2.c (dotprod): Likewise.
      	* testsuite/libgomp.c/examples-4/teams-3.c (dotprod): Likewise.
      	* testsuite/libgomp.c/examples-4/teams-4.c (dotprod): Likewise.
      	* testsuite/libgomp.c/for-2.h (OMPTGT, OMPTO, OMPFROM): Define if
      	not defined.  Use those where needed.
      	* testsuite/libgomp.c/for-4.c: New test.
      	* testsuite/libgomp.c/for-5.c: New test.
      	* testsuite/libgomp.c/for-6.c: New test.
      	* testsuite/libgomp.c/linear-1.c: New test.
      	* testsuite/libgomp.c/ordered-4.c: New test.
      	* testsuite/libgomp.c/pr66199-2.c (f2): Adjust for linear clause
      	only allowed on the loop iterator.
      	* testsuite/libgomp.c/pr66199-3.c: New test.
      	* testsuite/libgomp.c/pr66199-4.c: New test.
      	* testsuite/libgomp.c/reduction-7.c: New test.
      	* testsuite/libgomp.c/reduction-8.c: New test.
      	* testsuite/libgomp.c/reduction-9.c: New test.
      	* testsuite/libgomp.c/reduction-10.c: New test.
      	* testsuite/libgomp.c/target-1.c (fn2, fn3, fn4): Add
      	map(tofrom:s).
      	* testsuite/libgomp.c/target-2.c (fn2, fn3, fn4): Likewise.
      	* testsuite/libgomp.c/target-7.c (foo): Add map(h) where needed.
      	* testsuite/libgomp.c/target-11.c: New test.
      	* testsuite/libgomp.c/target-12.c: New test.
      	* testsuite/libgomp.c/target-13.c: New test.
      	* testsuite/libgomp.c/target-14.c: New test.
      	* testsuite/libgomp.c/target-15.c: New test.
      	* testsuite/libgomp.c/target-16.c: New test.
      	* testsuite/libgomp.c/target-17.c: New test.
      	* testsuite/libgomp.c/target-18.c: New test.
      	* testsuite/libgomp.c/target-19.c: New test.
      	* testsuite/libgomp.c/target-20.c: New test.
      	* testsuite/libgomp.c/target-21.c: New test.
      	* testsuite/libgomp.c/target-22.c: New test.
      	* testsuite/libgomp.c/target-23.c: New test.
      	* testsuite/libgomp.c/target-24.c: New test.
      	* testsuite/libgomp.c/target-25.c: New test.
      	* testsuite/libgomp.c/target-26.c: New test.
      	* testsuite/libgomp.c/target-27.c: New test.
      	* testsuite/libgomp.c/taskloop-1.c: New test.
      	* testsuite/libgomp.c/taskloop-2.c: New test.
      	* testsuite/libgomp.c/taskloop-3.c: New test.
      	* testsuite/libgomp.c/taskloop-4.c: New test.
      	* testsuite/libgomp.c++/ctor-13.C: New test.
      	* testsuite/libgomp.c++/doacross-1.C: New test.
      	* testsuite/libgomp.c++/examples-4/declare_target-2.C:
      	Replace offload_device with offload_device_nonshared_as.
      	* testsuite/libgomp.c++/for-12.C: New test.
      	* testsuite/libgomp.c++/for-13.C: New test.
      	* testsuite/libgomp.c++/for-14.C: New test.
      	* testsuite/libgomp.c++/linear-1.C: New test.
      	* testsuite/libgomp.c++/member-1.C: New test.
      	* testsuite/libgomp.c++/member-2.C: New test.
      	* testsuite/libgomp.c++/member-3.C: New test.
      	* testsuite/libgomp.c++/member-4.C: New test.
      	* testsuite/libgomp.c++/member-5.C: New test.
      	* testsuite/libgomp.c++/ordered-1.C: New test.
      	* testsuite/libgomp.c++/reduction-5.C: New test.
      	* testsuite/libgomp.c++/reduction-6.C: New test.
      	* testsuite/libgomp.c++/reduction-7.C: New test.
      	* testsuite/libgomp.c++/reduction-8.C: New test.
      	* testsuite/libgomp.c++/reduction-9.C: New test.
      	* testsuite/libgomp.c++/reduction-10.C: New test.
      	* testsuite/libgomp.c++/reference-1.C: New test.
      	* testsuite/libgomp.c++/simd14.C: New test.
      	* testsuite/libgomp.c++/target-2.C (fn2): Add map(tofrom: s) clause.
      	* testsuite/libgomp.c++/target-5.C: New test.
      	* testsuite/libgomp.c++/target-6.C: New test.
      	* testsuite/libgomp.c++/target-7.C: New test.
      	* testsuite/libgomp.c++/target-8.C: New test.
      	* testsuite/libgomp.c++/target-9.C: New test.
      	* testsuite/libgomp.c++/target-10.C: New test.
      	* testsuite/libgomp.c++/target-11.C: New test.
      	* testsuite/libgomp.c++/target-12.C: New test.
      	* testsuite/libgomp.c++/taskloop-1.C: New test.
      	* testsuite/libgomp.c++/taskloop-2.C: New test.
      	* testsuite/libgomp.c++/taskloop-3.C: New test.
      	* testsuite/libgomp.c++/taskloop-4.C: New test.
      	* testsuite/libgomp.c++/taskloop-5.C: New test.
      	* testsuite/libgomp.c++/taskloop-6.C: New test.
      	* testsuite/libgomp.c++/taskloop-7.C: New test.
      	* testsuite/libgomp.c++/taskloop-8.C: New test.
      	* testsuite/libgomp.c++/taskloop-9.C: New test.
      	* testsuite/libgomp.fortran/affinity1.f90: New test.
      	* testsuite/libgomp.fortran/affinity2.f90: New test.
      liboffloadmic/
      2015-10-13  Ilya Verbin  <ilya.verbin@intel.com>
      
      	* plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_dev2dev): New
      	function.
      	* plugin/offload_target_main.cpp (__offload_target_tgt2tgt): New
      	static function, register it in liboffloadmic.
      
      From-SVN: r228777
      d9a6bd32
  33. Jan 10, 2015
    • Thomas Schwinge's avatar
      libgomp: Now known as the GNU Offloading and Multi Processing Runtime Library. · f1f3453e
      Thomas Schwinge authored
      
      	libgomp/
      	* configure.ac: Rename libgomp from "GNU OpenMP Runtime Library"
      	to "GNU Offloading and Multi Processing Runtime Library".  Change
      	all users.
      	* configure: Regenerate.
      	* libgomp.texi: Update.
      	gcc/
      	* doc/install.texi: Update for libgomp being renamed from "GNU
      	OpenMP Runtime Library" to "GNU Offloading and Multi Processing
      	Runtime Library".
      	* doc/sourcebuild.texi: Likewise.
      	gcc/fortran/
      	* gfortran.texi: Update for libgomp being renamed from "GNU OpenMP
      	Runtime Library" to "GNU Offloading and Multi Processing Runtime
      	Library".
      	* intrinsic.texi: Likewise.
      	libstdc++-v3/
      	* doc/xml/manual/parallel_mode.xml: Update for libgomp being
      	renamed from "GNU OpenMP Runtime Library" to "GNU Offloading and
      	Multi Processing Runtime Library".
      
      Co-Authored-By: default avatarDavid Malcolm <dmalcolm@redhat.com>
      Co-Authored-By: default avatarJulian Brown <julian@codesourcery.com>
      
      From-SVN: r219425
      f1f3453e
  34. Jan 05, 2015
  35. Aug 04, 2014
    • Jakub Jelinek's avatar
      task.c (GOMP_taskgroup_end): If taskgroup->num_children is not zero... · 3696163c
      Jakub Jelinek authored
      	* task.c (GOMP_taskgroup_end): If taskgroup->num_children
      	is not zero, but taskgroup->children is NULL and there are
      	any task->children, schedule those instead of waiting.
      	* testsuite/libgomp.c/depend-6.c: New test.
      	* testsuite/libgomp.c/depend-7.c: New test.
      	* testsuite/libgomp.c/depend-8.c: New test.
      	* testsuite/libgomp.c/depend-9.c: New test.
      	* testsuite/libgomp.c/depend-10.c: New test.
      
      From-SVN: r213592
      3696163c
  36. Aug 01, 2014
    • Jakub Jelinek's avatar
      libgomp.h (struct gomp_task_depend_entry): Add redundant_out field. · 0494285a
      Jakub Jelinek authored
      	* libgomp.h (struct gomp_task_depend_entry): Add redundant_out field.
      	(struct gomp_taskwait): New type.
      	(struct gomp_task): Add taskwait and parent_depends_on, remove
      	in_taskwait and taskwait_sem fields.
      	(gomp_finish_task): Don't destroy taskwait_sem.
      	* task.c (gomp_init_task): Don't init in_taskwait, instead init
      	taskwait and parent_depends_on.
      	(GOMP_task): For if (0) tasks with depend clause that depend on
      	earlier tasks don't defer them, instead call
      	gomp_task_maybe_wait_for_dependencies to wait for the dependencies.
      	Initialize redundant_out field, for redundant out entries just
      	move them at the end of linked list instead of removing them
      	completely, and set redundant_out flag instead of redundant.
      	(gomp_task_run_pre): Update last_parent_depends_on if scheduling
      	that task.
      	(gomp_task_run_post_handle_dependers): If parent is in
      	gomp_task_maybe_wait_for_dependencies and newly runnable task
      	is not parent_depends_on, queue it in parent->children linked
      	list after all runnable tasks with parent_depends_on set.
      	Adjust for addition of taskwait indirection.
      	(gomp_task_run_post_remove_parent): If parent is in
      	gomp_task_maybe_wait_for_dependencies and task to be removed
      	is parent_depends_on, decrement n_depend and if needed awake
      	parent.  Adjust for addition of taskwait indirection.
      	(GOMP_taskwait): Adjust for addition of taskwait indirection.
      	(gomp_task_maybe_wait_for_dependencies): New function.
      	* testsuite/libgomp.c/depend-5.c: New test.
      
      From-SVN: r213408
      0494285a
  37. Jan 02, 2014
  38. Oct 11, 2013
    • Jakub Jelinek's avatar
      target.c: New file. · acf0174b
      Jakub Jelinek authored
      
      libgomp/
      	* target.c: New file.
      	* Makefile.am (libgomp_la_SOURCES): Add target.c.
      	* Makefile.in: Regenerated.
      	* libgomp_g.h (GOMP_task): Add depend argument.
      	(GOMP_barrier_cancel, GOMP_loop_end_cancel,
      	GOMP_sections_end_cancel, GOMP_target, GOMP_target_data,
      	GOMP_target_end_data, GOMP_target_update, GOMP_teams,
      	GOMP_parallel_loop_static, GOMP_parallel_loop_dynamic,
      	GOMP_parallel_loop_guided, GOMP_parallel_loop_runtime,
      	GOMP_parallel, GOMP_cancel, GOMP_cancellation_point,
      	GOMP_taskgroup_start, GOMP_taskgroup_end,
      	GOMP_parallel_sections): New prototypes.
      	* fortran.c (omp_is_initial_device): Add ialias_redirect.
      	(omp_is_initial_device_): New function.
      	(ULP, STR1, STR2, ialias_redirect): Removed.
      	(omp_get_cancellation_, omp_get_proc_bind_, omp_set_default_device_,
      	omp_set_default_device_8_, omp_get_default_device_,
      	omp_get_num_devices_, omp_get_num_teams_, omp_get_team_num_): New
      	functions.
      	* libgomp.map (GOMP_barrier_cancel, GOMP_loop_end_cancel,
      	GOMP_sections_end_cancel, GOMP_target, GOMP_target_data,
      	GOMP_target_end_data, GOMP_target_update, GOMP_teams): Export
      	@@GOMP_4.0.
      	(omp_is_initial_device, omp_is_initial_device_, omp_get_cancellation,
      	omp_get_cancellation_, omp_get_proc_bind, omp_get_proc_bind_,
      	omp_set_default_device, omp_set_default_device_,
      	omp_set_default_device_8_, omp_get_default_device,
      	omp_get_default_device_, omp_get_num_devices, omp_get_num_devices_,
      	omp_get_num_teams, omp_get_num_teams_, omp_get_team_num,
      	omp_get_team_num_): Export @@OMP_4.0.
      	* team.c (struct gomp_thread_start_data): Add place field.
      	(gomp_thread_start): Clear thr->thread_pool and
      	thr->task before returning.  Use gomp_team_barrier_wait_final
      	instead of gomp_team_barrier_wait.  Initialize thr->place.
      	(gomp_new_team): Initialize work_shares_to_free, work_share_cancelled,
      	team_cancelled and task_queued_count fields.
      	(gomp_free_pool_helper): Clear thr->thread_pool and thr->task
      	before calling pthread_exit.
      	(gomp_free_thread): No longer static.  Use
      	gomp_managed_threads_lock instead of gomp_remaining_threads_lock.
      	(gomp_team_start): Add flags argument.  Set
      	thr->thread_pool->threads_busy to nthreads immediately after creating
      	new pool.  Use gomp_managed_threads_lock instead of
      	gomp_remaining_threads_lock.  Handle OpenMP 4.0 affinity.
      	(gomp_team_end): Use gomp_managed_threads_lock instead of
      	gomp_remaining_threads_lock.  Use gomp_team_barrier_wait_final instead
      	of gomp_team_barrier_wait.  If team->team_cancelled, call
      	gomp_fini_worshare on ws chain starting at team->work_shares_to_free
      	rather than thr->ts.work_share.
      	(initialize_team): Don't call gomp_sem_init here.
      	* sections.c (GOMP_parallel_sections_start): Adjust gomp_team_start
      	caller.
      	(GOMP_parallel_sections, GOMP_sections_end_cancel): New functions.
      	* env.c (gomp_global_icv): Add default_device_var, target_data and
      	bind_var initializers.
      	(gomp_cpu_affinity, gomp_cpu_affinity_len): Remove.
      	(gomp_bind_var_list, gomp_bind_var_list_len, gomp_places_list,
      	gomp_places_list_len): New variables.
      	(parse_bind_var, parse_one_place, parse_places_var): New functions.
      	(parse_affinity): Rewritten to construct OMP_PLACES list with unit
      	sized places.
      	(gomp_cancel_var): New global variable.
      	(parse_int): New function.
      	(handle_omp_display_env): New function.
      	(initialize_env): Use it.  Initialize default_device_var.
      	Parse OMP_CANCELLATION env var.  Use parse_bind_var to parse
      	OMP_PROC_BIND instead of parse_boolean.  Use parse_places_var for
      	OMP_PLACES parsing.  Don't call parse_affinity if OMP_PLACES has
      	been successfully parsed (and call gomp_init_affinity in that case).
      	(omp_get_cancellation, omp_get_proc_bind, omp_set_default_device,
      	omp_get_default_device, omp_get_num_devices, omp_get_num_teams,
      	omp_get_team_num, omp_is_initial_device): New functions.
      	* libgomp.h: Include stdlib.h.
      	(ialias_ulp, ialias_str1, ialias_str2, ialias_redirect, ialias_call):
      	Define.
      	(struct target_mem_desc): Forward declare.
      	(struct gomp_task_icv): Add default_device_var, target_data, bind_var
      	and thread_limit_var fields.
      	(gomp_get_num_devices): New prototype.
      	(gomp_cancel_var): New extern decl.
      	(struct gomp_team): Add work_shares_to_free, work_share_cancelled,
      	team_cancelled and task_queued_count fields.  Add comments about
      	task_{,queued_,running_}count.
      	(gomp_cancel_kind): New enum.
      	(gomp_work_share_end_cancel): New prototype.
      	(struct gomp_task): Add next_taskgroup, prev_taskgroup, taskgroup,
      	copy_ctors_done, dependers, depend_hash, depend_count, num_dependees
      	and depend fields.
      	(struct gomp_taskgroup): New type.
      	(struct gomp_task_depend_entry,
      	struct gomp_dependers_vec): New types.
      	(gomp_finish_task): Free depend_hash if non-NULL.
      	(struct gomp_team_state): Add place_partition_off
      	and place_partition_len fields.
      	(gomp_bind_var_list, gomp_bind_var_list_len, gomp_places_list,
      	gomp_places_list_len): New extern decls.
      	(struct gomp_thread): Add place field.
      	(gomp_cpu_affinity, gomp_cpu_affinity_len): Remove.
      	(gomp_init_thread_affinity): Add place argument.
      	(gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus,
      	gomp_affinity_remove_cpu, gomp_affinity_copy_place,
      	gomp_affinity_same_place, gomp_affinity_finalize_place_list,
      	gomp_affinity_init_level, gomp_affinity_print_place): New
      	prototypes.
      	(gomp_team_start): Add flags argument.
      	(gomp_thread_limit_var, gomp_remaining_threads_count,
      	gomp_remaining_threads_lock): Remove.
      	(gomp_managed_threads_lock): New variable.
      	(struct gomp_thread_pool): Add threads_busy field.
      	(gomp_free_thread): New prototype.
      	* task.c: Include hashtab.h.
      	(hash_entry_type): New typedef.
      	(htab_alloc, htab_free, htab_hash, htab_eq): New inlines.
      	(gomp_init_task): Clear dependers, depend_hash, depend_count,
      	copy_ctors_done and taskgroup fields.
      	(GOMP_task): Add depend argument, handle depend clauses.  If
      	gomp_team_barrier_cancelled or if it's taskgroup has been
      	cancelled, don't queue or start new tasks.  Set copy_ctors_done
      	field if needed.  Initialize taskgroup field.  If copy_ctors_done
      	and already cancelled, don't discard the task.  If taskgroup is
      	non-NULL, enqueue the task into taskgroup queue.  Increment
      	num_children field in taskgroup.  Increment task_queued_count.
      	(gomp_task_run_pre, gomp_task_run_post_remove_parent,
      	gomp_task_run_post_remove_taskgroup): New inline functions.
      	(gomp_task_run_post_handle_depend_hash,
      	gomp_task_run_post_handle_dependers,
      	gomp_task_run_post_handle_depend): New functions.
      	(GOMP_taskwait): Use them.  If more than one new tasks
      	have been queued, wake other threads if needed.
      	(gomp_barrier_handle_tasks): Likewise.  If
      	gomp_team_barrier_cancelled, don't start any new tasks, just free
      	all tasks.
      	(GOMP_taskgroup_start, GOMP_taskgroup_end): New functions.
      	* omp_lib.f90.in
      	(omp_proc_bind_kind, omp_proc_bind_false,
      	omp_proc_bind_true, omp_proc_bind_master, omp_proc_bind_close,
      	omp_proc_bind_spread): New params.
      	(omp_get_cancellation, omp_get_proc_bind, omp_set_default_device,
      	omp_get_default_device, omp_get_num_devices, omp_get_num_teams,
      	omp_get_team_num, omp_is_initial_device): New interfaces.
      	(omp_get_dynamic, omp_get_nested, omp_in_parallel,
      	omp_get_max_threads, omp_get_num_procs, omp_get_num_threads,
      	omp_get_thread_num, omp_get_thread_limit, omp_set_max_active_levels,
      	omp_get_max_active_levels, omp_get_level, omp_get_ancestor_thread_num,
      	omp_get_team_size, omp_get_active_level, omp_in_final): Remove
      	useless use omp_lib_kinds.
      	* omp.h.in (omp_proc_bind_t): New typedef.
      	(omp_get_cancellation, omp_get_proc_bind, omp_set_default_device,
      	omp_get_default_device, omp_get_num_devices, omp_get_num_teams,
      	omp_get_team_num, omp_is_initial_device): New prototypes.
      	* loop.c (gomp_parallel_loop_start): Add flags argument, pass it
      	through to gomp_team_start.
      	(GOMP_parallel_loop_static_start, GOMP_parallel_loop_dynamic_start,
      	GOMP_parallel_loop_guided_start, GOMP_parallel_loop_runtime_start):
      	Adjust gomp_parallel_loop_start callers.
      	(GOMP_parallel_loop_static, GOMP_parallel_loop_dynamic,
      	GOMP_parallel_loop_guided, GOMP_parallel_loop_runtime,
      	GOMP_loop_end_cancel): New functions.
      	(GOMP_parallel_end): Add ialias_redirect.
      	* hashtab.h: New file.
      	* libgomp.texi (Environment Variables): Minor cleanup,
      	update section refs to OpenMP 4.0rc2.
      	(OMP_DISPLAY_ENV, GOMP_SPINCOUNT): Document these
      	environment variables.
      	* work.c (gomp_work_share_end, gomp_work_share_end_nowait): Set
      	team->work_shares_to_free to thr->ts.work_share before calling
      	free_work_share.
      	(gomp_work_share_end_cancel): New function.
      	* config/linux/proc.c: Include errno.h.
      	(gomp_get_cpuset_size, gomp_cpuset_size, gomp_cpusetp): New variables.
      	(gomp_cpuset_popcount): Add cpusetsize argument, use it instead of
      	sizeof (cpu_set_t) to determine number of iterations.  Fix up check
      	extern decl.  Use CPU_COUNT_S if available, or CPU_COUNT if
      	gomp_cpuset_size is sizeof (cpu_set_t).
      	(gomp_init_num_threads): Initialize gomp_cpuset_size,
      	gomp_get_cpuset_size and gomp_cpusetp here, use gomp_cpusetp instead
      	of &cpuset and pass gomp_cpuset_size instead of sizeof (cpu_set_t)
      	to pthread_getaffinity_np.  Free and clear gomp_cpusetp if it didn't
      	contain any logical CPUs.
      	(get_num_procs): Don't call pthread_getaffinity_np if gomp_cpusetp
      	is NULL.  Use gomp_cpusetp instead of &cpuset and pass
      	gomp_get_cpuset_size instead of sizeof (cpu_set_t) to
      	pthread_getaffinity_np.  Check gomp_places_list instead of
      	gomp_cpu_affinity.  Adjust gomp_cpuset_popcount caller.
      	* config/linux/bar.c (gomp_barrier_wait_end,
      	gomp_barrier_wait_last): Use BAR_* defines.
      	(gomp_team_barrier_wait_end): Likewise.  Clear BAR_CANCELLED
      	from state where needed.  Set work_share_cancelled to 0 on last
      	thread.
      	(gomp_team_barrier_wait_final, gomp_team_barrier_wait_cancel_end,
      	gomp_team_barrier_wait_cancel, gomp_team_barrier_cancel): New
      	functions.
      	* config/linux/proc.h (gomp_cpuset_popcount): Add attribute_hidden.
      	Add cpusetsize argument.
      	(gomp_cpuset_size, gomp_cpusetp): Declare.
      	* config/linux/affinity.c: Include errno.h, stdio.h and string.h.
      	(affinity_counter): Remove.
      	(CPU_ISSET_S, CPU_ZERO_S, CPU_SET_S, CPU_CLR_S): Define
      	if CPU_ALLOC_SIZE isn't defined.
      	(gomp_init_affinity): Rewritten, if gomp_places_list is NULL, try
      	silently create OMP_PLACES=threads, if it is non-NULL afterwards,
      	bind current thread to the first place.
      	(gomp_init_thread_affinity): Rewritten.  Add place argument, just
      	pthread_setaffinity_np to gomp_places_list[place].
      	(gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus,
      	gomp_affinity_remove_cpu, gomp_affinity_copy_place,
      	gomp_affinity_same_place, gomp_affinity_finalize_place_list,
      	gomp_affinity_init_level, gomp_affinity_print_place): New functions.
      	* config/linux/bar.h (BAR_TASK_PENDING, BAR_WAS_LAST,
      	BAR_WAITING_FOR_TASK, BAR_INCR, BAR_CANCELLED): Define.
      	(gomp_barrier_t): Add awaited_final field.
      	(gomp_barrier_init): Initialize awaited_final field.
      	(gomp_team_barrier_wait_final, gomp_team_barrier_wait_cancel,
      	gomp_team_barrier_wait_cancel_end, gomp_team_barrier_cancel): New
      	prototypes.
      	(gomp_barrier_wait_start): Preserve BAR_CANCELLED bit.  Use BAR_*
      	defines.
      	(gomp_barrier_wait_cancel_start, gomp_team_barrier_wait_final_start,
      	gomp_team_barrier_cancelled): New inline functions.
      	(gomp_barrier_last_thread,
      	gomp_team_barrier_set_task_pending,
      	gomp_team_barrier_clear_task_pending,
      	gomp_team_barrier_set_waiting_for_tasks,
      	gomp_team_barrier_waiting_for_tasks,
      	gomp_team_barrier_done): Use BAR_* defines.
      	* config/posix/bar.c (gomp_barrier_init): Clear cancellable field.
      	(gomp_barrier_wait_end): Use BAR_* defines.
      	(gomp_team_barrier_wait_end): Clear BAR_CANCELLED from state.
      	Set work_share_cancelled to 0 on last thread, use __atomic_load_n.
      	Use BAR_* defines.
      	(gomp_team_barrier_wait_cancel_end, gomp_team_barrier_wait_cancel,
      	gomp_team_barrier_cancel): New functions.
      	* config/posix/affinity.c (gomp_init_thread_affinity): Add place
      	argument.
      	(gomp_affinity_alloc, gomp_affinity_init_place, gomp_affinity_add_cpus,
      	gomp_affinity_remove_cpu, gomp_affinity_copy_place,
      	gomp_affinity_same_place, gomp_affinity_finalize_place_list,
      	gomp_affinity_init_level, gomp_affinity_print_place): New stubs.
      	* config/posix/bar.h (BAR_TASK_PENDING, BAR_WAS_LAST,
      	BAR_WAITING_FOR_TASK, BAR_INCR, BAR_CANCELLED): Define.
      	(gomp_barrier_t): Add cancellable field.
      	(gomp_team_barrier_wait_cancel, gomp_team_barrier_wait_cancel_end,
      	gomp_team_barrier_cancel): New prototypes.
      	(gomp_barrier_wait_start): Preserve BAR_CANCELLED bit.
      	(gomp_barrier_wait_cancel_start, gomp_team_barrier_wait_final,
      	gomp_team_barrier_cancelled): New inline functions.
      	(gomp_barrier_wait_start, gomp_barrier_last_thread,
      	gomp_team_barrier_set_task_pending,
      	gomp_team_barrier_clear_task_pending,
      	gomp_team_barrier_set_waiting_for_tasks,
      	gomp_team_barrier_waiting_for_tasks,
      	gomp_team_barrier_done): Use BAR_* defines.
      	* barrier.c (GOMP_barrier_cancel): New function.
      	* omp_lib.h.in (omp_proc_bind_kind, omp_proc_bind_false,
      	omp_proc_bind_true, omp_proc_bind_master, omp_proc_bind_close,
      	omp_proc_bind_spread): New params.
      	(omp_get_cancellation, omp_get_proc_bind, omp_set_default_device,
      	omp_get_default_device, omp_get_num_devices, omp_get_num_teams,
      	omp_get_team_num, omp_is_initial_device): New externals.
      	* parallel.c (GOMP_parallel, GOMP_cancel, GOMP_cancellation_point):
      	New functions.
      	(gomp_resolve_num_threads): Adjust for thread_limit now being in
      	icv->thread_limit_var.  Use UINT_MAX instead of ULONG_MAX as
      	infinity.  If not nested, just return minimum of max_num_threads
      	and icv->thread_limit_var and if thr->thread_pool, set threads_busy
      	to the returned value.  Otherwise, don't update atomically
      	gomp_remaining_threads_count, but instead thr->thread_pool->threads_busy.
      	(GOMP_parallel_end): Adjust for thread_limit now being in
      	icv->thread_limit_var.  Use UINT_MAX instead of ULONG_MAX as
      	infinity.  Adjust threads_busy in the pool rather than
      	gomp_remaining_threads_count.  Remember team->nthreads and call
      	gomp_team_end before adjusting threads_busy, if not nested
      	afterwards, just set it to 1 non-atomically.  Add ialias.
      	(GOMP_parallel_start): Adjust gomp_team_start caller.
      	* testsuite/libgomp.c/atomic-14.c: Add parens to make it valid.
      	* testsuite/libgomp.c/affinity-1.c: New test.
      	* testsuite/libgomp.c/atomic-15.c: New test.
      	* testsuite/libgomp.c/atomic-16.c: New test.
      	* testsuite/libgomp.c/atomic-17.c: New test.
      	* testsuite/libgomp.c/cancel-for-1.c: New test.
      	* testsuite/libgomp.c/cancel-for-2.c: New test.
      	* testsuite/libgomp.c/cancel-parallel-1.c: New test.
      	* testsuite/libgomp.c/cancel-parallel-2.c: New test.
      	* testsuite/libgomp.c/cancel-parallel-3.c: New test.
      	* testsuite/libgomp.c/cancel-sections-1.c: New test.
      	* testsuite/libgomp.c/cancel-taskgroup-1.c: New test.
      	* testsuite/libgomp.c/cancel-taskgroup-2.c: New test.
      	* testsuite/libgomp.c/depend-1.c: New test.
      	* testsuite/libgomp.c/depend-2.c: New test.
      	* testsuite/libgomp.c/depend-3.c: New test.
      	* testsuite/libgomp.c/depend-4.c: New test.
      	* testsuite/libgomp.c/for-1.c: New test.
      	* testsuite/libgomp.c/for-1.h: New file.
      	* testsuite/libgomp.c/for-2.c: New test.
      	* testsuite/libgomp.c/for-2.h: New file.
      	* testsuite/libgomp.c/for-3.c: New test.
      	* testsuite/libgomp.c/pr58392.c: New test.
      	* testsuite/libgomp.c/simd-1.c: New test.
      	* testsuite/libgomp.c/simd-2.c: New test.
      	* testsuite/libgomp.c/simd-3.c: New test.
      	* testsuite/libgomp.c/simd-4.c: New test.
      	* testsuite/libgomp.c/simd-5.c: New test.
      	* testsuite/libgomp.c/simd-6.c: New test.
      	* testsuite/libgomp.c/target-1.c: New test.
      	* testsuite/libgomp.c/target-2.c: New test.
      	* testsuite/libgomp.c/target-3.c: New test.
      	* testsuite/libgomp.c/target-4.c: New test.
      	* testsuite/libgomp.c/target-5.c: New test.
      	* testsuite/libgomp.c/target-6.c: New test.
      	* testsuite/libgomp.c/target-7.c: New test.
      	* testsuite/libgomp.c/taskgroup-1.c: New test.
      	* testsuite/libgomp.c/thread-limit-1.c: New test.
      	* testsuite/libgomp.c/thread-limit-2.c: New test.
      	* testsuite/libgomp.c/thread-limit-3.c: New test.
      	* testsuite/libgomp.c/udr-1.c: New test.
      	* testsuite/libgomp.c/udr-2.c: New test.
      	* testsuite/libgomp.c/udr-3.c: New test.
      	* testsuite/libgomp.c++/affinity-1.C: New test.
      	* testsuite/libgomp.c++/atomic-10.C: New test.
      	* testsuite/libgomp.c++/atomic-11.C: New test.
      	* testsuite/libgomp.c++/atomic-12.C: New test.
      	* testsuite/libgomp.c++/atomic-13.C: New test.
      	* testsuite/libgomp.c++/atomic-14.C: New test.
      	* testsuite/libgomp.c++/atomic-15.C: New test.
      	* testsuite/libgomp.c++/cancel-for-1.C: New test.
      	* testsuite/libgomp.c++/cancel-for-2.C: New test.
      	* testsuite/libgomp.c++/cancel-parallel-1.C: New test.
      	* testsuite/libgomp.c++/cancel-parallel-2.C: New test.
      	* testsuite/libgomp.c++/cancel-parallel-3.C: New test.
      	* testsuite/libgomp.c++/cancel-sections-1.C: New test.
      	* testsuite/libgomp.c++/cancel-taskgroup-1.C: New test.
      	* testsuite/libgomp.c++/cancel-taskgroup-2.C: New test.
      	* testsuite/libgomp.c++/cancel-taskgroup-3.C: New test.
      	* testsuite/libgomp.c++/cancel-test.h: New file.
      	* testsuite/libgomp.c++/for-9.C: New test.
      	* testsuite/libgomp.c++/for-10.C: New test.
      	* testsuite/libgomp.c++/for-11.C: New test.
      	* testsuite/libgomp.c++/simd-1.C: New test.
      	* testsuite/libgomp.c++/simd-2.C: New test.
      	* testsuite/libgomp.c++/simd-3.C: New test.
      	* testsuite/libgomp.c++/simd-4.C: New test.
      	* testsuite/libgomp.c++/simd-5.C: New test.
      	* testsuite/libgomp.c++/simd-6.C: New test.
      	* testsuite/libgomp.c++/simd-7.C: New test.
      	* testsuite/libgomp.c++/simd-8.C: New test.
      	* testsuite/libgomp.c++/target-1.C: New test.
      	* testsuite/libgomp.c++/target-2.C: New test.
      	* testsuite/libgomp.c++/target-2-aux.cc: New file.
      	* testsuite/libgomp.c++/target-3.C: New test.
      	* testsuite/libgomp.c++/taskgroup-1.C: New test.
      	* testsuite/libgomp.c++/udr-1.C: New test.
      	* testsuite/libgomp.c++/udr-2.C: New test.
      	* testsuite/libgomp.c++/udr-3.C: New test.
      	* testsuite/libgomp.c++/udr-4.C: New test.
      	* testsuite/libgomp.c++/udr-5.C: New test.
      	* testsuite/libgomp.c++/udr-6.C: New test.
      	* testsuite/libgomp.c++/udr-7.C: New test.
      	* testsuite/libgomp.c++/udr-8.C: New test.
      	* testsuite/libgomp.c++/udr-9.C: New test.
      gcc/
      	* tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE__LOOPTEMP_
      	and new OpenMP 4.0 clauses, handle UDR OMP_CLAUSE_REDUCTION,
      	formatting fixes, use pp_colon instead of pp_character (..., ':'),
      	similarly pp_right_paren.
      	(dump_generic_node): Handle OMP_DISTRIBUTE, OMP_TEAMS,
      	OMP_TARGET_DATA, OMP_TARGET, OMP_TARGET_UPDATE, OMP_TASKGROUP,
      	allow OMP_FOR_INIT to be NULL, handle OMP_ATOMIC_SEQ_CST.
      	* tree.c (omp_clause_num_ops, omp_clause_code_name): Add OpenMP 4.0
      	clauses.
      	(omp_declare_simd_clauses_equal,
      	omp_remove_redundant_declare_simd_attrs): New functions.
      	(attribute_value_equal): Use omp_declare_simd_clauses_equal.
      	(walk_tree_1): Handle new OpenMP 4.0 clauses.
      	* tree.h (OMP_LOOP_CHECK): Define.
      	(OMP_FOR_BODY, OMP_FOR_CLAUSES, OMP_FOR_INIT, OMP_FOR_COND,
      	OMP_FOR_INCR, OMP_FOR_PRE_BODY): Use it.
      	(OMP_TASKGROUP_BODY, OMP_TEAMS_BODY, OMP_TEAMS_CLAUSES,
      	OMP_TARGET_DATA_BODY, OMP_TARGET_DATA_CLAUSES, OMP_TARGET_BODY,
      	OMP_TARGET_CLAUSES, OMP_TARGET_UPDATE_CLAUSES, OMP_CLAUSE_SIZE,
      	OMP_ATOMIC_SEQ_CST, OMP_CLAUSE_DEPEND_KIND, OMP_CLAUSE_MAP_KIND,
      	OMP_CLAUSE_MAP_ZERO_BIAS_ARRAY_SECTION, OMP_CLAUSE_PROC_BIND_KIND,
      	OMP_CLAUSE_REDUCTION_OMP_ORIG_REF, OMP_CLAUSE_ALIGNED_ALIGNMENT,
      	OMP_CLAUSE_NUM_TEAMS_EXPR, OMP_CLAUSE_THREAD_LIMIT_EXPR,
      	OMP_CLAUSE_DEVICE_ID, OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR,
      	OMP_CLAUSE_SIMDLEN_EXPR): Define.
      	(OMP_CLAUSE_DECL): Change range up to OMP_CLAUSE__LOOPTEMP_.
      	(omp_remove_redundant_declare_simd_attrs): New prototype.
      	* gimple.def (GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET,
      	GIMPLE_OMP_TEAMS): New codes.
      	(GIMPLE_OMP_RETURN): Use GSS_OMP_ATOMIC_STORE instead of GSS_BASE.
      	* omp-low.c (struct omp_context): Add cancel_label and cancellable
      	fields.
      	(target_nesting_level): New variable.
      	(extract_omp_for_data): Handle GF_OMP_FOR_KIND_DISTRIBUTE and
      	OMP_CLAUSE_DIST_SCHEDULE.  Don't fallback to library implementation
      	for collapse > 1 static schedule unless ordered.
      	(get_ws_args_for): Add par_stmt argument.  Handle combined loops.
      	(determine_parallel_type): Adjust get_ws_args_for caller.
      	(install_var_field): Handle mask & 4 for double indirection.
      	(scan_sharing_clauses): Ignore shared clause on teams construct.
      	Handle OMP_CLAUSE__LOOPTEMP_ and new OpenMP 4.0 clauses.
      	(create_omp_child_function): If inside target or declare target
      	constructs, set "omp declare target" attribute on the child
      	function.
      	(find_combined_for): New function.
      	(scan_omp_parallel): Handle combined loops.
      	(scan_omp_target, scan_omp_teams): New functions.
      	(check_omp_nesting_restrictions): Check new OpenMP 4.0 nesting
      	restrictions and set ctx->cancellable for cancellable constructs.
      	(scan_omp_1_stmt): Call check_omp_nesting_restrictions also on
      	selected builtin calls.  Handle GIMPLE_OMP_TASKGROUP,
      	GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS.
      	(build_omp_barrier): Add lhs argument, return gimple rather than
      	tree.
      	(omp_clause_aligned_alignment): New function.
      	(lower_rec_simd_input_clauses): Only call SET_DECL_VALUE_EXPR
      	on decls.
      	(lower_rec_input_clauses): Add FD argument.  Ignore shared clauses
      	on teams constructs.  Handle user defined reductions and new
      	OpenMP 4.0 clauses.
      	(lower_reduction_clauses): Don't set placeholder to address of ref
      	if it has already the right type.
      	(lower_send_clauses): Handle OMP_CLAUSE__LOOPTEMP_.
      	(expand_parallel_call): Use the new non-_start suffixed builtins,
      	handle OMP_CLAUSE_PROC_BIND, don't call the outlined function
      	and GOMP_parallel_end after the call.
      	(expand_task_call): Handle OMP_CLAUSE_DEPEND.
      	(expand_omp_for_init_counts): Handle combined loops.
      	(expand_omp_for_init_vars): Add inner_stmt argument, handle combined
      	loops.
      	(expand_omp_for_generic): Likewise.  Use GOMP_loop_end_cancel at the
      	end of cancellable loops.
      	(expand_omp_for_static_nochunk, expand_omp_for_static_chunk):
      	Likewise.  Handle collapse > 1 loops.
      	(expand_omp_simd): Handle combined loops.
      	(expand_omp_for): Add inner_stmt argument, adjust callers of
      	expand_omp_for* functions, use expand_omp_for_static*chunk even
      	for collapse > 1 unless ordered.
      	(expand_omp_sections): Use GOMP_sections_end_cancel at the end
      	of cancellable sections.
      	(expand_omp_single): Remove need_barrier variable, just rely on
      	gimple_omp_return_nowait_p.  Adjust build_omp_barrier caller.
      	(expand_omp_synch): Allow GIMPLE_OMP_TASKGROUP and GIMPLE_OMP_TEAMS.
      	(expand_omp_atomic_load, expand_omp_atomic_store,
      	expand_omp_atomic_fetch_op): Handle gimple_omp_atomic_seq_cst_p.
      	(expand_omp_target): New function.
      	(expand_omp): Handle combined loops.  Handle GIMPLE_OMP_TASKGROUP,
      	GIMPLE_OMP_TEAMS, GIMPLE_OMP_TARGET.
      	(build_omp_regions_1): Immediately close region for
      	GF_OMP_TARGET_KIND_UPDATE.
      	(maybe_add_implicit_barrier_cancel): New function.
      	(lower_omp_sections): Adjust lower_rec_input_clauses caller.  Handle
      	cancellation.
      	(lower_omp_single): Likewise.  Add clobber after the barrier.
      	(lower_omp_taskgroup): New function.
      	(lower_omp_for): Handle combined loops.  Adjust
      	lower_rec_input_clauses caller.  Handle cancellation.
      	(lower_depend_clauses): New function.
      	(lower_omp_taskreg): Lower depend clauses.  Adjust
      	lower_rec_input_clauses caller.  Add clobber after the call.  Handle
      	cancellation.
      	(lower_omp_target, lower_omp_teams): New functions.
      	(lower_omp_1): Handle cancellation.  Handle GIMPLE_OMP_TASKGROUP,
      	GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GOMP_barrier, GOMP_cancel
      	and GOMP_cancellation_point calls.
      	(lower_omp): Fold stmts inside of target region.
      	(diagnose_sb_1, diagnose_sb_2): Handle GIMPLE_OMP_TASKGROUP,
      	GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS.
      	* builtin-types.def (DEF_FUNCTION_TYPE_8): Document.
      	(BT_FN_VOID_OMPFN_PTR_UINT,
      	BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG,
      	BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG,
      	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): Remove.
      	(BT_FN_VOID_OMPFN_PTR_UINT_UINT_UINT,
      	BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT,
      	BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT,
      	BT_FN_BOOL_INT, BT_FN_BOOL_INT_BOOL, BT_FN_VOID_UINT_UINT,
      	BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR,
      	BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR,
      	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): New.
      	* tree-ssa-alias.c (ref_maybe_used_by_call_p_1,
      	call_may_clobber_ref_p_1): Handle BUILT_IN_GOMP_BARRIER_CANCEL,
      	BUILT_IN_GOMP_TASKGROUP_END, BUILT_IN_GOMP_LOOP_END_CANCEL,
      	BUILT_IN_GOMP_SECTIONS_END_CANCEL.  Don't handle
      	BUILT_IN_GOMP_PARALLEL_END.
      	* gimple-low.c (lower_stmt): Handle GIMPLE_OMP_TASKGROUP,
      	GIMPLE_OMP_TARGET and GIMPLE_OMP_TEAMS.
      	* gimple-pretty-print.c (dump_gimple_omp_for): Handle
      	GF_OMP_FOR_KIND_DISTRIBUTE.
      	(dump_gimple_omp_target, dump_gimple_omp_teams): New functions.
      	(dump_gimple_omp_block): Handle GIMPLE_OMP_TASKGROUP.
      	(dump_gimple_omp_return): Print lhs if it has any.
      	(dump_gimple_omp_atomic_load, dump_gimple_omp_atomic_store): Handle
      	gimple_omp_atomic_seq_cst_p.
      	(pp_gimple_stmt_1): Handle GIMPLE_OMP_TASKGROUP, GIMPLE_OMP_TARGET
      	and GIMPLE_OMP_TEAMS.
      	* langhooks.c (lhd_omp_mappable_type): New function.
      	* tree-vectorizer.c (struct simd_array_to_simduid): Fix up comment.
      	* langhooks.h (struct lang_hooks_for_types): Add omp_mappable_type
      	hook.
      	* gimplify.c (enum gimplify_omp_var_data): Add GOVD_MAP,
      	GOVD_ALIGNED and GOVD_MAP_TO_ONLY.
      	(enum omp_region_type): Add ORT_TEAMS, ORT_TARGET_DATA and
      	ORT_TARGET.
      	(struct gimplify_omp_ctx): Add combined_loop field.
      	(gimplify_call_expr, gimplify_modify_expr): Don't call fold_stmt
      	on stmts inside of target region.
      	(is_gimple_stmt): Return true for OMP_DISTRIBUTE and OMP_TASKGROUP.
      	(omp_firstprivatize_variable): Handle GOVD_MAP, GOVD_ALIGNED,
      	ORT_TARGET and ORT_TARGET_DATA.
      	(omp_add_variable): Avoid checks on readding var for GOVD_ALIGNED.
      	Handle GOVD_MAP.
      	(omp_notice_threadprivate_variable): Complain about threadprivate
      	variables in target region.
      	(omp_notice_variable): Complain about vars with non-mappable type
      	in target region.  Handle ORT_TEAMS, ORT_TARGET and ORT_TARGET_DATA.
      	(omp_check_private): Ignore ORT_TARGET* regions.
      	(gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses_1,
      	gimplify_adjust_omp_clauses): Handle new OpenMP 4.0 clauses.
      	(find_combined_omp_for): New function.
      	(gimplify_omp_for): Handle gimplification of combined loops.
      	(gimplify_omp_workshare): Gimplify also OMP_TARGET, OMP_TARGET_DATA,
      	OMP_TEAMS.
      	(gimplify_omp_target_update): New function.
      	(gimplify_omp_atomic): Handle OMP_ATOMIC_SEQ_CST.
      	(gimplify_expr): Handle OMP_DISTRIBUTE, OMP_TARGET, OMP_TARGET_DATA,
      	OMP_TARGET_UPDATE, OMP_TEAMS, OMP_TASKGROUP.
      	(gimplify_body): If fndecl has "omp declare target" attribute, add
      	implicit ORT_TARGET context around it.
      	* tree.def (OMP_DISTRIBUTE, OMP_TEAMS, OMP_TARGET_DATA, OMP_TARGET,
      	OMP_TASKGROUP, OMP_TARGET_UPDATE): New tree codes.
      	* tree-nested.c (convert_nonlocal_reference_stmt,
      	convert_local_reference_stmt, convert_gimple_call): Handle
      	GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP.
      	* omp-builtins.def (BUILT_IN_GOMP_TASK): Use
      	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR
      	instead of BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT.
      	(BUILT_IN_GOMP_TARGET, BUILT_IN_GOMP_TARGET_DATA,
      	BUILT_IN_GOMP_TARGET_END_DATA, BUILT_IN_GOMP_TARGET_UPDATE,
      	BUILT_IN_GOMP_TEAMS, BUILT_IN_BARRIER_CANCEL,
      	BUILT_IN_GOMP_LOOP_END_CANCEL,
      	BUILT_IN_GOMP_SECTIONS_END_CANCEL, BUILT_IN_OMP_GET_TEAM_NUM,
      	BUILT_IN_OMP_GET_NUM_TEAMS, BUILT_IN_GOMP_TASKGROUP_START,
      	BUILT_IN_GOMP_TASKGROUP_END, BUILT_IN_GOMP_PARALLEL_LOOP_STATIC,
      	BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC,
      	BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED,
      	BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME, BUILT_IN_GOMP_PARALLEL,
      	BUILT_IN_GOMP_PARALLEL_SECTIONS, BUILT_IN_GOMP_CANCEL,
      	BUILT_IN_GOMP_CANCELLATION_POINT): New built-ins.
      	(BUILT_IN_GOMP_PARALLEL_LOOP_STATIC_START,
      	BUILT_IN_GOMP_PARALLEL_LOOP_DYNAMIC_START,
      	BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED_START,
      	BUILT_IN_GOMP_PARALLEL_LOOP_RUNTIME_START,
      	BUILT_IN_GOMP_PARALLEL_START, BUILT_IN_GOMP_PARALLEL_END,
      	BUILT_IN_GOMP_PARALLEL_SECTIONS_START): Remove.
      	* tree-inline.c (remap_gimple_stmt, estimate_num_insns):
      	Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP.
      	* gimple.c (gimple_build_omp_taskgroup, gimple_build_omp_target,
      	gimple_build_omp_teams): New functions.
      	(walk_gimple_op): Handle GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS and
      	GIMPLE_OMP_TASKGROUP.  Walk optional lhs on GIMPLE_OMP_RETURN.
      	(walk_gimple_stmt, gimple_copy): Handle GIMPLE_OMP_TARGET,
      	GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP.
      	* gimple.h (enum gf_mask): GF_OMP_FOR_KIND_DISTRIBUTE,
      	GF_OMP_FOR_COMBINED, GF_OMP_FOR_COMBINED_INTO,
      	GF_OMP_TARGET_KIND_MASK, GF_OMP_TARGET_KIND_REGION,
      	GF_OMP_TARGET_KIND_DATA, GF_OMP_TARGET_KIND_UPDATE,
      	GF_OMP_ATOMIC_SEQ_CST): New.
      	(gimple_build_omp_taskgroup, gimple_build_omp_target,
      	gimple_build_omp_teams): New prototypes.
      	(gimple_has_substatements): Handle GIMPLE_OMP_TARGET,
      	GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP.
      	(gimple_omp_subcode): Use GIMPLE_OMP_TEAMS instead of
      	GIMPLE_OMP_SINGLE as end of range.
      	(gimple_omp_return_set_lhs, gimple_omp_return_lhs,
      	gimple_omp_return_lhs_ptr, gimple_omp_atomic_seq_cst_p,
      	gimple_omp_atomic_set_seq_cst, gimple_omp_for_combined_p,
      	gimple_omp_for_set_combined_p, gimple_omp_for_combined_into_p,
      	gimple_omp_for_set_combined_into_p, gimple_omp_target_clauses,
      	gimple_omp_target_clauses_ptr, gimple_omp_target_set_clauses,
      	gimple_omp_target_kind, gimple_omp_target_set_kind,
      	gimple_omp_target_child_fn, gimple_omp_target_child_fn_ptr,
      	gimple_omp_target_set_child_fn, gimple_omp_target_data_arg,
      	gimple_omp_target_data_arg_ptr, gimple_omp_target_set_data_arg,
      	gimple_omp_teams_clauses, gimple_omp_teams_clauses_ptr,
      	gimple_omp_teams_set_clauses): New inlines.
      	(CASE_GIMPLE_OMP): Add GIMPLE_OMP_TARGET, GIMPLE_OMP_TEAMS
      	and GIMPLE_OMP_TASKGROUP.
      	* tree-core.h (enum omp_clause_code): Add new OpenMP 4.0 clause
      	codes.
      	(enum omp_clause_depend_kind, enum omp_clause_map_kind,
      	enum omp_clause_proc_bind_kind): New.
      	(union omp_clause_subcode): Add depend_kind, map_kind and
      	proc_bind_kind fields.
      	* tree-cfg.c (make_edges): Handle GIMPLE_OMP_TARGET,
      	GIMPLE_OMP_TEAMS and GIMPLE_OMP_TASKGROUP.
      	* langhooks-def.h (lhd_omp_mappable_type): New prototype.
      	(LANG_HOOKS_OMP_MAPPABLE_TYPE): Define.
      	(LANG_HOOKS_FOR_TYPES_INITIALIZER): Add it.
      gcc/c-family/
      	* c-cppbuiltin.c (c_cpp_builtins): Predefine _OPENMP to
      	201307 instead of 201107.
      	* c-common.c (DEF_FUNCTION_TYPE_8): Define.
      	(c_common_attribute_table): Add "omp declare target" and
      	"omp declare simd" attributes.
      	(handle_omp_declare_target_attribute,
      	handle_omp_declare_simd_attribute): New functions.
      	* c-omp.c: Include c-pragma.h.
      	(c_finish_omp_taskgroup): New function.
      	(c_finish_omp_atomic): Add swapped argument, if true,
      	build the operation first with rhs, lhs arguments and use NOP_EXPR
      	build_modify_expr.
      	(c_finish_omp_for): Add code argument, pass it down to make_code.
      	(c_omp_split_clauses): New function.
      	(c_split_parallel_clauses): Removed.
      	(c_omp_declare_simd_clause_cmp, c_omp_declare_simd_clauses_to_numbers,
      	c_omp_declare_simd_clauses_to_decls): New functions.
      	* c-common.h (omp_clause_mask): New type.
      	(OMP_CLAUSE_MASK_1): Define.
      	(omp_clause_mask::omp_clause_mask, omp_clause_mask::operator &=,
      	omp_clause_mask::operator |=, omp_clause_mask::operator ~,
      	omp_clause_mask::operator |, omp_clause_mask::operator &,
      	omp_clause_mask::operator <<, omp_clause_mask::operator >>,
      	omp_clause_mask::operator ==): New methods.
      	(enum c_omp_clause_split): New.
      	(c_finish_omp_taskgroup): New prototype.
      	(c_finish_omp_atomic): Add swapped argument.
      	(c_finish_omp_for): Add code argument.
      	(c_omp_split_clauses): New prototype.
      	(c_split_parallel_clauses): Removed.
      	(c_omp_declare_simd_clauses_to_numbers,
      	c_omp_declare_simd_clauses_to_decls): New prototypes.
      	* c-pragma.c (omp_pragmas): Add new OpenMP 4.0 constructs.
      	* c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_CANCEL,
      	PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_DECLARE_REDUCTION,
      	PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_END_DECLARE_TARGET, PRAGMA_OMP_SIMD,
      	PRAGMA_OMP_TARGET, PRAGMA_OMP_TASKGROUP and PRAGMA_OMP_TEAMS.
      	Remove PRAGMA_OMP_PARALLEL_FOR and PRAGMA_OMP_PARALLEL_SECTIONS.
      	(enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_ALIGNED,
      	PRAGMA_OMP_CLAUSE_DEPEND, PRAGMA_OMP_CLAUSE_DEVICE,
      	PRAGMA_OMP_CLAUSE_DIST_SCHEDULE, PRAGMA_OMP_CLAUSE_FOR,
      	PRAGMA_OMP_CLAUSE_FROM, PRAGMA_OMP_CLAUSE_INBRANCH,
      	PRAGMA_OMP_CLAUSE_LINEAR, PRAGMA_OMP_CLAUSE_MAP,
      	PRAGMA_OMP_CLAUSE_NOTINBRANCH, PRAGMA_OMP_CLAUSE_NUM_TEAMS,
      	PRAGMA_OMP_CLAUSE_PARALLEL, PRAGMA_OMP_CLAUSE_PROC_BIND,
      	PRAGMA_OMP_CLAUSE_SAFELEN, PRAGMA_OMP_CLAUSE_SECTIONS,
      	PRAGMA_OMP_CLAUSE_SIMDLEN, PRAGMA_OMP_CLAUSE_TASKGROUP,
      	PRAGMA_OMP_CLAUSE_THREAD_LIMIT, PRAGMA_OMP_CLAUSE_TO and
      	PRAGMA_OMP_CLAUSE_UNIFORM.
      gcc/ada/
      	* gcc-interface/utils.c (DEF_FUNCTION_TYPE_8): Define.
      gcc/fortran/
      	* trans-openmp.c (gfc_omp_clause_default_ctor,
      	gfc_omp_clause_dtor): Return NULL for OMP_CLAUSE_REDUCTION.
      	* f95-lang.c (ATTR_NULL, DEF_FUNCTION_TYPE_8): Define.
      	* types.def (DEF_FUNCTION_TYPE_8): Document.
      	(BT_FN_VOID_OMPFN_PTR_UINT,
      	BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG,
      	BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG,
      	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT): Remove.
      	(BT_FN_VOID_OMPFN_PTR_UINT_UINT_UINT,
      	BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_UINT,
      	BT_FN_VOID_OMPFN_PTR_UINT_LONG_LONG_LONG_LONG_UINT,
      	BT_FN_BOOL_INT, BT_FN_BOOL_INT_BOOL, BT_FN_VOID_UINT_UINT,
      	BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR,
      	BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR,
      	BT_FN_VOID_OMPFN_PTR_OMPCPYFN_LONG_LONG_BOOL_UINT_PTR): New.
      gcc/lto/
      	* lto-lang.c (DEF_FUNCTION_TYPE_8): Define.
      gcc/c/
      	* c-lang.h (current_omp_declare_target_attribute): New extern
      	decl.
      	* c-parser.c: Include c-lang.h.
      	(struct c_parser): Change tokens to c_token *.
      	Add tokens_buf field.  Change tokens_avail type to unsigned int.
      	(c_parser_consume_token): If parser->tokens isn't
      	&parser->tokens_buf[0], increment parser->tokens.
      	(c_parser_consume_pragma): Likewise.
      	(enum pragma_context): Add pragma_struct and pragma_param.
      	(c_parser_external_declaration): Adjust
      	c_parser_declaration_or_fndef caller.
      	(c_parser_declaration_or_fndef): Add omp_declare_simd_clauses
      	argument, if it is non-vNULL vector, call c_finish_omp_declare_simd.
      	Adjust recursive call.
      	(c_parser_struct_or_union_specifier): Use pragma_struct instead
      	of pragma_external.
      	(c_parser_parameter_declaration): Use pragma_param instead of
      	pragma_external.
      	(c_parser_compound_statement_nostart, c_parser_label,
      	c_parser_for_statement): Adjust
      	c_parser_declaration_or_fndef callers.
      	(c_parser_expr_no_commas): Add omp_atomic_lhs argument, pass
      	it through to c_parser_conditional_expression.
      	(c_parser_conditional_expression): Add omp_atomic_lhs argument,
      	pass it through to c_parser_binary_expression.  Adjust recursive
      	call.
      	(c_parser_binary_expression): Remove prec argument, add
      	omp_atomic_lhs argument instead.  Always start from PREC_NONE, if
      	omp_atomic_lhs is non-NULL and one of the arguments of toplevel
      	binop matches it, use build2 instead of parser_build_binary_op.
      	(c_parser_pragma): Handle PRAGMA_OMP_CANCEL,
      	PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_TARGET,
      	PRAGMA_OMP_END_DECLARE_TARGET, PRAGMA_OMP_DECLARE_REDUCTION.
      	Handle pragma_struct and pragma_param the same as pragma_external.
      	(c_parser_omp_clause_name): Parse new OpenMP 4.0 clause names.
      	(c_parser_omp_variable_list): Parse array sections for
      	OMP_CLAUSE_{DEPEND,MAP,TO,FROM} clauses.
      	(c_parser_omp_clause_collapse): Fully fold collapse expression.
      	(c_parser_omp_clause_reduction): Handle user defined reductions.
      	(c_parser_omp_clause_branch, c_parser_omp_clause_cancelkind,
      	c_parser_omp_clause_num_teams, c_parser_omp_clause_thread_limit,
      	c_parser_omp_clause_aligned, c_parser_omp_clause_linear,
      	c_parser_omp_clause_safelen, c_parser_omp_clause_simdlen,
      	c_parser_omp_clause_depend, c_parser_omp_clause_map,
      	c_parser_omp_clause_device, c_parser_omp_clause_dist_schedule,
      	c_parser_omp_clause_proc_bind, c_parser_omp_clause_to,
      	c_parser_omp_clause_from, c_parser_omp_clause_uniform): New functions.
      	(c_parser_omp_all_clauses): Add finish_p argument.  Don't call
      	c_finish_omp_clauses if it is false.  Handle new OpenMP 4.0 clauses.
      	(c_parser_omp_atomic): Parse seq_cst clause, pass true if it is
      	present to c_finish_omp_atomic.  Handle OpenMP 4.0 atomic forms.
      	(c_parser_omp_for_loop): Add CODE argument, pass it through
      	to c_finish_omp_for.  Change last argument to cclauses,
      	and adjust uses to grab parallel clauses from the array of all
      	the split clauses.  Adjust c_parser_binary_expression,
      	c_parser_declaration_or_fndef and c_finish_omp_for callers.
      	(omp_split_clauses): New function.
      	(c_parser_omp_simd): New function.
      	(c_parser_omp_for): Add p_name, mask and cclauses arguments.
      	Allow the function to be called also when parsing combined constructs,
      	and call c_parser_omp_simd when parsing for simd.
      	(c_parser_omp_sections_scope): If section-sequence doesn't start with
      	#pragma omp section, require exactly one structured-block instead of
      	sequence of statements.
      	(c_parser_omp_sections): Add p_name, mask and cclauses arguments.
      	Allow the function to be called also when parsing combined constructs.
      	(c_parser_omp_parallel): Add p_name, mask and cclauses arguments.
      	Allow the function to be called also when parsing combined
      	constructs.
      	(c_parser_omp_taskgroup, c_parser_omp_cancel,
      	c_parser_omp_cancellation_point, c_parser_omp_distribute,
      	c_parser_omp_teams, c_parser_omp_target_data,
      	c_parser_omp_target_update, c_parser_omp_target,
      	c_parser_omp_declare_simd, c_finish_omp_declare_simd,
      	c_parser_omp_declare_target, c_parser_omp_end_declare_target,
      	c_parser_omp_declare_reduction, c_parser_omp_declare): New functions.
      	(c_parser_omp_construct): Add p_name and mask vars.  Handle
      	PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP,
      	PRAGMA_OMP_TEAMS.  Adjust c_parser_omp_for, c_parser_omp_parallel
      	and c_parser_omp_sections callers.
      	(c_parse_file): Initialize tparser.tokens and the_parser->tokens here.
      	(OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK,
      	OMP_SINGLE_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1.
      	(OMP_PARALLEL_CLAUSE_MASK): Likewise.  Add OMP_CLAUSE_PROC_BIND.
      	(OMP_TASK_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1.  Add
      	OMP_CLAUSE_DEPEND.
      	(OMP_SIMD_CLAUSE_MASK, OMP_CANCEL_CLAUSE_MASK,
      	OMP_CANCELLATION_POINT_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK,
      	OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_DATA_CLAUSE_MASK,
      	OMP_TARGET_UPDATE_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK,
      	OMP_DECLARE_SIMD_CLAUSE_MASK): Define.
      	* c-typeck.c: Include tree-inline.h.
      	(c_finish_omp_cancel, c_finish_omp_cancellation_point,
      	handle_omp_array_sections_1, handle_omp_array_sections,
      	c_clone_omp_udr, c_find_omp_placeholder_r): New functions.
      	(c_finish_omp_clauses): Handle new OpenMP 4.0 clauses and
      	user defined reductions.
      	(c_tree_equal): New function.
      	* c-tree.h (temp_store_parm_decls, temp_pop_parm_decls,
      	c_finish_omp_cancel, c_finish_omp_cancellation_point, c_tree_equal,
      	c_omp_reduction_id, c_omp_reduction_decl, c_omp_reduction_lookup,
      	c_check_omp_declare_reduction_r): New prototypes.
      	* c-decl.c (current_omp_declare_target_attribute): New variable.
      	(c_decl_attributes): New function.
      	(start_decl, start_function): Use it instead of decl_attributes.
      	(temp_store_parm_decls, temp_pop_parm_decls, c_omp_reduction_id,
      	c_omp_reduction_decl, c_omp_reduction_lookup,
      	c_check_omp_declare_reduction_r): New functions.
      gcc/cp/
      	* decl.c (duplicate_decls): Error out for redeclaration of UDRs.
      	(declare_simd_adjust_this): New function.
      	(grokfndecl): If "omp declare simd" attribute is present,
      	call declare_simd_adjust_this if needed and
      	c_omp_declare_simd_clauses_to_numbers.
      	* cp-array-notation.c (expand_array_notation_exprs): Handle
      	OMP_TASKGROUP.
      	* cp-gimplify.c (cp_gimplify_expr): Handle OMP_SIMD and
      	OMP_DISTRIBUTE.  Handle is_invisiref_parm decls in
      	OMP_CLAUSE_REDUCTION.
      	(cp_genericize_r): Handle OMP_SIMD and OMP_DISTRIBUTE like
      	OMP_FOR.
      	(cxx_omp_privatize_by_reference): Return true for
      	is_invisiref_parm decls.
      	(cxx_omp_finish_clause): Adjust cxx_omp_create_clause_info
      	caller.
      	* pt.c (apply_late_template_attributes): For "omp declare simd"
      	attribute call tsubst_omp_clauses,
      	c_omp_declare_simd_clauses_to_decls, finish_omp_clauses
      	and c_omp_declare_simd_clauses_to_numbers.
      	(instantiate_class_template_1): Call cp_check_omp_declare_reduction
      	for UDRs.
      	(tsubst_decl): Handle UDRs.
      	(tsubst_omp_clauses): Add declare_simd argument, if true don't
      	call finish_omp_clauses.  Handle new OpenMP 4.0 clauses.
      	Handle non-NULL OMP_CLAUSE_REDUCTION_PLACEHOLDER on
      	OMP_CLAUSE_REDUCTION.
      	(tsubst_expr): For UDRs call pushdecl and
      	cp_check_omp_declare_reduction.  Adjust tsubst_omp_clauses
      	callers.  Handle OMP_SIMD, OMP_DISTRIBUTE, OMP_TEAMS,
      	OMP_TARGET_DATA, OMP_TARGET_UPDATE, OMP_TARGET, OMP_TASKGROUP.
      	Adjust finish_omp_atomic caller.
      	(tsubst_omp_udr): New function.
      	(instantiate_decl): For UDRs at block scope, don't call
      	start_preparsed_function/finish_function.  Call tsubst_omp_udr.
      	* semantics.c (cxx_omp_create_clause_info): Add need_dtor argument,
      	use it instead of need_default_ctor || need_copy_ctor.
      	(struct cp_check_omp_declare_reduction_data): New type.
      	(handle_omp_array_sections_1, handle_omp_array_sections,
      	omp_reduction_id, omp_reduction_lookup,
      	cp_remove_omp_priv_cleanup_stmt, cp_check_omp_declare_reduction_r,
      	cp_check_omp_declare_reduction, clone_omp_udr,
      	find_omp_placeholder_r, finish_omp_reduction_clause): New functions.
      	(finish_omp_clauses): Handle new OpenMP 4.0 clauses and user defined
      	reductions.
      	(finish_omp_for): Add CODE argument, use it instead of hardcoded
      	OMP_FOR.  Adjust c_finish_omp_for caller.
      	(finish_omp_atomic): Add seq_cst argument, adjust
      	c_finish_omp_atomic callers, handle seq_cst and new OpenMP 4.0
      	atomic variants.
      	(finish_omp_cancel, finish_omp_cancellation_point): New functions.
      	* decl2.c (mark_used): Force immediate instantiation of
      	DECL_OMP_DECLARE_REDUCTION_P decls.
      	(is_late_template_attribute): Return true for "omp declare simd"
      	attribute.
      	(cp_omp_mappable_type): New function.
      	(cplus_decl_attributes): Add implicit "omp declare target" attribute
      	if requested.
      	* parser.c (cp_debug_parser): Print
      	parser->colon_doesnt_start_class_def_p.
      	(cp_ensure_no_omp_declare_simd, cp_finalize_omp_declare_simd): New
      	functions.
      	(enum pragma_context): Add pragma_member and pragma_objc_icode.
      	(cp_parser_binary_expression): Handle no_toplevel_fold_p
      	even for binary operations other than comparison.
      	(cp_parser_linkage_specification): Call
      	cp_ensure_no_omp_declare_simd if needed.
      	(cp_parser_namespace_definition): Likewise.
      	(cp_parser_init_declarator): Call cp_finalize_omp_declare_simd.
      	(cp_parser_direct_declarator): Pass declarator to
      	cp_parser_late_return_type_opt.
      	(cp_parser_late_return_type_opt): Add declarator argument,
      	call cp_parser_late_parsing_omp_declare_simd for declare simd.
      	(cp_parser_class_specifier_1): Call cp_ensure_no_omp_declare_simd.
      	Parse UDRs before all other methods.
      	(cp_parser_member_specification_opt): Use pragma_member instead of
      	pragma_external.
      	(cp_parser_member_declaration): Call cp_finalize_omp_declare_simd.
      	(cp_parser_function_definition_from_specifiers_and_declarator,
      	cp_parser_save_member_function_body): Likewise.
      	(cp_parser_late_parsing_for_member): Handle UDRs specially.
      	(cp_parser_next_token_starts_class_definition_p): Don't allow
      	CPP_COLON if colon_doesnt_start_class_def_p flag is true.
      	(cp_parser_objc_interstitial_code): Use pragma_objc_icode
      	instead of pragma_external.
      	(cp_parser_omp_clause_name): Parse new OpenMP 4.0 clause names.
      	(cp_parser_omp_var_list_no_open): Parse array sections for
      	OMP_CLAUSE_{DEPEND,MAP,TO,FROM} clauses.  Add COLON argument,
      	if non-NULL, allow parsing to end with a colon rather than close
      	paren.
      	(cp_parser_omp_var_list): Adjust cp_parser_omp_var_list_no_open
      	caller.
      	(cp_parser_omp_clause_reduction): Handle user defined reductions.
      	(cp_parser_omp_clause_branch, cp_parser_omp_clause_cancelkind,
      	cp_parser_omp_clause_num_teams, cp_parser_omp_clause_thread_limit,
      	cp_parser_omp_clause_aligned, cp_parser_omp_clause_linear,
      	cp_parser_omp_clause_safelen, cp_parser_omp_clause_simdlen,
      	cp_parser_omp_clause_depend, cp_parser_omp_clause_map,
      	cp_parser_omp_clause_device, cp_parser_omp_clause_dist_schedule,
      	cp_parser_omp_clause_proc_bind, cp_parser_omp_clause_to,
      	cp_parser_omp_clause_from, cp_parser_omp_clause_uniform): New
      	functions.
      	(cp_parser_omp_all_clauses): Add finish_p argument.  Don't call
      	finish_omp_clauses if it is false.  Handle new OpenMP 4.0 clauses.
      	(cp_parser_omp_atomic): Parse seq_cst clause, pass
      	true if it is present to finish_omp_atomic.  Handle new OpenMP 4.0
      	atomic forms.
      	(cp_parser_omp_for_loop): Add CODE argument, pass it through
      	to finish_omp_for.  Change last argument to cclauses,
      	and adjust uses to grab parallel clauses from the array of all
      	the split clauses.
      	(cp_omp_split_clauses): New function.
      	(cp_parser_omp_simd): New function.
      	(cp_parser_omp_for): Add p_name, mask and cclauses arguments.
      	Allow the function to be called also when parsing combined constructs,
      	and call c_parser_omp_simd when parsing for simd.
      	(cp_parser_omp_sections_scope): If section-sequence doesn't start with
      	#pragma omp section, require exactly one structured-block instead of
      	sequence of statements.
      	(cp_parser_omp_sections): Add p_name, mask and cclauses arguments.
      	Allow the function to be called also when parsing combined constructs.
      	(cp_parser_omp_parallel): Add p_name, mask and cclauses arguments.
      	Allow the function to be called also when parsing combined
      	constructs.
      	(cp_parser_omp_taskgroup, cp_parser_omp_cancel,
      	cp_parser_omp_cancellation_point, cp_parser_omp_distribute,
      	cp_parser_omp_teams, cp_parser_omp_target_data,
      	cp_parser_omp_target_update, cp_parser_omp_target,
      	cp_parser_omp_declare_simd, cp_parser_late_parsing_omp_declare_simd,
      	cp_parser_omp_declare_target, cp_parser_omp_end_declare_target,
      	cp_parser_omp_declare_reduction_exprs, cp_parser_omp_declare_reduction,
      	cp_parser_omp_declare): New functions.
      	(cp_parser_omp_construct): Add p_name and mask vars.  Handle
      	PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP,
      	PRAGMA_OMP_TEAMS.  Adjust cp_parser_omp_for, cp_parser_omp_parallel
      	and cp_parser_omp_sections callers.
      	(cp_parser_pragma): Handle PRAGMA_OMP_CANCEL,
      	PRAGMA_OMP_CANCELLATION_POINT, PRAGMA_OMP_DECLARE_REDUCTION,
      	PRAGMA_OMP_DISTRIBUTE, PRAGMA_OMP_SIMD, PRAGMA_OMP_TASKGROUP,
      	PRAGMA_OMP_TEAMS, PRAGMA_OMP_TARGET, PRAGMA_OMP_END_DECLARE_TARGET.
      	Handle pragma_member and pragma_objc_icode like pragma_external.
      	(OMP_FOR_CLAUSE_MASK, OMP_SECTIONS_CLAUSE_MASK,
      	OMP_SINGLE_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1.
      	(OMP_PARALLEL_CLAUSE_MASK): Likewise.  Add OMP_CLAUSE_PROC_BIND.
      	(OMP_TASK_CLAUSE_MASK): Use OMP_CLAUSE_MASK_1 instead of 1.  Add
      	OMP_CLAUSE_DEPEND.
      	(OMP_SIMD_CLAUSE_MASK, OMP_CANCEL_CLAUSE_MASK,
      	OMP_CANCELLATION_POINT_CLAUSE_MASK, OMP_DISTRIBUTE_CLAUSE_MASK,
      	OMP_TEAMS_CLAUSE_MASK, OMP_TARGET_DATA_CLAUSE_MASK,
      	OMP_TARGET_UPDATE_CLAUSE_MASK, OMP_TARGET_CLAUSE_MASK,
      	OMP_DECLARE_SIMD_CLAUSE_MASK): Define.
      	* parser.h (struct cp_omp_declare_simd_data): New type.
      	(struct cp_parser): Add colon_doesnt_start_class_def_p and
      	omp_declare_simd fields.
      	* cp-objcp-common.h (LANG_HOOKS_OMP_MAPPABLE_TYPE): Define.
      	* cp-tree.h (struct lang_decl_fn): Add omp_declare_reduction_p
      	bit.
      	(DECL_OMP_DECLARE_REDUCTION_P): Define.
      	(OMP_FOR_GIMPLIFYING_P): Use OMP_LOOP_CHECK macro.
      	(struct saved_scope): Add omp_declare_target_attribute field.
      	(cp_omp_mappable_type, omp_reduction_id,
      	cp_remove_omp_priv_cleanup_stmt, cp_check_omp_declare_reduction,
      	finish_omp_cancel, finish_omp_cancellation_point): New prototypes.
      	(finish_omp_for): Add CODE argument.
      	(finish_omp_atomic): Add seq_cst argument.
      	(cxx_omp_create_clause_info): Add need_dtor argument.
      gcc/testsuite/
      	* c-c++-common/gomp/atomic-15.c: Adjust for C diagnostics.
      	Remove error test that is now valid in OpenMP 4.0.
      	* c-c++-common/gomp/atomic-16.c: New test.
      	* c-c++-common/gomp/cancel-1.c: New test.
      	* c-c++-common/gomp/depend-1.c: New test.
      	* c-c++-common/gomp/depend-2.c: New test.
      	* c-c++-common/gomp/map-1.c: New test.
      	* c-c++-common/gomp/pr58472.c: New test.
      	* c-c++-common/gomp/sections1.c: New test.
      	* c-c++-common/gomp/simd1.c: New test.
      	* c-c++-common/gomp/simd2.c: New test.
      	* c-c++-common/gomp/simd3.c: New test.
      	* c-c++-common/gomp/simd4.c: New test.
      	* c-c++-common/gomp/simd5.c: New test.
      	* c-c++-common/gomp/single1.c: New test.
      	* g++.dg/gomp/block-0.C: Adjust for stricter #pragma omp sections
      	parser.
      	* g++.dg/gomp/block-3.C: Likewise.
      	* g++.dg/gomp/clause-3.C: Adjust error messages.
      	* g++.dg/gomp/declare-simd-1.C: New test.
      	* g++.dg/gomp/declare-simd-2.C: New test.
      	* g++.dg/gomp/depend-1.C: New test.
      	* g++.dg/gomp/depend-2.C: New test.
      	* g++.dg/gomp/target-1.C: New test.
      	* g++.dg/gomp/target-2.C: New test.
      	* g++.dg/gomp/taskgroup-1.C: New test.
      	* g++.dg/gomp/teams-1.C: New test.
      	* g++.dg/gomp/udr-1.C: New test.
      	* g++.dg/gomp/udr-2.C: New test.
      	* g++.dg/gomp/udr-3.C: New test.
      	* g++.dg/gomp/udr-4.C: New test.
      	* g++.dg/gomp/udr-5.C: New test.
      	* g++.dg/gomp/udr-6.C: New test.
      	* gcc.dg/autopar/outer-1.c: Expect 4 instead of 5 loopfn matches.
      	* gcc.dg/autopar/outer-2.c: Likewise.
      	* gcc.dg/autopar/outer-3.c: Likewise.
      	* gcc.dg/autopar/outer-4.c: Likewise.
      	* gcc.dg/autopar/outer-5.c: Likewise.
      	* gcc.dg/autopar/outer-6.c: Likewise.
      	* gcc.dg/autopar/parallelization-1.c: Likewise.
      	* gcc.dg/gomp/block-3.c: Adjust for stricter #pragma omp sections
      	parser.
      	* gcc.dg/gomp/clause-1.c: Adjust error messages.
      	* gcc.dg/gomp/combined-1.c: Look for GOMP_parallel_loop_runtime
      	instead of GOMP_parallel_loop_runtime_start.
      	* gcc.dg/gomp/declare-simd-1.c: New test.
      	* gcc.dg/gomp/declare-simd-2.c: New test.
      	* gcc.dg/gomp/nesting-1.c: Adjust for stricter #pragma omp sections
      	parser.  Add further #pragma omp sections nesting tests.
      	* gcc.dg/gomp/target-1.c: New test.
      	* gcc.dg/gomp/target-2.c: New test.
      	* gcc.dg/gomp/taskgroup-1.c: New test.
      	* gcc.dg/gomp/teams-1.c: New test.
      	* gcc.dg/gomp/udr-1.c: New test.
      	* gcc.dg/gomp/udr-2.c: New test.
      	* gcc.dg/gomp/udr-3.c: New test.
      	* gcc.dg/gomp/udr-4.c: New test.
      	* gfortran.dg/gomp/appendix-a/a.35.5.f90: Add dg-error.
      
      Co-Authored-By: default avatarRichard Henderson <rth@redhat.com>
      Co-Authored-By: default avatarTobias Burnus <burnus@net-b.de>
      
      From-SVN: r203408
      acf0174b
  39. Feb 01, 2013
Loading