gcc/libgomp/libgomp.texi

2143 lines
66 KiB
Plaintext
Raw Normal View History

\input texinfo @c -*-texinfo-*-
@c %**start of header
@setfilename libgomp.info
@settitle GNU libgomp
@c %**end of header
@copying
Copyright @copyright{} 2006-2015 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Funding Free Software'', the Front-Cover
texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below). A copy of the license is included in the section entitled
``GNU Free Documentation License''.
(a) The FSF's Front-Cover Text is:
A GNU Manual
(b) The FSF's Back-Cover Text is:
You have freedom to copy and modify this GNU Manual, like GNU
software. Copies published by the Free Software Foundation raise
funds for GNU development.
@end copying
@ifinfo
@dircategory GNU Libraries
@direntry
* libgomp: (libgomp). GNU Offloading and Multi Processing Runtime Library.
@end direntry
This manual documents libgomp, the GNU Offloading and Multi Processing
Merge current set of OpenACC changes from gomp-4_0-branch. contrib/ * gcc_update (files_and_dependencies): Update rules for new libgomp/plugin/Makefrag.am and libgomp/plugin/configfrag.ac files. gcc/ * builtin-types.def (BT_FN_VOID_INT_INT_VAR) (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR) (BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR): New function types. * builtins.c: Include "gomp-constants.h". (expand_builtin_acc_on_device): New function. (expand_builtin, is_inexpensive_builtin): Handle BUILT_IN_ACC_ON_DEVICE. * builtins.def (DEF_GOACC_BUILTIN, DEF_GOACC_BUILTIN_COMPILER): New macros. * cgraph.c (cgraph_node::create): Consider flag_openacc next to flag_openmp. * config.gcc <nvptx-*> (tm_file): Add nvptx/offload.h. <*-intelmic-* | *-intelmicemul-*> (tm_file): Add i386/intelmic-offload.h. * gcc.c (LINK_COMMAND_SPEC, GOMP_SELF_SPECS): For -fopenacc, link to libgomp and its dependencies. * config/arc/arc.h (LINK_COMMAND_SPEC): Likewise. * config/darwin.h (LINK_COMMAND_SPEC_A): Likewise. * config/i386/mingw32.h (GOMP_SELF_SPECS): Likewise. * config/ia64/hpux.h (LIB_SPEC): Likewise. * config/pa/pa-hpux11.h (LIB_SPEC): Likewise. * config/pa/pa64-hpux.h (LIB_SPEC): Likewise. * doc/generic.texi: Update for OpenACC changes. * doc/gimple.texi: Likewise. * doc/invoke.texi: Likewise. * doc/sourcebuild.texi: Likewise. * gimple-pretty-print.c (dump_gimple_omp_for): Handle GF_OMP_FOR_KIND_OACC_LOOP. (dump_gimple_omp_target): Handle GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_DATA, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA. Dump more data. * gimple.c: Update comments for OpenACC changes. * gimple.def: Likewise. * gimple.h: Likewise. (enum gf_mask): Add GF_OMP_FOR_KIND_OACC_LOOP, GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_DATA, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA. (gimple_omp_for_cond, gimple_omp_for_set_cond): Sort in the appropriate place. (is_gimple_omp_oacc, is_gimple_omp_offloaded): New functions. * gimplify.c: Include "gomp-constants.h". Update comments for OpenACC changes. (is_gimple_stmt): Handle OACC_PARALLEL, OACC_KERNELS, OACC_DATA, OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle OMP_CLAUSE__CACHE_, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ. (gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (gimplify_oacc_cache): New function. (gimplify_omp_for): Handle OACC_LOOP. (gimplify_omp_workshare): Handle OACC_KERNELS, OACC_PARALLEL, OACC_DATA. (gimplify_omp_target_update): Handle OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE. (gimplify_expr): Handle OACC_LOOP, OACC_CACHE, OACC_HOST_DATA, OACC_DECLARE, OACC_KERNELS, OACC_PARALLEL, OACC_DATA, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE. (gimplify_body): Consider flag_openacc next to flag_openmp. * lto-streamer-out.c: Include "gomp-constants.h". * omp-builtins.def (BUILT_IN_ACC_GET_DEVICE_TYPE) (BUILT_IN_GOACC_DATA_START, BUILT_IN_GOACC_DATA_END) (BUILT_IN_GOACC_ENTER_EXIT_DATA, BUILT_IN_GOACC_PARALLEL) (BUILT_IN_GOACC_UPDATE, BUILT_IN_GOACC_WAIT) (BUILT_IN_GOACC_GET_THREAD_NUM, BUILT_IN_GOACC_GET_NUM_THREADS) (BUILT_IN_ACC_ON_DEVICE): New builtins. * omp-low.c: Include "gomp-constants.h". Update comments for OpenACC changes. (struct omp_context): Add reduction_map, gwv_below, gwv_this members. (extract_omp_for_data, use_pointer_for_field, install_var_field) (new_omp_context, delete_omp_context, scan_sharing_clauses) (create_omp_child_function, scan_omp_for, scan_omp_target) (check_omp_nesting_restrictions, lower_reduction_clauses) (build_omp_regions_1, diagnose_sb_0, make_gimple_omp_edges): Update for OpenACC changes. (scan_sharing_clauses): Handle OMP_CLAUSE_NUM_GANGS: OMP_CLAUSE_NUM_WORKERS: OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Handle GF_OMP_FOR_KIND_OACC_LOOP. (expand_omp_target, lower_omp_target): Handle GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA, GF_OMP_TARGET_KIND_OACC_DATA. (pass_expand_omp::execute, execute_lower_omp) (pass_diagnose_omp_blocks::gate): Consider flag_openacc next to flag_openmp. (offload_symbol_decl): New variable. (oacc_get_reduction_array_id, oacc_max_threads) (get_offload_symbol_decl, get_base_type, lookup_oacc_reduction) (maybe_lookup_oacc_reduction, enclosing_target_ctx) (oacc_loop_or_target_p, oacc_lower_reduction_var_helper) (oacc_gimple_assign, oacc_initialize_reduction_data) (oacc_finalize_reduction_data, oacc_process_reduction_data): New functions. (is_targetreg_ctx): Remove function. * tree-core.h (enum omp_clause_code): Add OMP_CLAUSE__CACHE_, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_GANG, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH. * tree.c (omp_clause_code_name, walk_tree_1): Update accordingly. * tree.h (OMP_CLAUSE_GANG_EXPR, OMP_CLAUSE_GANG_STATIC_EXPR) (OMP_CLAUSE_ASYNC_EXPR, OMP_CLAUSE_WAIT_EXPR) (OMP_CLAUSE_VECTOR_EXPR, OMP_CLAUSE_WORKER_EXPR) (OMP_CLAUSE_NUM_GANGS_EXPR, OMP_CLAUSE_NUM_WORKERS_EXPR) (OMP_CLAUSE_VECTOR_LENGTH_EXPR): New macros. * tree-core.h: Update comments for OpenACC changes. (enum omp_clause_map_kind): Remove. (struct tree_omp_clause): Change type of map_kind member from enum omp_clause_map_kind to unsigned char. * tree-inline.c: Update comments for OpenACC changes. * tree-nested.c: Likewise. Include "gomp-constants.h". (convert_nonlocal_reference_stmt, convert_local_reference_stmt) (convert_tramp_reference_stmt, convert_gimple_call): Update for OpenACC changes. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. * tree-pretty-print.c: Include "gomp-constants.h". (dump_omp_clause): Handle OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_GANG, OMP_CLAUSE_ASYNC, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_WAIT, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_INDEPENDENT. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (dump_generic_node): Handle OACC_PARALLEL, OACC_KERNELS, OACC_DATA, OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP. * tree-streamer-in.c: Include "gomp-constants.h". (unpack_ts_omp_clause_value_fields) Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. * tree-streamer-out.c: Include "gomp-constants.h". (pack_ts_omp_clause_value_fields): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. * tree.def (OACC_PARALLEL, OACC_KERNELS, OACC_DATA) (OACC_HOST_DATA, OACC_LOOP, OACC_CACHE, OACC_DECLARE) (OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE): New tree codes. * tree.c (omp_clause_num_ops): Update accordingly. * tree.h (OMP_BODY, OMP_CLAUSES, OMP_LOOP_CHECK, OMP_CLAUSE_SIZE): Likewise. (OACC_PARALLEL_BODY, OACC_PARALLEL_CLAUSES, OACC_KERNELS_BODY) (OACC_KERNELS_CLAUSES, OACC_DATA_BODY, OACC_DATA_CLAUSES) (OACC_HOST_DATA_BODY, OACC_HOST_DATA_CLAUSES, OACC_CACHE_CLAUSES) (OACC_DECLARE_CLAUSES, OACC_ENTER_DATA_CLAUSES) (OACC_EXIT_DATA_CLAUSES, OACC_UPDATE_CLAUSES) (OACC_KERNELS_COMBINED, OACC_PARALLEL_COMBINED): New macros. * tree.h (OMP_CLAUSE_MAP_KIND): Cast it to enum gomp_map_kind. (OMP_CLAUSE_SET_MAP_KIND): New macro. * varpool.c (varpool_node::get_create): Consider flag_openacc next to flag_openmp. * config/i386/intelmic-offload.h: New file. * config/nvptx/offload.h: Likewise. gcc/ada/ * gcc-interface/utils.c (DEF_FUNCTION_TYPE_VAR_8) (DEF_FUNCTION_TYPE_VAR_12): New macros. gcc/c-family/ * c.opt (fopenacc): New option. * c-cppbuiltin.c (c_cpp_builtins): Conditionally define _OPENACC. * c-common.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): New macros. * c-common.h (c_finish_oacc_wait): New prototype. * c-omp.c: Include "omp-low.h" and "gomp-constants.h". (c_finish_oacc_wait): New function. * c-pragma.c (oacc_pragmas): New variable. (c_pp_lookup_pragma, init_pragma): Handle it. * c-pragma.h (enum pragma_kind): Add PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT. (enum pragma_omp_clause): Add PRAGMA_OACC_CLAUSE_ASYNC, PRAGMA_OACC_CLAUSE_AUTO, PRAGMA_OACC_CLAUSE_COLLAPSE, PRAGMA_OACC_CLAUSE_COPY, PRAGMA_OACC_CLAUSE_COPYIN, PRAGMA_OACC_CLAUSE_COPYOUT, PRAGMA_OACC_CLAUSE_CREATE, PRAGMA_OACC_CLAUSE_DELETE, PRAGMA_OACC_CLAUSE_DEVICE, PRAGMA_OACC_CLAUSE_DEVICEPTR, PRAGMA_OACC_CLAUSE_FIRSTPRIVATE, PRAGMA_OACC_CLAUSE_GANG, PRAGMA_OACC_CLAUSE_HOST, PRAGMA_OACC_CLAUSE_IF, PRAGMA_OACC_CLAUSE_NUM_GANGS, PRAGMA_OACC_CLAUSE_NUM_WORKERS, PRAGMA_OACC_CLAUSE_PRESENT, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPY, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYIN, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYOUT, PRAGMA_OACC_CLAUSE_PRESENT_OR_CREATE, PRAGMA_OACC_CLAUSE_PRIVATE, PRAGMA_OACC_CLAUSE_REDUCTION, PRAGMA_OACC_CLAUSE_SELF, PRAGMA_OACC_CLAUSE_SEQ, PRAGMA_OACC_CLAUSE_VECTOR, PRAGMA_OACC_CLAUSE_VECTOR_LENGTH, PRAGMA_OACC_CLAUSE_WAIT, PRAGMA_OACC_CLAUSE_WORKER. gcc/c/ * c-parser.c: Include "gomp-constants.h". (c_parser_omp_clause_map): Use enum gomp_map_kind instead of enum omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (c_parser_pragma): Handle PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_UPDATE. (c_parser_omp_construct): Handle PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_WAIT. (c_parser_omp_clause_name): Handle "auto", "async", "copy", "copyout", "create", "delete", "deviceptr", "gang", "host", "num_gangs", "num_workers", "present", "present_or_copy", "pcopy", "present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout", "present_or_create", "pcreate", "seq", "self", "vector", "vector_length", "wait", "worker". (OACC_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK) (OACC_ENTER_DATA_CLAUSE_MASK, OACC_EXIT_DATA_CLAUSE_MASK) (OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK) (OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros. (c_parser_omp_variable_list): Handle OMP_CLAUSE__CACHE_. (c_parser_oacc_wait_list, c_parser_oacc_data_clause) (c_parser_oacc_data_clause_deviceptr) (c_parser_omp_clause_num_gangs, c_parser_omp_clause_num_workers) (c_parser_oacc_clause_async, c_parser_oacc_clause_wait) (c_parser_omp_clause_vector_length, c_parser_oacc_all_clauses) (c_parser_oacc_cache, c_parser_oacc_data, c_parser_oacc_kernels) (c_parser_oacc_enter_exit_data, c_parser_oacc_loop) (c_parser_oacc_parallel, c_parser_oacc_update) (c_parser_oacc_wait): New functions. * c-tree.h (c_finish_oacc_parallel, c_finish_oacc_kernels) (c_finish_oacc_data): New prototypes. * c-typeck.c: Include "gomp-constants.h". (handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (c_finish_oacc_parallel, c_finish_oacc_kernels) (c_finish_oacc_data): New functions. (c_finish_omp_clauses): Handle OMP_CLAUSE__CACHE_, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, and OMP_CLAUSE_MAP's GOMP_MAP_FORCE_DEVICEPTR. gcc/cp/ * parser.c: Include "gomp-constants.h". (cp_parser_omp_clause_map): Use enum gomp_map_kind instead of enum omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (cp_parser_omp_construct, cp_parser_pragma): Handle PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_LOOP, PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT. (cp_parser_omp_clause_name): Handle "async", "copy", "copyout", "create", "delete", "deviceptr", "host", "num_gangs", "num_workers", "present", "present_or_copy", "pcopy", "present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout", "present_or_create", "pcreate", "vector_length", "wait". (OACC_DATA_CLAUSE_MASK, OACC_ENTER_DATA_CLAUSE_MASK) (OACC_EXIT_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK) (OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK) (OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros. (cp_parser_omp_var_list_no_open): Handle OMP_CLAUSE__CACHE_. (cp_parser_oacc_data_clause, cp_parser_oacc_data_clause_deviceptr) (cp_parser_oacc_clause_vector_length, cp_parser_oacc_wait_list) (cp_parser_oacc_clause_wait, cp_parser_omp_clause_num_gangs) (cp_parser_omp_clause_num_workers, cp_parser_oacc_clause_async) (cp_parser_oacc_all_clauses, cp_parser_oacc_cache) (cp_parser_oacc_data, cp_parser_oacc_enter_exit_data) (cp_parser_oacc_kernels, cp_parser_oacc_loop) (cp_parser_oacc_parallel, cp_parser_oacc_update) (cp_parser_oacc_wait): New functions. * cp-tree.h (finish_oacc_data, finish_oacc_kernels) (finish_oacc_parallel): New prototypes. * semantics.c: Include "gomp-constants.h". (handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (finish_omp_clauses): Handle OMP_CLAUSE_ASYNC, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_WAIT, OMP_CLAUSE__CACHE_. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (finish_oacc_data, finish_oacc_kernels, finish_oacc_parallel): New functions. gcc/fortran/ * lang.opt (fopenacc): New option. * cpp.c (cpp_define_builtins): Conditionally define _OPENACC. * dump-parse-tree.c (show_omp_node): Split part of it into... (show_omp_clauses): ... this new function. (show_omp_node, show_code_node): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (show_namespace): Update for OpenACC. * f95-lang.c (DEF_FUNCTION_TYPE_VAR_2, DEF_FUNCTION_TYPE_VAR_8) (DEF_FUNCTION_TYPE_VAR_12, DEF_GOACC_BUILTIN) (DEF_GOACC_BUILTIN_COMPILER): New macros. * types.def (BT_FN_VOID_INT_INT_VAR) (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR) (BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR): New function types. * gfortran.h (gfc_statement): Add ST_OACC_PARALLEL_LOOP, ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL, ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_DATA, ST_OACC_END_DATA, ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA, ST_OACC_LOOP, ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_KERNELS_LOOP, ST_OACC_END_KERNELS_LOOP, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA, ST_OACC_ROUTINE. (struct gfc_expr_list): New data type. (gfc_get_expr_list): New macro. (gfc_omp_map_op): Add OMP_MAP_FORCE_ALLOC, OMP_MAP_FORCE_DEALLOC, OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM, OMP_MAP_FORCE_TOFROM, OMP_MAP_FORCE_PRESENT, OMP_MAP_FORCE_DEVICEPTR. (OMP_LIST_FIRST, OMP_LIST_DEVICE_RESIDENT, OMP_LIST_USE_DEVICE) (OMP_LIST_CACHE): New enumerators. (struct gfc_omp_clauses): Add async_expr, gang_expr, worker_expr, vector_expr, num_gangs_expr, num_workers_expr, vector_length_expr, wait_list, tile_list, async, gang, worker, vector, seq, independent, wait, par_auto, gang_static, and loc members. (struct gfc_namespace): Add oacc_declare_clauses member. (gfc_exec_op): Add EXEC_OACC_KERNELS_LOOP, EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (gfc_free_expr_list, gfc_resolve_oacc_directive) (gfc_resolve_oacc_declare, gfc_resolve_oacc_parallel_loop_blocks) (gfc_resolve_oacc_blocks): New prototypes. * match.c (match_exit_cycle): Handle EXEC_OACC_LOOP and EXEC_OACC_PARALLEL_LOOP. * match.h (gfc_match_oacc_cache, gfc_match_oacc_wait) (gfc_match_oacc_update, gfc_match_oacc_declare) (gfc_match_oacc_loop, gfc_match_oacc_host_data) (gfc_match_oacc_data, gfc_match_oacc_kernels) (gfc_match_oacc_kernels_loop, gfc_match_oacc_parallel) (gfc_match_oacc_parallel_loop, gfc_match_oacc_enter_data) (gfc_match_oacc_exit_data, gfc_match_oacc_routine): New prototypes. * openmp.c: Include "diagnostic.h" and "gomp-constants.h". (gfc_free_omp_clauses): Update for members added to struct gfc_omp_clauses. (gfc_match_omp_clauses): Change mask paramter to uint64_t. Add openacc parameter. (resolve_omp_clauses): Add openacc parameter. Update for OpenACC. (struct fortran_omp_context): Add is_openmp member. (gfc_resolve_omp_parallel_blocks): Initialize it. (gfc_resolve_do_iterator): Update for OpenACC. (gfc_resolve_omp_directive): Call resolve_omp_directive_inside_oacc_region. (OMP_CLAUSE_PRIVATE, OMP_CLAUSE_FIRSTPRIVATE) (OMP_CLAUSE_LASTPRIVATE, OMP_CLAUSE_COPYPRIVATE) (OMP_CLAUSE_SHARED, OMP_CLAUSE_COPYIN, OMP_CLAUSE_REDUCTION) (OMP_CLAUSE_IF, OMP_CLAUSE_NUM_THREADS, OMP_CLAUSE_SCHEDULE) (OMP_CLAUSE_DEFAULT, OMP_CLAUSE_ORDERED, OMP_CLAUSE_COLLAPSE) (OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE) (OMP_CLAUSE_ALIGNED, OMP_CLAUSE_DEPEND, OMP_CLAUSE_INBRANCH) (OMP_CLAUSE_LINEAR, OMP_CLAUSE_NOTINBRANCH, OMP_CLAUSE_PROC_BIND) (OMP_CLAUSE_SAFELEN, OMP_CLAUSE_SIMDLEN, OMP_CLAUSE_UNIFORM) (OMP_CLAUSE_DEVICE, OMP_CLAUSE_MAP, OMP_CLAUSE_TO) (OMP_CLAUSE_FROM, OMP_CLAUSE_NUM_TEAMS, OMP_CLAUSE_THREAD_LIMIT) (OMP_CLAUSE_DIST_SCHEDULE): Use uint64_t. (OMP_CLAUSE_ASYNC, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS) (OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_COPY, OMP_CLAUSE_COPYOUT) (OMP_CLAUSE_CREATE, OMP_CLAUSE_PRESENT) (OMP_CLAUSE_PRESENT_OR_COPY, OMP_CLAUSE_PRESENT_OR_COPYIN) (OMP_CLAUSE_PRESENT_OR_COPYOUT, OMP_CLAUSE_PRESENT_OR_CREATE) (OMP_CLAUSE_DEVICEPTR, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER) (OMP_CLAUSE_VECTOR, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT) (OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_DEVICE_RESIDENT) (OMP_CLAUSE_HOST_SELF, OMP_CLAUSE_OACC_DEVICE, OMP_CLAUSE_WAIT) (OMP_CLAUSE_DELETE, OMP_CLAUSE_AUTO, OMP_CLAUSE_TILE): New macros. (gfc_match_omp_clauses): Handle those. (OACC_PARALLEL_CLAUSES, OACC_KERNELS_CLAUSES, OACC_DATA_CLAUSES) (OACC_LOOP_CLAUSES, OACC_PARALLEL_LOOP_CLAUSES) (OACC_KERNELS_LOOP_CLAUSES, OACC_HOST_DATA_CLAUSES) (OACC_DECLARE_CLAUSES, OACC_UPDATE_CLAUSES) (OACC_ENTER_DATA_CLAUSES, OACC_EXIT_DATA_CLAUSES) (OACC_WAIT_CLAUSES): New macros. (gfc_free_expr_list, match_oacc_expr_list, match_oacc_clause_gang) (gfc_match_omp_map_clause, gfc_match_oacc_parallel_loop) (gfc_match_oacc_parallel, gfc_match_oacc_kernels_loop) (gfc_match_oacc_kernels, gfc_match_oacc_data) (gfc_match_oacc_host_data, gfc_match_oacc_loop) (gfc_match_oacc_declare, gfc_match_oacc_update) (gfc_match_oacc_enter_data, gfc_match_oacc_exit_data) (gfc_match_oacc_wait, gfc_match_oacc_cache) (gfc_match_oacc_routine, oacc_is_loop) (resolve_oacc_scalar_int_expr, resolve_oacc_positive_int_expr) (check_symbol_not_pointer, check_array_not_assumed) (resolve_oacc_data_clauses, resolve_oacc_deviceptr_clause) (oacc_compatible_clauses, oacc_is_parallel, oacc_is_kernels) (omp_code_to_statement, oacc_code_to_statement) (resolve_oacc_directive_inside_omp_region) (resolve_omp_directive_inside_oacc_region) (resolve_oacc_nested_loops, resolve_oacc_params_in_parallel) (resolve_oacc_loop_blocks, gfc_resolve_oacc_blocks) (resolve_oacc_loop, resolve_oacc_cache, gfc_resolve_oacc_declare) (gfc_resolve_oacc_directive): New functions. * parse.c (next_free): Update for OpenACC. Move some code into... (verify_token_free): ... this new function. (next_fixed): Update for OpenACC. Move some code into... (verify_token_fixed): ... this new function. (case_executable): Add ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_ENTER_DATA, and ST_OACC_EXIT_DATA. (case_exec_markers): Add ST_OACC_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA, ST_OACC_LOOP, ST_OACC_KERNELS_LOOP. (case_decl): Add ST_OACC_ROUTINE. (push_state, parse_critical_block, parse_progunit): Update for OpenACC. (gfc_ascii_statement): Handle ST_OACC_PARALLEL_LOOP, ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL, ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_KERNELS_LOOP, ST_OACC_END_KERNELS_LOOP, ST_OACC_DATA, ST_OACC_END_DATA, ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA, ST_OACC_LOOP, ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA, ST_OACC_ROUTINE. (verify_st_order, parse_spec): Handle ST_OACC_DECLARE. (parse_executable): Handle ST_OACC_PARALLEL_LOOP, ST_OACC_KERNELS_LOOP, ST_OACC_LOOP, ST_OACC_PARALLEL, ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA. (decode_oacc_directive, parse_oacc_structured_block) (parse_oacc_loop, is_oacc): New functions. * parse.h (struct gfc_state_data): Add oacc_declare_clauses member. (is_oacc): New prototype. * resolve.c (gfc_resolve_blocks, gfc_resolve_code): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (resolve_codes): Call gfc_resolve_oacc_declare. * scanner.c (openacc_flag, openacc_locus): New variables. (skip_free_comments): Update for OpenACC. Move some code into... (skip_omp_attribute): ... this new function. (skip_oacc_attribute): New function. (skip_fixed_comments, gfc_next_char_literal): Update for OpenACC. * st.c (gfc_free_statement): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. * trans-decl.c (gfc_generate_function_code): Update for OpenACC. * trans-openmp.c: Include "gomp-constants.h". (gfc_omp_finish_clause, gfc_trans_omp_clauses): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (gfc_trans_omp_clauses): Handle OMP_LIST_USE_DEVICE, OMP_LIST_DEVICE_RESIDENT, OMP_LIST_CACHE, and OMP_MAP_FORCE_ALLOC, OMP_MAP_FORCE_DEALLOC, OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM, OMP_MAP_FORCE_TOFROM, OMP_MAP_FORCE_PRESENT, OMP_MAP_FORCE_DEVICEPTR, and gfc_omp_clauses' async, seq, independent, wait_list, num_gangs_expr, num_workers_expr, vector_length_expr, vector, vector_expr, worker, worker_expr, gang, gang_expr members. (gfc_trans_omp_do): Handle EXEC_OACC_LOOP. (gfc_convert_expr_to_tree, gfc_trans_oacc_construct) (gfc_trans_oacc_executable_directive) (gfc_trans_oacc_wait_directive, gfc_trans_oacc_combined_directive) (gfc_trans_oacc_declare, gfc_trans_oacc_directive): New functions. * trans-stmt.c (gfc_trans_block_construct): Update for OpenACC. * trans-stmt.h (gfc_trans_oacc_directive, gfc_trans_oacc_declare): New prototypes. * trans.c (tranc_code): Handle EXEC_OACC_CACHE, EXEC_OACC_WAIT, EXEC_OACC_UPDATE, EXEC_OACC_LOOP, EXEC_OACC_HOST_DATA, EXEC_OACC_DATA, EXEC_OACC_KERNELS, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. * gfortran.texi: Update for OpenACC. * intrinsic.texi: Likewise. * invoke.texi: Likewise. gcc/lto/ * lto-lang.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): New macros. * lto.c: Include "gomp-constants.h". gcc/testsuite/ * lib/target-supports.exp (check_effective_target_fopenacc): New procedure. * g++.dg/goacc-gomp/goacc-gomp.exp: New file. * g++.dg/goacc/goacc.exp: Likewise. * gcc.dg/goacc-gomp/goacc-gomp.exp: Likewise. * gcc.dg/goacc/goacc.exp: Likewise. * gfortran.dg/goacc/goacc.exp: Likewise. * c-c++-common/cpp/openacc-define-1.c: New file. * c-c++-common/cpp/openacc-define-2.c: Likewise. * c-c++-common/cpp/openacc-define-3.c: Likewise. * c-c++-common/goacc-gomp/nesting-1.c: Likewise. * c-c++-common/goacc-gomp/nesting-fail-1.c: Likewise. * c-c++-common/goacc/acc_on_device-2-off.c: Likewise. * c-c++-common/goacc/acc_on_device-2.c: Likewise. * c-c++-common/goacc/asyncwait-1.c: Likewise. * c-c++-common/goacc/cache-1.c: Likewise. * c-c++-common/goacc/clauses-fail.c: Likewise. * c-c++-common/goacc/collapse-1.c: Likewise. * c-c++-common/goacc/data-1.c: Likewise. * c-c++-common/goacc/data-2.c: Likewise. * c-c++-common/goacc/data-clause-duplicate-1.c: Likewise. * c-c++-common/goacc/deviceptr-1.c: Likewise. * c-c++-common/goacc/deviceptr-2.c: Likewise. * c-c++-common/goacc/deviceptr-3.c: Likewise. * c-c++-common/goacc/if-clause-1.c: Likewise. * c-c++-common/goacc/if-clause-2.c: Likewise. * c-c++-common/goacc/kernels-1.c: Likewise. * c-c++-common/goacc/loop-1.c: Likewise. * c-c++-common/goacc/loop-private-1.c: Likewise. * c-c++-common/goacc/nesting-1.c: Likewise. * c-c++-common/goacc/nesting-data-1.c: Likewise. * c-c++-common/goacc/nesting-fail-1.c: Likewise. * c-c++-common/goacc/parallel-1.c: Likewise. * c-c++-common/goacc/pcopy.c: Likewise. * c-c++-common/goacc/pcopyin.c: Likewise. * c-c++-common/goacc/pcopyout.c: Likewise. * c-c++-common/goacc/pcreate.c: Likewise. * c-c++-common/goacc/pragma_context.c: Likewise. * c-c++-common/goacc/present-1.c: Likewise. * c-c++-common/goacc/reduction-1.c: Likewise. * c-c++-common/goacc/reduction-2.c: Likewise. * c-c++-common/goacc/reduction-3.c: Likewise. * c-c++-common/goacc/reduction-4.c: Likewise. * c-c++-common/goacc/sb-1.c: Likewise. * c-c++-common/goacc/sb-2.c: Likewise. * c-c++-common/goacc/sb-3.c: Likewise. * c-c++-common/goacc/update-1.c: Likewise. * gcc.dg/goacc/acc_on_device-1.c: Likewise. * gfortran.dg/goacc/acc_on_device-1.f95: Likewise. * gfortran.dg/goacc/acc_on_device-2-off.f95: Likewise. * gfortran.dg/goacc/acc_on_device-2.f95: Likewise. * gfortran.dg/goacc/assumed.f95: Likewise. * gfortran.dg/goacc/asyncwait-1.f95: Likewise. * gfortran.dg/goacc/asyncwait-2.f95: Likewise. * gfortran.dg/goacc/asyncwait-3.f95: Likewise. * gfortran.dg/goacc/asyncwait-4.f95: Likewise. * gfortran.dg/goacc/branch.f95: Likewise. * gfortran.dg/goacc/cache-1.f95: Likewise. * gfortran.dg/goacc/coarray.f95: Likewise. * gfortran.dg/goacc/continuation-free-form.f95: Likewise. * gfortran.dg/goacc/cray.f95: Likewise. * gfortran.dg/goacc/critical.f95: Likewise. * gfortran.dg/goacc/data-clauses.f95: Likewise. * gfortran.dg/goacc/data-tree.f95: Likewise. * gfortran.dg/goacc/declare-1.f95: Likewise. * gfortran.dg/goacc/enter-exit-data.f95: Likewise. * gfortran.dg/goacc/fixed-1.f: Likewise. * gfortran.dg/goacc/fixed-2.f: Likewise. * gfortran.dg/goacc/fixed-3.f: Likewise. * gfortran.dg/goacc/fixed-4.f: Likewise. * gfortran.dg/goacc/host_data-tree.f95: Likewise. * gfortran.dg/goacc/if.f95: Likewise. * gfortran.dg/goacc/kernels-tree.f95: Likewise. * gfortran.dg/goacc/list.f95: Likewise. * gfortran.dg/goacc/literal.f95: Likewise. * gfortran.dg/goacc/loop-1.f95: Likewise. * gfortran.dg/goacc/loop-2.f95: Likewise. * gfortran.dg/goacc/loop-3.f95: Likewise. * gfortran.dg/goacc/loop-tree-1.f90: Likewise. * gfortran.dg/goacc/omp.f95: Likewise. * gfortran.dg/goacc/parallel-kernels-clauses.f95: Likewise. * gfortran.dg/goacc/parallel-kernels-regions.f95: Likewise. * gfortran.dg/goacc/parallel-tree.f95: Likewise. * gfortran.dg/goacc/parameter.f95: Likewise. * gfortran.dg/goacc/private-1.f95: Likewise. * gfortran.dg/goacc/private-2.f95: Likewise. * gfortran.dg/goacc/private-3.f95: Likewise. * gfortran.dg/goacc/pure-elemental-procedures.f95: Likewise. * gfortran.dg/goacc/reduction-2.f95: Likewise. * gfortran.dg/goacc/reduction.f95: Likewise. * gfortran.dg/goacc/routine-1.f90: Likewise. * gfortran.dg/goacc/routine-2.f90: Likewise. * gfortran.dg/goacc/sentinel-free-form.f95: Likewise. * gfortran.dg/goacc/several-directives.f95: Likewise. * gfortran.dg/goacc/sie.f95: Likewise. * gfortran.dg/goacc/subarrays.f95: Likewise. * gfortran.dg/gomp/map-1.f90: Likewise. * gfortran.dg/openacc-define-1.f90: Likewise. * gfortran.dg/openacc-define-2.f90: Likewise. * gfortran.dg/openacc-define-3.f90: Likewise. * g++.dg/gomp/block-1.C: Update for changed compiler output. * g++.dg/gomp/block-2.C: Likewise. * g++.dg/gomp/block-3.C: Likewise. * g++.dg/gomp/block-5.C: Likewise. * g++.dg/gomp/target-1.C: Likewise. * g++.dg/gomp/target-2.C: Likewise. * g++.dg/gomp/taskgroup-1.C: Likewise. * g++.dg/gomp/teams-1.C: Likewise. * gcc.dg/cilk-plus/jump-openmp.c: Likewise. * gcc.dg/cilk-plus/jump.c: Likewise. * gcc.dg/gomp/block-1.c: Likewise. * gcc.dg/gomp/block-10.c: Likewise. * gcc.dg/gomp/block-2.c: Likewise. * gcc.dg/gomp/block-3.c: Likewise. * gcc.dg/gomp/block-4.c: Likewise. * gcc.dg/gomp/block-5.c: Likewise. * gcc.dg/gomp/block-6.c: Likewise. * gcc.dg/gomp/block-7.c: Likewise. * gcc.dg/gomp/block-8.c: Likewise. * gcc.dg/gomp/block-9.c: Likewise. * gcc.dg/gomp/target-1.c: Likewise. * gcc.dg/gomp/target-2.c: Likewise. * gcc.dg/gomp/taskgroup-1.c: Likewise. * gcc.dg/gomp/teams-1.c: Likewise. include/ * gomp-constants.h: New file. libgomp/ * Makefile.am (search_path): Add $(top_srcdir)/../include. (libgomp_la_SOURCES): Add splay-tree.c, libgomp-plugin.c, oacc-parallel.c, oacc-host.c, oacc-init.c, oacc-mem.c, oacc-async.c, oacc-plugin.c, oacc-cuda.c. [USE_FORTRAN] (libgomp_la_SOURCES): Add openacc.f90. Include $(top_srcdir)/plugin/Makefrag.am. (nodist_libsubinclude_HEADERS): Add openacc.h. [USE_FORTRAN] (nodist_finclude_HEADERS): Add openacc_lib.h, openacc.f90, openacc.mod, openacc_kinds.mod. (omp_lib.mod): Generalize into... (%.mod): ... this new rule. (openacc_kinds.mod, openacc.mod): New rules. * plugin/configfrag.ac: New file. * configure.ac: Move plugin/offloading support into it. Include it. Instantiate testsuite/libgomp-test-support.pt.exp. * plugin/Makefrag.am: New file. * testsuite/Makefile.am (OFFLOAD_TARGETS) (OFFLOAD_ADDITIONAL_OPTIONS, OFFLOAD_ADDITIONAL_LIB_PATHS): Don't export. (libgomp-test-support.exp): New rule. (all-local): Depend on it. * Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. * config.h.in: Likewise. * configure: Likewise. * configure.tgt: Harden shell syntax. * env.c: Include "oacc-int.h". (parse_acc_device_type): New function. (gomp_debug_var, goacc_device_type, goacc_device_num): New variables. (initialize_env): Initialize those. Call goacc_runtime_initialize. * error.c (gomp_vdebug, gomp_debug, gomp_vfatal): New functions. (gomp_fatal): Call gomp_vfatal. * libgomp.h: Include "libgomp-plugin.h" and <stdarg.h>. (gomp_debug_var, goacc_device_type, goacc_device_num, gomp_vdebug) (gomp_debug, gomp_verror, gomp_vfatal, gomp_init_targets_once) (splay_tree_node, splay_tree, splay_tree_key) (struct target_mem_desc, struct splay_tree_key_s) (struct gomp_memory_mapping, struct acc_dispatch_t) (struct gomp_device_descr, gomp_acc_insert_pointer) (gomp_acc_remove_pointer, target_mem_desc, gomp_copy_from_async) (gomp_unmap_vars, gomp_init_device, gomp_init_tables) (gomp_free_memmap, gomp_fini_device): New declarations. (gomp_vdebug, gomp_debug): New macros. Include "splay-tree.h". * libgomp.map (OACC_2.0): New symbol version. Use for acc_get_num_devices, acc_get_num_devices_h_, acc_set_device_type, acc_set_device_type_h_, acc_get_device_type, acc_get_device_type_h_, acc_set_device_num, acc_set_device_num_h_, acc_get_device_num, acc_get_device_num_h_, acc_async_test, acc_async_test_h_, acc_async_test_all, acc_async_test_all_h_, acc_wait, acc_wait_h_, acc_wait_async, acc_wait_async_h_, acc_wait_all, acc_wait_all_h_, acc_wait_all_async, acc_wait_all_async_h_, acc_init, acc_init_h_, acc_shutdown, acc_shutdown_h_, acc_on_device, acc_on_device_h_, acc_malloc, acc_free, acc_copyin, acc_copyin_32_h_, acc_copyin_64_h_, acc_copyin_array_h_, acc_present_or_copyin, acc_present_or_copyin_32_h_, acc_present_or_copyin_64_h_, acc_present_or_copyin_array_h_, acc_create, acc_create_32_h_, acc_create_64_h_, acc_create_array_h_, acc_present_or_create, acc_present_or_create_32_h_, acc_present_or_create_64_h_, acc_present_or_create_array_h_, acc_copyout, acc_copyout_32_h_, acc_copyout_64_h_, acc_copyout_array_h_, acc_delete, acc_delete_32_h_, acc_delete_64_h_, acc_delete_array_h_, acc_update_device, acc_update_device_32_h_, acc_update_device_64_h_, acc_update_device_array_h_, acc_update_self, acc_update_self_32_h_, acc_update_self_64_h_, acc_update_self_array_h_, acc_map_data, acc_unmap_data, acc_deviceptr, acc_hostptr, acc_is_present, acc_is_present_32_h_, acc_is_present_64_h_, acc_is_present_array_h_, acc_memcpy_to_device, acc_memcpy_from_device, acc_get_current_cuda_device, acc_get_current_cuda_context, acc_get_cuda_stream, acc_set_cuda_stream. (GOACC_2.0): New symbol version. Use for GOACC_data_end, GOACC_data_start, GOACC_enter_exit_data, GOACC_parallel, GOACC_update, GOACC_wait, GOACC_get_thread_num, GOACC_get_num_threads. (GOMP_PLUGIN_1.0): New symbol version. Use for GOMP_PLUGIN_malloc, GOMP_PLUGIN_malloc_cleared, GOMP_PLUGIN_realloc, GOMP_PLUGIN_debug, GOMP_PLUGIN_error, GOMP_PLUGIN_fatal, GOMP_PLUGIN_async_unmap_vars, GOMP_PLUGIN_acc_thread. * libgomp.texi: Update for OpenACC changes, and GOMP_DEBUG environment variable. * libgomp_g.h (GOACC_data_start, GOACC_data_end) (GOACC_enter_exit_data, GOACC_parallel, GOACC_update, GOACC_wait) (GOACC_get_num_threads, GOACC_get_thread_num): New declarations. * splay-tree.h (splay_tree_lookup, splay_tree_insert) (splay_tree_remove): New declarations. (rotate_left, rotate_right, splay_tree_splay, splay_tree_insert) (splay_tree_remove, splay_tree_lookup): Move into... * splay-tree.c: ... this new file. * target.c: Include "oacc-plugin.h", "oacc-int.h", <assert.h>. (splay_tree_node, splay_tree, splay_tree_key) (struct target_mem_desc, struct splay_tree_key_s) (struct gomp_device_descr): Don't declare. (num_devices_openmp): New variable. (gomp_get_num_devices ): Use it. (gomp_init_targets_once): New function. (gomp_get_num_devices ): Use it. (get_kind, gomp_copy_from_async, gomp_free_memmap) (gomp_fini_device, gomp_register_image_for_device): New functions. (gomp_map_vars): Add devaddrs parameter. (gomp_update): Add mm parameter. (gomp_init_device): Move most of it into... (gomp_init_tables): ... this new function. (gomp_register_images_for_device): Remove function. (splay_compare, gomp_map_vars, gomp_unmap_vars, gomp_init_device): Make them hidden instead of static. (gomp_map_vars_existing, gomp_map_vars, gomp_unmap_vars) (gomp_update, gomp_init_device, GOMP_target, GOMP_target_data) (GOMP_target_end_data, GOMP_target_update) (gomp_load_plugin_for_device, gomp_target_init): Update for OpenACC changes. * oacc-async.c: New file. * oacc-cuda.c: Likewise. * oacc-host.c: Likewise. * oacc-init.c: Likewise. * oacc-int.h: Likewise. * oacc-mem.c: Likewise. * oacc-parallel.c: Likewise. * oacc-plugin.c: Likewise. * oacc-plugin.h: Likewise. * oacc-ptx.h: Likewise. * openacc.f90: Likewise. * openacc.h: Likewise. * openacc_lib.h: Likewise. * plugin/plugin-host.c: Likewise. * plugin/plugin-nvptx.c: Likewise. * libgomp-plugin.c: Likewise. * libgomp-plugin.h: Likewise. * libgomp_target.h: Remove file after merging content into the former file. Update all users. * testsuite/lib/libgomp.exp: Load libgomp-test-support.exp. (offload_targets_s, offload_targets_s_openacc): New variables. (check_effective_target_openacc_nvidia_accel_present) (check_effective_target_openacc_nvidia_accel_selected): New procedures. (libgomp_init): Update for OpenACC changes. * testsuite/libgomp-test-support.exp.in: New file. * testsuite/libgomp.oacc-c++/c++.exp: Likewise. * testsuite/libgomp.oacc-c/c.exp: Likewise. * testsuite/libgomp.oacc-fortran/fortran.exp: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/asyncwait-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/cache-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/clauses-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/clauses-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-6.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-7.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-8.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/deviceptr-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/if-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/kernels-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/kernels-empty.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-10.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-11.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-12.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-13.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-14.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-15.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-16.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-17.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-18.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-19.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-20.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-21.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-22.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-23.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-24.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-25.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-26.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-27.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-28.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-29.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-30.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-31.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-32.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-33.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-34.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-35.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-36.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-37.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-38.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-39.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-40.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-41.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-42.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-43.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-44.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-45.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-46.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-47.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-48.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-49.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-50.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-51.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-52.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-53.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-54.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-55.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-56.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-57.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-58.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-59.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-6.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-60.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-61.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-62.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-63.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-64.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-65.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-66.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-67.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-68.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-69.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-7.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-70.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-71.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-72.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-73.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-74.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-75.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-76.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-77.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-78.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-79.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-80.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-81.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-82.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-83.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-84.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-85.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-86.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-87.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-88.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-89.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-9.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-90.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-91.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-92.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/nested-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/nested-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/offset-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/parallel-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/parallel-empty.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/pointer-align-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/present-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/present-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-initial-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/subr.h: Likewise. * testsuite/libgomp.oacc-c-c++-common/subr.ptx: Likewise. * testsuite/libgomp.oacc-c-c++-common/timer.h: Likewise. * testsuite/libgomp.oacc-c-c++-common/update-1-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/update-1.c: Likewise. * testsuite/libgomp.oacc-fortran/abort-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/abort-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-7.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-8.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-4-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-already-1.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-2.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-3.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-4.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-5.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-6.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-7.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-8.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-10.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-2.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-3.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-7.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-8.f90: Likewise. * testsuite/libgomp.oacc-fortran/map-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/openacc_version-1.f: Likewise. * testsuite/libgomp.oacc-fortran/openacc_version-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/pointer-align-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/pset-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/subarrays-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/subarrays-2.f90: Likewise. liboffloadmic/ * plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_get_name) (GOMP_OFFLOAD_get_caps, GOMP_OFFLOAD_fini_device): New functions. Co-Authored-By: Bernd Schmidt <bernds@codesourcery.com> Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com> Co-Authored-By: Dmitry Bocharnikov <dmitry.b@samsung.com> Co-Authored-By: Evgeny Gavrin <e.gavrin@samsung.com> Co-Authored-By: Ilmir Usmanov <i.usmanov@samsung.com> Co-Authored-By: Jakub Jelinek <jakub@redhat.com> Co-Authored-By: James Norris <jnorris@codesourcery.com> Co-Authored-By: Julian Brown <julian@codesourcery.com> Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> Co-Authored-By: Tom de Vries <tom@codesourcery.com> From-SVN: r219682
2015-01-15 21:11:12 +01:00
Runtime library. This is the GNU implementation of the OpenMP and
OpenACC APIs for parallel and accelerator programming in C/C++ and
Fortran.
Published by the Free Software Foundation
51 Franklin Street, Fifth Floor
Boston, MA 02110-1301 USA
@insertcopying
@end ifinfo
@setchapternewpage odd
@titlepage
@title GNU Offloading and Multi Processing Runtime Library
Merge current set of OpenACC changes from gomp-4_0-branch. contrib/ * gcc_update (files_and_dependencies): Update rules for new libgomp/plugin/Makefrag.am and libgomp/plugin/configfrag.ac files. gcc/ * builtin-types.def (BT_FN_VOID_INT_INT_VAR) (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR) (BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR): New function types. * builtins.c: Include "gomp-constants.h". (expand_builtin_acc_on_device): New function. (expand_builtin, is_inexpensive_builtin): Handle BUILT_IN_ACC_ON_DEVICE. * builtins.def (DEF_GOACC_BUILTIN, DEF_GOACC_BUILTIN_COMPILER): New macros. * cgraph.c (cgraph_node::create): Consider flag_openacc next to flag_openmp. * config.gcc <nvptx-*> (tm_file): Add nvptx/offload.h. <*-intelmic-* | *-intelmicemul-*> (tm_file): Add i386/intelmic-offload.h. * gcc.c (LINK_COMMAND_SPEC, GOMP_SELF_SPECS): For -fopenacc, link to libgomp and its dependencies. * config/arc/arc.h (LINK_COMMAND_SPEC): Likewise. * config/darwin.h (LINK_COMMAND_SPEC_A): Likewise. * config/i386/mingw32.h (GOMP_SELF_SPECS): Likewise. * config/ia64/hpux.h (LIB_SPEC): Likewise. * config/pa/pa-hpux11.h (LIB_SPEC): Likewise. * config/pa/pa64-hpux.h (LIB_SPEC): Likewise. * doc/generic.texi: Update for OpenACC changes. * doc/gimple.texi: Likewise. * doc/invoke.texi: Likewise. * doc/sourcebuild.texi: Likewise. * gimple-pretty-print.c (dump_gimple_omp_for): Handle GF_OMP_FOR_KIND_OACC_LOOP. (dump_gimple_omp_target): Handle GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_DATA, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA. Dump more data. * gimple.c: Update comments for OpenACC changes. * gimple.def: Likewise. * gimple.h: Likewise. (enum gf_mask): Add GF_OMP_FOR_KIND_OACC_LOOP, GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_DATA, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA. (gimple_omp_for_cond, gimple_omp_for_set_cond): Sort in the appropriate place. (is_gimple_omp_oacc, is_gimple_omp_offloaded): New functions. * gimplify.c: Include "gomp-constants.h". Update comments for OpenACC changes. (is_gimple_stmt): Handle OACC_PARALLEL, OACC_KERNELS, OACC_DATA, OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle OMP_CLAUSE__CACHE_, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ. (gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (gimplify_oacc_cache): New function. (gimplify_omp_for): Handle OACC_LOOP. (gimplify_omp_workshare): Handle OACC_KERNELS, OACC_PARALLEL, OACC_DATA. (gimplify_omp_target_update): Handle OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE. (gimplify_expr): Handle OACC_LOOP, OACC_CACHE, OACC_HOST_DATA, OACC_DECLARE, OACC_KERNELS, OACC_PARALLEL, OACC_DATA, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE. (gimplify_body): Consider flag_openacc next to flag_openmp. * lto-streamer-out.c: Include "gomp-constants.h". * omp-builtins.def (BUILT_IN_ACC_GET_DEVICE_TYPE) (BUILT_IN_GOACC_DATA_START, BUILT_IN_GOACC_DATA_END) (BUILT_IN_GOACC_ENTER_EXIT_DATA, BUILT_IN_GOACC_PARALLEL) (BUILT_IN_GOACC_UPDATE, BUILT_IN_GOACC_WAIT) (BUILT_IN_GOACC_GET_THREAD_NUM, BUILT_IN_GOACC_GET_NUM_THREADS) (BUILT_IN_ACC_ON_DEVICE): New builtins. * omp-low.c: Include "gomp-constants.h". Update comments for OpenACC changes. (struct omp_context): Add reduction_map, gwv_below, gwv_this members. (extract_omp_for_data, use_pointer_for_field, install_var_field) (new_omp_context, delete_omp_context, scan_sharing_clauses) (create_omp_child_function, scan_omp_for, scan_omp_target) (check_omp_nesting_restrictions, lower_reduction_clauses) (build_omp_regions_1, diagnose_sb_0, make_gimple_omp_edges): Update for OpenACC changes. (scan_sharing_clauses): Handle OMP_CLAUSE_NUM_GANGS: OMP_CLAUSE_NUM_WORKERS: OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Handle GF_OMP_FOR_KIND_OACC_LOOP. (expand_omp_target, lower_omp_target): Handle GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA, GF_OMP_TARGET_KIND_OACC_DATA. (pass_expand_omp::execute, execute_lower_omp) (pass_diagnose_omp_blocks::gate): Consider flag_openacc next to flag_openmp. (offload_symbol_decl): New variable. (oacc_get_reduction_array_id, oacc_max_threads) (get_offload_symbol_decl, get_base_type, lookup_oacc_reduction) (maybe_lookup_oacc_reduction, enclosing_target_ctx) (oacc_loop_or_target_p, oacc_lower_reduction_var_helper) (oacc_gimple_assign, oacc_initialize_reduction_data) (oacc_finalize_reduction_data, oacc_process_reduction_data): New functions. (is_targetreg_ctx): Remove function. * tree-core.h (enum omp_clause_code): Add OMP_CLAUSE__CACHE_, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_GANG, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH. * tree.c (omp_clause_code_name, walk_tree_1): Update accordingly. * tree.h (OMP_CLAUSE_GANG_EXPR, OMP_CLAUSE_GANG_STATIC_EXPR) (OMP_CLAUSE_ASYNC_EXPR, OMP_CLAUSE_WAIT_EXPR) (OMP_CLAUSE_VECTOR_EXPR, OMP_CLAUSE_WORKER_EXPR) (OMP_CLAUSE_NUM_GANGS_EXPR, OMP_CLAUSE_NUM_WORKERS_EXPR) (OMP_CLAUSE_VECTOR_LENGTH_EXPR): New macros. * tree-core.h: Update comments for OpenACC changes. (enum omp_clause_map_kind): Remove. (struct tree_omp_clause): Change type of map_kind member from enum omp_clause_map_kind to unsigned char. * tree-inline.c: Update comments for OpenACC changes. * tree-nested.c: Likewise. Include "gomp-constants.h". (convert_nonlocal_reference_stmt, convert_local_reference_stmt) (convert_tramp_reference_stmt, convert_gimple_call): Update for OpenACC changes. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. * tree-pretty-print.c: Include "gomp-constants.h". (dump_omp_clause): Handle OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_GANG, OMP_CLAUSE_ASYNC, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_WAIT, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_INDEPENDENT. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (dump_generic_node): Handle OACC_PARALLEL, OACC_KERNELS, OACC_DATA, OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP. * tree-streamer-in.c: Include "gomp-constants.h". (unpack_ts_omp_clause_value_fields) Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. * tree-streamer-out.c: Include "gomp-constants.h". (pack_ts_omp_clause_value_fields): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. * tree.def (OACC_PARALLEL, OACC_KERNELS, OACC_DATA) (OACC_HOST_DATA, OACC_LOOP, OACC_CACHE, OACC_DECLARE) (OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE): New tree codes. * tree.c (omp_clause_num_ops): Update accordingly. * tree.h (OMP_BODY, OMP_CLAUSES, OMP_LOOP_CHECK, OMP_CLAUSE_SIZE): Likewise. (OACC_PARALLEL_BODY, OACC_PARALLEL_CLAUSES, OACC_KERNELS_BODY) (OACC_KERNELS_CLAUSES, OACC_DATA_BODY, OACC_DATA_CLAUSES) (OACC_HOST_DATA_BODY, OACC_HOST_DATA_CLAUSES, OACC_CACHE_CLAUSES) (OACC_DECLARE_CLAUSES, OACC_ENTER_DATA_CLAUSES) (OACC_EXIT_DATA_CLAUSES, OACC_UPDATE_CLAUSES) (OACC_KERNELS_COMBINED, OACC_PARALLEL_COMBINED): New macros. * tree.h (OMP_CLAUSE_MAP_KIND): Cast it to enum gomp_map_kind. (OMP_CLAUSE_SET_MAP_KIND): New macro. * varpool.c (varpool_node::get_create): Consider flag_openacc next to flag_openmp. * config/i386/intelmic-offload.h: New file. * config/nvptx/offload.h: Likewise. gcc/ada/ * gcc-interface/utils.c (DEF_FUNCTION_TYPE_VAR_8) (DEF_FUNCTION_TYPE_VAR_12): New macros. gcc/c-family/ * c.opt (fopenacc): New option. * c-cppbuiltin.c (c_cpp_builtins): Conditionally define _OPENACC. * c-common.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): New macros. * c-common.h (c_finish_oacc_wait): New prototype. * c-omp.c: Include "omp-low.h" and "gomp-constants.h". (c_finish_oacc_wait): New function. * c-pragma.c (oacc_pragmas): New variable. (c_pp_lookup_pragma, init_pragma): Handle it. * c-pragma.h (enum pragma_kind): Add PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT. (enum pragma_omp_clause): Add PRAGMA_OACC_CLAUSE_ASYNC, PRAGMA_OACC_CLAUSE_AUTO, PRAGMA_OACC_CLAUSE_COLLAPSE, PRAGMA_OACC_CLAUSE_COPY, PRAGMA_OACC_CLAUSE_COPYIN, PRAGMA_OACC_CLAUSE_COPYOUT, PRAGMA_OACC_CLAUSE_CREATE, PRAGMA_OACC_CLAUSE_DELETE, PRAGMA_OACC_CLAUSE_DEVICE, PRAGMA_OACC_CLAUSE_DEVICEPTR, PRAGMA_OACC_CLAUSE_FIRSTPRIVATE, PRAGMA_OACC_CLAUSE_GANG, PRAGMA_OACC_CLAUSE_HOST, PRAGMA_OACC_CLAUSE_IF, PRAGMA_OACC_CLAUSE_NUM_GANGS, PRAGMA_OACC_CLAUSE_NUM_WORKERS, PRAGMA_OACC_CLAUSE_PRESENT, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPY, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYIN, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYOUT, PRAGMA_OACC_CLAUSE_PRESENT_OR_CREATE, PRAGMA_OACC_CLAUSE_PRIVATE, PRAGMA_OACC_CLAUSE_REDUCTION, PRAGMA_OACC_CLAUSE_SELF, PRAGMA_OACC_CLAUSE_SEQ, PRAGMA_OACC_CLAUSE_VECTOR, PRAGMA_OACC_CLAUSE_VECTOR_LENGTH, PRAGMA_OACC_CLAUSE_WAIT, PRAGMA_OACC_CLAUSE_WORKER. gcc/c/ * c-parser.c: Include "gomp-constants.h". (c_parser_omp_clause_map): Use enum gomp_map_kind instead of enum omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (c_parser_pragma): Handle PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_UPDATE. (c_parser_omp_construct): Handle PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_WAIT. (c_parser_omp_clause_name): Handle "auto", "async", "copy", "copyout", "create", "delete", "deviceptr", "gang", "host", "num_gangs", "num_workers", "present", "present_or_copy", "pcopy", "present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout", "present_or_create", "pcreate", "seq", "self", "vector", "vector_length", "wait", "worker". (OACC_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK) (OACC_ENTER_DATA_CLAUSE_MASK, OACC_EXIT_DATA_CLAUSE_MASK) (OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK) (OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros. (c_parser_omp_variable_list): Handle OMP_CLAUSE__CACHE_. (c_parser_oacc_wait_list, c_parser_oacc_data_clause) (c_parser_oacc_data_clause_deviceptr) (c_parser_omp_clause_num_gangs, c_parser_omp_clause_num_workers) (c_parser_oacc_clause_async, c_parser_oacc_clause_wait) (c_parser_omp_clause_vector_length, c_parser_oacc_all_clauses) (c_parser_oacc_cache, c_parser_oacc_data, c_parser_oacc_kernels) (c_parser_oacc_enter_exit_data, c_parser_oacc_loop) (c_parser_oacc_parallel, c_parser_oacc_update) (c_parser_oacc_wait): New functions. * c-tree.h (c_finish_oacc_parallel, c_finish_oacc_kernels) (c_finish_oacc_data): New prototypes. * c-typeck.c: Include "gomp-constants.h". (handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (c_finish_oacc_parallel, c_finish_oacc_kernels) (c_finish_oacc_data): New functions. (c_finish_omp_clauses): Handle OMP_CLAUSE__CACHE_, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, and OMP_CLAUSE_MAP's GOMP_MAP_FORCE_DEVICEPTR. gcc/cp/ * parser.c: Include "gomp-constants.h". (cp_parser_omp_clause_map): Use enum gomp_map_kind instead of enum omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (cp_parser_omp_construct, cp_parser_pragma): Handle PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_LOOP, PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT. (cp_parser_omp_clause_name): Handle "async", "copy", "copyout", "create", "delete", "deviceptr", "host", "num_gangs", "num_workers", "present", "present_or_copy", "pcopy", "present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout", "present_or_create", "pcreate", "vector_length", "wait". (OACC_DATA_CLAUSE_MASK, OACC_ENTER_DATA_CLAUSE_MASK) (OACC_EXIT_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK) (OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK) (OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros. (cp_parser_omp_var_list_no_open): Handle OMP_CLAUSE__CACHE_. (cp_parser_oacc_data_clause, cp_parser_oacc_data_clause_deviceptr) (cp_parser_oacc_clause_vector_length, cp_parser_oacc_wait_list) (cp_parser_oacc_clause_wait, cp_parser_omp_clause_num_gangs) (cp_parser_omp_clause_num_workers, cp_parser_oacc_clause_async) (cp_parser_oacc_all_clauses, cp_parser_oacc_cache) (cp_parser_oacc_data, cp_parser_oacc_enter_exit_data) (cp_parser_oacc_kernels, cp_parser_oacc_loop) (cp_parser_oacc_parallel, cp_parser_oacc_update) (cp_parser_oacc_wait): New functions. * cp-tree.h (finish_oacc_data, finish_oacc_kernels) (finish_oacc_parallel): New prototypes. * semantics.c: Include "gomp-constants.h". (handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (finish_omp_clauses): Handle OMP_CLAUSE_ASYNC, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_WAIT, OMP_CLAUSE__CACHE_. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (finish_oacc_data, finish_oacc_kernels, finish_oacc_parallel): New functions. gcc/fortran/ * lang.opt (fopenacc): New option. * cpp.c (cpp_define_builtins): Conditionally define _OPENACC. * dump-parse-tree.c (show_omp_node): Split part of it into... (show_omp_clauses): ... this new function. (show_omp_node, show_code_node): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (show_namespace): Update for OpenACC. * f95-lang.c (DEF_FUNCTION_TYPE_VAR_2, DEF_FUNCTION_TYPE_VAR_8) (DEF_FUNCTION_TYPE_VAR_12, DEF_GOACC_BUILTIN) (DEF_GOACC_BUILTIN_COMPILER): New macros. * types.def (BT_FN_VOID_INT_INT_VAR) (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR) (BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR): New function types. * gfortran.h (gfc_statement): Add ST_OACC_PARALLEL_LOOP, ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL, ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_DATA, ST_OACC_END_DATA, ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA, ST_OACC_LOOP, ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_KERNELS_LOOP, ST_OACC_END_KERNELS_LOOP, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA, ST_OACC_ROUTINE. (struct gfc_expr_list): New data type. (gfc_get_expr_list): New macro. (gfc_omp_map_op): Add OMP_MAP_FORCE_ALLOC, OMP_MAP_FORCE_DEALLOC, OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM, OMP_MAP_FORCE_TOFROM, OMP_MAP_FORCE_PRESENT, OMP_MAP_FORCE_DEVICEPTR. (OMP_LIST_FIRST, OMP_LIST_DEVICE_RESIDENT, OMP_LIST_USE_DEVICE) (OMP_LIST_CACHE): New enumerators. (struct gfc_omp_clauses): Add async_expr, gang_expr, worker_expr, vector_expr, num_gangs_expr, num_workers_expr, vector_length_expr, wait_list, tile_list, async, gang, worker, vector, seq, independent, wait, par_auto, gang_static, and loc members. (struct gfc_namespace): Add oacc_declare_clauses member. (gfc_exec_op): Add EXEC_OACC_KERNELS_LOOP, EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (gfc_free_expr_list, gfc_resolve_oacc_directive) (gfc_resolve_oacc_declare, gfc_resolve_oacc_parallel_loop_blocks) (gfc_resolve_oacc_blocks): New prototypes. * match.c (match_exit_cycle): Handle EXEC_OACC_LOOP and EXEC_OACC_PARALLEL_LOOP. * match.h (gfc_match_oacc_cache, gfc_match_oacc_wait) (gfc_match_oacc_update, gfc_match_oacc_declare) (gfc_match_oacc_loop, gfc_match_oacc_host_data) (gfc_match_oacc_data, gfc_match_oacc_kernels) (gfc_match_oacc_kernels_loop, gfc_match_oacc_parallel) (gfc_match_oacc_parallel_loop, gfc_match_oacc_enter_data) (gfc_match_oacc_exit_data, gfc_match_oacc_routine): New prototypes. * openmp.c: Include "diagnostic.h" and "gomp-constants.h". (gfc_free_omp_clauses): Update for members added to struct gfc_omp_clauses. (gfc_match_omp_clauses): Change mask paramter to uint64_t. Add openacc parameter. (resolve_omp_clauses): Add openacc parameter. Update for OpenACC. (struct fortran_omp_context): Add is_openmp member. (gfc_resolve_omp_parallel_blocks): Initialize it. (gfc_resolve_do_iterator): Update for OpenACC. (gfc_resolve_omp_directive): Call resolve_omp_directive_inside_oacc_region. (OMP_CLAUSE_PRIVATE, OMP_CLAUSE_FIRSTPRIVATE) (OMP_CLAUSE_LASTPRIVATE, OMP_CLAUSE_COPYPRIVATE) (OMP_CLAUSE_SHARED, OMP_CLAUSE_COPYIN, OMP_CLAUSE_REDUCTION) (OMP_CLAUSE_IF, OMP_CLAUSE_NUM_THREADS, OMP_CLAUSE_SCHEDULE) (OMP_CLAUSE_DEFAULT, OMP_CLAUSE_ORDERED, OMP_CLAUSE_COLLAPSE) (OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE) (OMP_CLAUSE_ALIGNED, OMP_CLAUSE_DEPEND, OMP_CLAUSE_INBRANCH) (OMP_CLAUSE_LINEAR, OMP_CLAUSE_NOTINBRANCH, OMP_CLAUSE_PROC_BIND) (OMP_CLAUSE_SAFELEN, OMP_CLAUSE_SIMDLEN, OMP_CLAUSE_UNIFORM) (OMP_CLAUSE_DEVICE, OMP_CLAUSE_MAP, OMP_CLAUSE_TO) (OMP_CLAUSE_FROM, OMP_CLAUSE_NUM_TEAMS, OMP_CLAUSE_THREAD_LIMIT) (OMP_CLAUSE_DIST_SCHEDULE): Use uint64_t. (OMP_CLAUSE_ASYNC, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS) (OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_COPY, OMP_CLAUSE_COPYOUT) (OMP_CLAUSE_CREATE, OMP_CLAUSE_PRESENT) (OMP_CLAUSE_PRESENT_OR_COPY, OMP_CLAUSE_PRESENT_OR_COPYIN) (OMP_CLAUSE_PRESENT_OR_COPYOUT, OMP_CLAUSE_PRESENT_OR_CREATE) (OMP_CLAUSE_DEVICEPTR, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER) (OMP_CLAUSE_VECTOR, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT) (OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_DEVICE_RESIDENT) (OMP_CLAUSE_HOST_SELF, OMP_CLAUSE_OACC_DEVICE, OMP_CLAUSE_WAIT) (OMP_CLAUSE_DELETE, OMP_CLAUSE_AUTO, OMP_CLAUSE_TILE): New macros. (gfc_match_omp_clauses): Handle those. (OACC_PARALLEL_CLAUSES, OACC_KERNELS_CLAUSES, OACC_DATA_CLAUSES) (OACC_LOOP_CLAUSES, OACC_PARALLEL_LOOP_CLAUSES) (OACC_KERNELS_LOOP_CLAUSES, OACC_HOST_DATA_CLAUSES) (OACC_DECLARE_CLAUSES, OACC_UPDATE_CLAUSES) (OACC_ENTER_DATA_CLAUSES, OACC_EXIT_DATA_CLAUSES) (OACC_WAIT_CLAUSES): New macros. (gfc_free_expr_list, match_oacc_expr_list, match_oacc_clause_gang) (gfc_match_omp_map_clause, gfc_match_oacc_parallel_loop) (gfc_match_oacc_parallel, gfc_match_oacc_kernels_loop) (gfc_match_oacc_kernels, gfc_match_oacc_data) (gfc_match_oacc_host_data, gfc_match_oacc_loop) (gfc_match_oacc_declare, gfc_match_oacc_update) (gfc_match_oacc_enter_data, gfc_match_oacc_exit_data) (gfc_match_oacc_wait, gfc_match_oacc_cache) (gfc_match_oacc_routine, oacc_is_loop) (resolve_oacc_scalar_int_expr, resolve_oacc_positive_int_expr) (check_symbol_not_pointer, check_array_not_assumed) (resolve_oacc_data_clauses, resolve_oacc_deviceptr_clause) (oacc_compatible_clauses, oacc_is_parallel, oacc_is_kernels) (omp_code_to_statement, oacc_code_to_statement) (resolve_oacc_directive_inside_omp_region) (resolve_omp_directive_inside_oacc_region) (resolve_oacc_nested_loops, resolve_oacc_params_in_parallel) (resolve_oacc_loop_blocks, gfc_resolve_oacc_blocks) (resolve_oacc_loop, resolve_oacc_cache, gfc_resolve_oacc_declare) (gfc_resolve_oacc_directive): New functions. * parse.c (next_free): Update for OpenACC. Move some code into... (verify_token_free): ... this new function. (next_fixed): Update for OpenACC. Move some code into... (verify_token_fixed): ... this new function. (case_executable): Add ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_ENTER_DATA, and ST_OACC_EXIT_DATA. (case_exec_markers): Add ST_OACC_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA, ST_OACC_LOOP, ST_OACC_KERNELS_LOOP. (case_decl): Add ST_OACC_ROUTINE. (push_state, parse_critical_block, parse_progunit): Update for OpenACC. (gfc_ascii_statement): Handle ST_OACC_PARALLEL_LOOP, ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL, ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_KERNELS_LOOP, ST_OACC_END_KERNELS_LOOP, ST_OACC_DATA, ST_OACC_END_DATA, ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA, ST_OACC_LOOP, ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA, ST_OACC_ROUTINE. (verify_st_order, parse_spec): Handle ST_OACC_DECLARE. (parse_executable): Handle ST_OACC_PARALLEL_LOOP, ST_OACC_KERNELS_LOOP, ST_OACC_LOOP, ST_OACC_PARALLEL, ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA. (decode_oacc_directive, parse_oacc_structured_block) (parse_oacc_loop, is_oacc): New functions. * parse.h (struct gfc_state_data): Add oacc_declare_clauses member. (is_oacc): New prototype. * resolve.c (gfc_resolve_blocks, gfc_resolve_code): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (resolve_codes): Call gfc_resolve_oacc_declare. * scanner.c (openacc_flag, openacc_locus): New variables. (skip_free_comments): Update for OpenACC. Move some code into... (skip_omp_attribute): ... this new function. (skip_oacc_attribute): New function. (skip_fixed_comments, gfc_next_char_literal): Update for OpenACC. * st.c (gfc_free_statement): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. * trans-decl.c (gfc_generate_function_code): Update for OpenACC. * trans-openmp.c: Include "gomp-constants.h". (gfc_omp_finish_clause, gfc_trans_omp_clauses): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (gfc_trans_omp_clauses): Handle OMP_LIST_USE_DEVICE, OMP_LIST_DEVICE_RESIDENT, OMP_LIST_CACHE, and OMP_MAP_FORCE_ALLOC, OMP_MAP_FORCE_DEALLOC, OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM, OMP_MAP_FORCE_TOFROM, OMP_MAP_FORCE_PRESENT, OMP_MAP_FORCE_DEVICEPTR, and gfc_omp_clauses' async, seq, independent, wait_list, num_gangs_expr, num_workers_expr, vector_length_expr, vector, vector_expr, worker, worker_expr, gang, gang_expr members. (gfc_trans_omp_do): Handle EXEC_OACC_LOOP. (gfc_convert_expr_to_tree, gfc_trans_oacc_construct) (gfc_trans_oacc_executable_directive) (gfc_trans_oacc_wait_directive, gfc_trans_oacc_combined_directive) (gfc_trans_oacc_declare, gfc_trans_oacc_directive): New functions. * trans-stmt.c (gfc_trans_block_construct): Update for OpenACC. * trans-stmt.h (gfc_trans_oacc_directive, gfc_trans_oacc_declare): New prototypes. * trans.c (tranc_code): Handle EXEC_OACC_CACHE, EXEC_OACC_WAIT, EXEC_OACC_UPDATE, EXEC_OACC_LOOP, EXEC_OACC_HOST_DATA, EXEC_OACC_DATA, EXEC_OACC_KERNELS, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. * gfortran.texi: Update for OpenACC. * intrinsic.texi: Likewise. * invoke.texi: Likewise. gcc/lto/ * lto-lang.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): New macros. * lto.c: Include "gomp-constants.h". gcc/testsuite/ * lib/target-supports.exp (check_effective_target_fopenacc): New procedure. * g++.dg/goacc-gomp/goacc-gomp.exp: New file. * g++.dg/goacc/goacc.exp: Likewise. * gcc.dg/goacc-gomp/goacc-gomp.exp: Likewise. * gcc.dg/goacc/goacc.exp: Likewise. * gfortran.dg/goacc/goacc.exp: Likewise. * c-c++-common/cpp/openacc-define-1.c: New file. * c-c++-common/cpp/openacc-define-2.c: Likewise. * c-c++-common/cpp/openacc-define-3.c: Likewise. * c-c++-common/goacc-gomp/nesting-1.c: Likewise. * c-c++-common/goacc-gomp/nesting-fail-1.c: Likewise. * c-c++-common/goacc/acc_on_device-2-off.c: Likewise. * c-c++-common/goacc/acc_on_device-2.c: Likewise. * c-c++-common/goacc/asyncwait-1.c: Likewise. * c-c++-common/goacc/cache-1.c: Likewise. * c-c++-common/goacc/clauses-fail.c: Likewise. * c-c++-common/goacc/collapse-1.c: Likewise. * c-c++-common/goacc/data-1.c: Likewise. * c-c++-common/goacc/data-2.c: Likewise. * c-c++-common/goacc/data-clause-duplicate-1.c: Likewise. * c-c++-common/goacc/deviceptr-1.c: Likewise. * c-c++-common/goacc/deviceptr-2.c: Likewise. * c-c++-common/goacc/deviceptr-3.c: Likewise. * c-c++-common/goacc/if-clause-1.c: Likewise. * c-c++-common/goacc/if-clause-2.c: Likewise. * c-c++-common/goacc/kernels-1.c: Likewise. * c-c++-common/goacc/loop-1.c: Likewise. * c-c++-common/goacc/loop-private-1.c: Likewise. * c-c++-common/goacc/nesting-1.c: Likewise. * c-c++-common/goacc/nesting-data-1.c: Likewise. * c-c++-common/goacc/nesting-fail-1.c: Likewise. * c-c++-common/goacc/parallel-1.c: Likewise. * c-c++-common/goacc/pcopy.c: Likewise. * c-c++-common/goacc/pcopyin.c: Likewise. * c-c++-common/goacc/pcopyout.c: Likewise. * c-c++-common/goacc/pcreate.c: Likewise. * c-c++-common/goacc/pragma_context.c: Likewise. * c-c++-common/goacc/present-1.c: Likewise. * c-c++-common/goacc/reduction-1.c: Likewise. * c-c++-common/goacc/reduction-2.c: Likewise. * c-c++-common/goacc/reduction-3.c: Likewise. * c-c++-common/goacc/reduction-4.c: Likewise. * c-c++-common/goacc/sb-1.c: Likewise. * c-c++-common/goacc/sb-2.c: Likewise. * c-c++-common/goacc/sb-3.c: Likewise. * c-c++-common/goacc/update-1.c: Likewise. * gcc.dg/goacc/acc_on_device-1.c: Likewise. * gfortran.dg/goacc/acc_on_device-1.f95: Likewise. * gfortran.dg/goacc/acc_on_device-2-off.f95: Likewise. * gfortran.dg/goacc/acc_on_device-2.f95: Likewise. * gfortran.dg/goacc/assumed.f95: Likewise. * gfortran.dg/goacc/asyncwait-1.f95: Likewise. * gfortran.dg/goacc/asyncwait-2.f95: Likewise. * gfortran.dg/goacc/asyncwait-3.f95: Likewise. * gfortran.dg/goacc/asyncwait-4.f95: Likewise. * gfortran.dg/goacc/branch.f95: Likewise. * gfortran.dg/goacc/cache-1.f95: Likewise. * gfortran.dg/goacc/coarray.f95: Likewise. * gfortran.dg/goacc/continuation-free-form.f95: Likewise. * gfortran.dg/goacc/cray.f95: Likewise. * gfortran.dg/goacc/critical.f95: Likewise. * gfortran.dg/goacc/data-clauses.f95: Likewise. * gfortran.dg/goacc/data-tree.f95: Likewise. * gfortran.dg/goacc/declare-1.f95: Likewise. * gfortran.dg/goacc/enter-exit-data.f95: Likewise. * gfortran.dg/goacc/fixed-1.f: Likewise. * gfortran.dg/goacc/fixed-2.f: Likewise. * gfortran.dg/goacc/fixed-3.f: Likewise. * gfortran.dg/goacc/fixed-4.f: Likewise. * gfortran.dg/goacc/host_data-tree.f95: Likewise. * gfortran.dg/goacc/if.f95: Likewise. * gfortran.dg/goacc/kernels-tree.f95: Likewise. * gfortran.dg/goacc/list.f95: Likewise. * gfortran.dg/goacc/literal.f95: Likewise. * gfortran.dg/goacc/loop-1.f95: Likewise. * gfortran.dg/goacc/loop-2.f95: Likewise. * gfortran.dg/goacc/loop-3.f95: Likewise. * gfortran.dg/goacc/loop-tree-1.f90: Likewise. * gfortran.dg/goacc/omp.f95: Likewise. * gfortran.dg/goacc/parallel-kernels-clauses.f95: Likewise. * gfortran.dg/goacc/parallel-kernels-regions.f95: Likewise. * gfortran.dg/goacc/parallel-tree.f95: Likewise. * gfortran.dg/goacc/parameter.f95: Likewise. * gfortran.dg/goacc/private-1.f95: Likewise. * gfortran.dg/goacc/private-2.f95: Likewise. * gfortran.dg/goacc/private-3.f95: Likewise. * gfortran.dg/goacc/pure-elemental-procedures.f95: Likewise. * gfortran.dg/goacc/reduction-2.f95: Likewise. * gfortran.dg/goacc/reduction.f95: Likewise. * gfortran.dg/goacc/routine-1.f90: Likewise. * gfortran.dg/goacc/routine-2.f90: Likewise. * gfortran.dg/goacc/sentinel-free-form.f95: Likewise. * gfortran.dg/goacc/several-directives.f95: Likewise. * gfortran.dg/goacc/sie.f95: Likewise. * gfortran.dg/goacc/subarrays.f95: Likewise. * gfortran.dg/gomp/map-1.f90: Likewise. * gfortran.dg/openacc-define-1.f90: Likewise. * gfortran.dg/openacc-define-2.f90: Likewise. * gfortran.dg/openacc-define-3.f90: Likewise. * g++.dg/gomp/block-1.C: Update for changed compiler output. * g++.dg/gomp/block-2.C: Likewise. * g++.dg/gomp/block-3.C: Likewise. * g++.dg/gomp/block-5.C: Likewise. * g++.dg/gomp/target-1.C: Likewise. * g++.dg/gomp/target-2.C: Likewise. * g++.dg/gomp/taskgroup-1.C: Likewise. * g++.dg/gomp/teams-1.C: Likewise. * gcc.dg/cilk-plus/jump-openmp.c: Likewise. * gcc.dg/cilk-plus/jump.c: Likewise. * gcc.dg/gomp/block-1.c: Likewise. * gcc.dg/gomp/block-10.c: Likewise. * gcc.dg/gomp/block-2.c: Likewise. * gcc.dg/gomp/block-3.c: Likewise. * gcc.dg/gomp/block-4.c: Likewise. * gcc.dg/gomp/block-5.c: Likewise. * gcc.dg/gomp/block-6.c: Likewise. * gcc.dg/gomp/block-7.c: Likewise. * gcc.dg/gomp/block-8.c: Likewise. * gcc.dg/gomp/block-9.c: Likewise. * gcc.dg/gomp/target-1.c: Likewise. * gcc.dg/gomp/target-2.c: Likewise. * gcc.dg/gomp/taskgroup-1.c: Likewise. * gcc.dg/gomp/teams-1.c: Likewise. include/ * gomp-constants.h: New file. libgomp/ * Makefile.am (search_path): Add $(top_srcdir)/../include. (libgomp_la_SOURCES): Add splay-tree.c, libgomp-plugin.c, oacc-parallel.c, oacc-host.c, oacc-init.c, oacc-mem.c, oacc-async.c, oacc-plugin.c, oacc-cuda.c. [USE_FORTRAN] (libgomp_la_SOURCES): Add openacc.f90. Include $(top_srcdir)/plugin/Makefrag.am. (nodist_libsubinclude_HEADERS): Add openacc.h. [USE_FORTRAN] (nodist_finclude_HEADERS): Add openacc_lib.h, openacc.f90, openacc.mod, openacc_kinds.mod. (omp_lib.mod): Generalize into... (%.mod): ... this new rule. (openacc_kinds.mod, openacc.mod): New rules. * plugin/configfrag.ac: New file. * configure.ac: Move plugin/offloading support into it. Include it. Instantiate testsuite/libgomp-test-support.pt.exp. * plugin/Makefrag.am: New file. * testsuite/Makefile.am (OFFLOAD_TARGETS) (OFFLOAD_ADDITIONAL_OPTIONS, OFFLOAD_ADDITIONAL_LIB_PATHS): Don't export. (libgomp-test-support.exp): New rule. (all-local): Depend on it. * Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. * config.h.in: Likewise. * configure: Likewise. * configure.tgt: Harden shell syntax. * env.c: Include "oacc-int.h". (parse_acc_device_type): New function. (gomp_debug_var, goacc_device_type, goacc_device_num): New variables. (initialize_env): Initialize those. Call goacc_runtime_initialize. * error.c (gomp_vdebug, gomp_debug, gomp_vfatal): New functions. (gomp_fatal): Call gomp_vfatal. * libgomp.h: Include "libgomp-plugin.h" and <stdarg.h>. (gomp_debug_var, goacc_device_type, goacc_device_num, gomp_vdebug) (gomp_debug, gomp_verror, gomp_vfatal, gomp_init_targets_once) (splay_tree_node, splay_tree, splay_tree_key) (struct target_mem_desc, struct splay_tree_key_s) (struct gomp_memory_mapping, struct acc_dispatch_t) (struct gomp_device_descr, gomp_acc_insert_pointer) (gomp_acc_remove_pointer, target_mem_desc, gomp_copy_from_async) (gomp_unmap_vars, gomp_init_device, gomp_init_tables) (gomp_free_memmap, gomp_fini_device): New declarations. (gomp_vdebug, gomp_debug): New macros. Include "splay-tree.h". * libgomp.map (OACC_2.0): New symbol version. Use for acc_get_num_devices, acc_get_num_devices_h_, acc_set_device_type, acc_set_device_type_h_, acc_get_device_type, acc_get_device_type_h_, acc_set_device_num, acc_set_device_num_h_, acc_get_device_num, acc_get_device_num_h_, acc_async_test, acc_async_test_h_, acc_async_test_all, acc_async_test_all_h_, acc_wait, acc_wait_h_, acc_wait_async, acc_wait_async_h_, acc_wait_all, acc_wait_all_h_, acc_wait_all_async, acc_wait_all_async_h_, acc_init, acc_init_h_, acc_shutdown, acc_shutdown_h_, acc_on_device, acc_on_device_h_, acc_malloc, acc_free, acc_copyin, acc_copyin_32_h_, acc_copyin_64_h_, acc_copyin_array_h_, acc_present_or_copyin, acc_present_or_copyin_32_h_, acc_present_or_copyin_64_h_, acc_present_or_copyin_array_h_, acc_create, acc_create_32_h_, acc_create_64_h_, acc_create_array_h_, acc_present_or_create, acc_present_or_create_32_h_, acc_present_or_create_64_h_, acc_present_or_create_array_h_, acc_copyout, acc_copyout_32_h_, acc_copyout_64_h_, acc_copyout_array_h_, acc_delete, acc_delete_32_h_, acc_delete_64_h_, acc_delete_array_h_, acc_update_device, acc_update_device_32_h_, acc_update_device_64_h_, acc_update_device_array_h_, acc_update_self, acc_update_self_32_h_, acc_update_self_64_h_, acc_update_self_array_h_, acc_map_data, acc_unmap_data, acc_deviceptr, acc_hostptr, acc_is_present, acc_is_present_32_h_, acc_is_present_64_h_, acc_is_present_array_h_, acc_memcpy_to_device, acc_memcpy_from_device, acc_get_current_cuda_device, acc_get_current_cuda_context, acc_get_cuda_stream, acc_set_cuda_stream. (GOACC_2.0): New symbol version. Use for GOACC_data_end, GOACC_data_start, GOACC_enter_exit_data, GOACC_parallel, GOACC_update, GOACC_wait, GOACC_get_thread_num, GOACC_get_num_threads. (GOMP_PLUGIN_1.0): New symbol version. Use for GOMP_PLUGIN_malloc, GOMP_PLUGIN_malloc_cleared, GOMP_PLUGIN_realloc, GOMP_PLUGIN_debug, GOMP_PLUGIN_error, GOMP_PLUGIN_fatal, GOMP_PLUGIN_async_unmap_vars, GOMP_PLUGIN_acc_thread. * libgomp.texi: Update for OpenACC changes, and GOMP_DEBUG environment variable. * libgomp_g.h (GOACC_data_start, GOACC_data_end) (GOACC_enter_exit_data, GOACC_parallel, GOACC_update, GOACC_wait) (GOACC_get_num_threads, GOACC_get_thread_num): New declarations. * splay-tree.h (splay_tree_lookup, splay_tree_insert) (splay_tree_remove): New declarations. (rotate_left, rotate_right, splay_tree_splay, splay_tree_insert) (splay_tree_remove, splay_tree_lookup): Move into... * splay-tree.c: ... this new file. * target.c: Include "oacc-plugin.h", "oacc-int.h", <assert.h>. (splay_tree_node, splay_tree, splay_tree_key) (struct target_mem_desc, struct splay_tree_key_s) (struct gomp_device_descr): Don't declare. (num_devices_openmp): New variable. (gomp_get_num_devices ): Use it. (gomp_init_targets_once): New function. (gomp_get_num_devices ): Use it. (get_kind, gomp_copy_from_async, gomp_free_memmap) (gomp_fini_device, gomp_register_image_for_device): New functions. (gomp_map_vars): Add devaddrs parameter. (gomp_update): Add mm parameter. (gomp_init_device): Move most of it into... (gomp_init_tables): ... this new function. (gomp_register_images_for_device): Remove function. (splay_compare, gomp_map_vars, gomp_unmap_vars, gomp_init_device): Make them hidden instead of static. (gomp_map_vars_existing, gomp_map_vars, gomp_unmap_vars) (gomp_update, gomp_init_device, GOMP_target, GOMP_target_data) (GOMP_target_end_data, GOMP_target_update) (gomp_load_plugin_for_device, gomp_target_init): Update for OpenACC changes. * oacc-async.c: New file. * oacc-cuda.c: Likewise. * oacc-host.c: Likewise. * oacc-init.c: Likewise. * oacc-int.h: Likewise. * oacc-mem.c: Likewise. * oacc-parallel.c: Likewise. * oacc-plugin.c: Likewise. * oacc-plugin.h: Likewise. * oacc-ptx.h: Likewise. * openacc.f90: Likewise. * openacc.h: Likewise. * openacc_lib.h: Likewise. * plugin/plugin-host.c: Likewise. * plugin/plugin-nvptx.c: Likewise. * libgomp-plugin.c: Likewise. * libgomp-plugin.h: Likewise. * libgomp_target.h: Remove file after merging content into the former file. Update all users. * testsuite/lib/libgomp.exp: Load libgomp-test-support.exp. (offload_targets_s, offload_targets_s_openacc): New variables. (check_effective_target_openacc_nvidia_accel_present) (check_effective_target_openacc_nvidia_accel_selected): New procedures. (libgomp_init): Update for OpenACC changes. * testsuite/libgomp-test-support.exp.in: New file. * testsuite/libgomp.oacc-c++/c++.exp: Likewise. * testsuite/libgomp.oacc-c/c.exp: Likewise. * testsuite/libgomp.oacc-fortran/fortran.exp: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/asyncwait-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/cache-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/clauses-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/clauses-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-6.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-7.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-8.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/deviceptr-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/if-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/kernels-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/kernels-empty.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-10.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-11.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-12.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-13.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-14.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-15.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-16.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-17.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-18.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-19.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-20.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-21.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-22.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-23.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-24.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-25.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-26.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-27.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-28.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-29.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-30.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-31.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-32.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-33.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-34.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-35.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-36.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-37.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-38.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-39.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-40.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-41.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-42.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-43.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-44.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-45.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-46.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-47.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-48.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-49.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-50.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-51.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-52.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-53.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-54.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-55.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-56.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-57.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-58.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-59.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-6.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-60.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-61.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-62.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-63.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-64.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-65.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-66.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-67.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-68.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-69.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-7.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-70.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-71.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-72.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-73.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-74.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-75.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-76.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-77.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-78.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-79.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-80.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-81.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-82.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-83.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-84.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-85.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-86.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-87.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-88.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-89.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-9.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-90.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-91.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-92.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/nested-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/nested-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/offset-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/parallel-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/parallel-empty.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/pointer-align-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/present-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/present-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-initial-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/subr.h: Likewise. * testsuite/libgomp.oacc-c-c++-common/subr.ptx: Likewise. * testsuite/libgomp.oacc-c-c++-common/timer.h: Likewise. * testsuite/libgomp.oacc-c-c++-common/update-1-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/update-1.c: Likewise. * testsuite/libgomp.oacc-fortran/abort-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/abort-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-7.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-8.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-4-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-already-1.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-2.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-3.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-4.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-5.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-6.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-7.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-8.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-10.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-2.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-3.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-7.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-8.f90: Likewise. * testsuite/libgomp.oacc-fortran/map-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/openacc_version-1.f: Likewise. * testsuite/libgomp.oacc-fortran/openacc_version-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/pointer-align-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/pset-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/subarrays-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/subarrays-2.f90: Likewise. liboffloadmic/ * plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_get_name) (GOMP_OFFLOAD_get_caps, GOMP_OFFLOAD_fini_device): New functions. Co-Authored-By: Bernd Schmidt <bernds@codesourcery.com> Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com> Co-Authored-By: Dmitry Bocharnikov <dmitry.b@samsung.com> Co-Authored-By: Evgeny Gavrin <e.gavrin@samsung.com> Co-Authored-By: Ilmir Usmanov <i.usmanov@samsung.com> Co-Authored-By: Jakub Jelinek <jakub@redhat.com> Co-Authored-By: James Norris <jnorris@codesourcery.com> Co-Authored-By: Julian Brown <julian@codesourcery.com> Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> Co-Authored-By: Tom de Vries <tom@codesourcery.com> From-SVN: r219682
2015-01-15 21:11:12 +01:00
@subtitle The GNU OpenMP and OpenACC Implementation
@page
@vskip 0pt plus 1filll
@comment For the @value{version-GCC} Version*
@sp 1
Published by the Free Software Foundation @*
51 Franklin Street, Fifth Floor@*
Boston, MA 02110-1301, USA@*
@sp 1
@insertcopying
@end titlepage
@summarycontents
@contents
@page
@node Top
@top Introduction
@cindex Introduction
This manual documents the usage of libgomp, the GNU Offloading and
Merge current set of OpenACC changes from gomp-4_0-branch. contrib/ * gcc_update (files_and_dependencies): Update rules for new libgomp/plugin/Makefrag.am and libgomp/plugin/configfrag.ac files. gcc/ * builtin-types.def (BT_FN_VOID_INT_INT_VAR) (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR) (BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR): New function types. * builtins.c: Include "gomp-constants.h". (expand_builtin_acc_on_device): New function. (expand_builtin, is_inexpensive_builtin): Handle BUILT_IN_ACC_ON_DEVICE. * builtins.def (DEF_GOACC_BUILTIN, DEF_GOACC_BUILTIN_COMPILER): New macros. * cgraph.c (cgraph_node::create): Consider flag_openacc next to flag_openmp. * config.gcc <nvptx-*> (tm_file): Add nvptx/offload.h. <*-intelmic-* | *-intelmicemul-*> (tm_file): Add i386/intelmic-offload.h. * gcc.c (LINK_COMMAND_SPEC, GOMP_SELF_SPECS): For -fopenacc, link to libgomp and its dependencies. * config/arc/arc.h (LINK_COMMAND_SPEC): Likewise. * config/darwin.h (LINK_COMMAND_SPEC_A): Likewise. * config/i386/mingw32.h (GOMP_SELF_SPECS): Likewise. * config/ia64/hpux.h (LIB_SPEC): Likewise. * config/pa/pa-hpux11.h (LIB_SPEC): Likewise. * config/pa/pa64-hpux.h (LIB_SPEC): Likewise. * doc/generic.texi: Update for OpenACC changes. * doc/gimple.texi: Likewise. * doc/invoke.texi: Likewise. * doc/sourcebuild.texi: Likewise. * gimple-pretty-print.c (dump_gimple_omp_for): Handle GF_OMP_FOR_KIND_OACC_LOOP. (dump_gimple_omp_target): Handle GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_DATA, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA. Dump more data. * gimple.c: Update comments for OpenACC changes. * gimple.def: Likewise. * gimple.h: Likewise. (enum gf_mask): Add GF_OMP_FOR_KIND_OACC_LOOP, GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_DATA, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA. (gimple_omp_for_cond, gimple_omp_for_set_cond): Sort in the appropriate place. (is_gimple_omp_oacc, is_gimple_omp_offloaded): New functions. * gimplify.c: Include "gomp-constants.h". Update comments for OpenACC changes. (is_gimple_stmt): Handle OACC_PARALLEL, OACC_KERNELS, OACC_DATA, OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle OMP_CLAUSE__CACHE_, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ. (gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (gimplify_oacc_cache): New function. (gimplify_omp_for): Handle OACC_LOOP. (gimplify_omp_workshare): Handle OACC_KERNELS, OACC_PARALLEL, OACC_DATA. (gimplify_omp_target_update): Handle OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE. (gimplify_expr): Handle OACC_LOOP, OACC_CACHE, OACC_HOST_DATA, OACC_DECLARE, OACC_KERNELS, OACC_PARALLEL, OACC_DATA, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE. (gimplify_body): Consider flag_openacc next to flag_openmp. * lto-streamer-out.c: Include "gomp-constants.h". * omp-builtins.def (BUILT_IN_ACC_GET_DEVICE_TYPE) (BUILT_IN_GOACC_DATA_START, BUILT_IN_GOACC_DATA_END) (BUILT_IN_GOACC_ENTER_EXIT_DATA, BUILT_IN_GOACC_PARALLEL) (BUILT_IN_GOACC_UPDATE, BUILT_IN_GOACC_WAIT) (BUILT_IN_GOACC_GET_THREAD_NUM, BUILT_IN_GOACC_GET_NUM_THREADS) (BUILT_IN_ACC_ON_DEVICE): New builtins. * omp-low.c: Include "gomp-constants.h". Update comments for OpenACC changes. (struct omp_context): Add reduction_map, gwv_below, gwv_this members. (extract_omp_for_data, use_pointer_for_field, install_var_field) (new_omp_context, delete_omp_context, scan_sharing_clauses) (create_omp_child_function, scan_omp_for, scan_omp_target) (check_omp_nesting_restrictions, lower_reduction_clauses) (build_omp_regions_1, diagnose_sb_0, make_gimple_omp_edges): Update for OpenACC changes. (scan_sharing_clauses): Handle OMP_CLAUSE_NUM_GANGS: OMP_CLAUSE_NUM_WORKERS: OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Handle GF_OMP_FOR_KIND_OACC_LOOP. (expand_omp_target, lower_omp_target): Handle GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA, GF_OMP_TARGET_KIND_OACC_DATA. (pass_expand_omp::execute, execute_lower_omp) (pass_diagnose_omp_blocks::gate): Consider flag_openacc next to flag_openmp. (offload_symbol_decl): New variable. (oacc_get_reduction_array_id, oacc_max_threads) (get_offload_symbol_decl, get_base_type, lookup_oacc_reduction) (maybe_lookup_oacc_reduction, enclosing_target_ctx) (oacc_loop_or_target_p, oacc_lower_reduction_var_helper) (oacc_gimple_assign, oacc_initialize_reduction_data) (oacc_finalize_reduction_data, oacc_process_reduction_data): New functions. (is_targetreg_ctx): Remove function. * tree-core.h (enum omp_clause_code): Add OMP_CLAUSE__CACHE_, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_GANG, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH. * tree.c (omp_clause_code_name, walk_tree_1): Update accordingly. * tree.h (OMP_CLAUSE_GANG_EXPR, OMP_CLAUSE_GANG_STATIC_EXPR) (OMP_CLAUSE_ASYNC_EXPR, OMP_CLAUSE_WAIT_EXPR) (OMP_CLAUSE_VECTOR_EXPR, OMP_CLAUSE_WORKER_EXPR) (OMP_CLAUSE_NUM_GANGS_EXPR, OMP_CLAUSE_NUM_WORKERS_EXPR) (OMP_CLAUSE_VECTOR_LENGTH_EXPR): New macros. * tree-core.h: Update comments for OpenACC changes. (enum omp_clause_map_kind): Remove. (struct tree_omp_clause): Change type of map_kind member from enum omp_clause_map_kind to unsigned char. * tree-inline.c: Update comments for OpenACC changes. * tree-nested.c: Likewise. Include "gomp-constants.h". (convert_nonlocal_reference_stmt, convert_local_reference_stmt) (convert_tramp_reference_stmt, convert_gimple_call): Update for OpenACC changes. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. * tree-pretty-print.c: Include "gomp-constants.h". (dump_omp_clause): Handle OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_GANG, OMP_CLAUSE_ASYNC, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_WAIT, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_INDEPENDENT. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (dump_generic_node): Handle OACC_PARALLEL, OACC_KERNELS, OACC_DATA, OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP. * tree-streamer-in.c: Include "gomp-constants.h". (unpack_ts_omp_clause_value_fields) Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. * tree-streamer-out.c: Include "gomp-constants.h". (pack_ts_omp_clause_value_fields): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. * tree.def (OACC_PARALLEL, OACC_KERNELS, OACC_DATA) (OACC_HOST_DATA, OACC_LOOP, OACC_CACHE, OACC_DECLARE) (OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE): New tree codes. * tree.c (omp_clause_num_ops): Update accordingly. * tree.h (OMP_BODY, OMP_CLAUSES, OMP_LOOP_CHECK, OMP_CLAUSE_SIZE): Likewise. (OACC_PARALLEL_BODY, OACC_PARALLEL_CLAUSES, OACC_KERNELS_BODY) (OACC_KERNELS_CLAUSES, OACC_DATA_BODY, OACC_DATA_CLAUSES) (OACC_HOST_DATA_BODY, OACC_HOST_DATA_CLAUSES, OACC_CACHE_CLAUSES) (OACC_DECLARE_CLAUSES, OACC_ENTER_DATA_CLAUSES) (OACC_EXIT_DATA_CLAUSES, OACC_UPDATE_CLAUSES) (OACC_KERNELS_COMBINED, OACC_PARALLEL_COMBINED): New macros. * tree.h (OMP_CLAUSE_MAP_KIND): Cast it to enum gomp_map_kind. (OMP_CLAUSE_SET_MAP_KIND): New macro. * varpool.c (varpool_node::get_create): Consider flag_openacc next to flag_openmp. * config/i386/intelmic-offload.h: New file. * config/nvptx/offload.h: Likewise. gcc/ada/ * gcc-interface/utils.c (DEF_FUNCTION_TYPE_VAR_8) (DEF_FUNCTION_TYPE_VAR_12): New macros. gcc/c-family/ * c.opt (fopenacc): New option. * c-cppbuiltin.c (c_cpp_builtins): Conditionally define _OPENACC. * c-common.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): New macros. * c-common.h (c_finish_oacc_wait): New prototype. * c-omp.c: Include "omp-low.h" and "gomp-constants.h". (c_finish_oacc_wait): New function. * c-pragma.c (oacc_pragmas): New variable. (c_pp_lookup_pragma, init_pragma): Handle it. * c-pragma.h (enum pragma_kind): Add PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT. (enum pragma_omp_clause): Add PRAGMA_OACC_CLAUSE_ASYNC, PRAGMA_OACC_CLAUSE_AUTO, PRAGMA_OACC_CLAUSE_COLLAPSE, PRAGMA_OACC_CLAUSE_COPY, PRAGMA_OACC_CLAUSE_COPYIN, PRAGMA_OACC_CLAUSE_COPYOUT, PRAGMA_OACC_CLAUSE_CREATE, PRAGMA_OACC_CLAUSE_DELETE, PRAGMA_OACC_CLAUSE_DEVICE, PRAGMA_OACC_CLAUSE_DEVICEPTR, PRAGMA_OACC_CLAUSE_FIRSTPRIVATE, PRAGMA_OACC_CLAUSE_GANG, PRAGMA_OACC_CLAUSE_HOST, PRAGMA_OACC_CLAUSE_IF, PRAGMA_OACC_CLAUSE_NUM_GANGS, PRAGMA_OACC_CLAUSE_NUM_WORKERS, PRAGMA_OACC_CLAUSE_PRESENT, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPY, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYIN, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYOUT, PRAGMA_OACC_CLAUSE_PRESENT_OR_CREATE, PRAGMA_OACC_CLAUSE_PRIVATE, PRAGMA_OACC_CLAUSE_REDUCTION, PRAGMA_OACC_CLAUSE_SELF, PRAGMA_OACC_CLAUSE_SEQ, PRAGMA_OACC_CLAUSE_VECTOR, PRAGMA_OACC_CLAUSE_VECTOR_LENGTH, PRAGMA_OACC_CLAUSE_WAIT, PRAGMA_OACC_CLAUSE_WORKER. gcc/c/ * c-parser.c: Include "gomp-constants.h". (c_parser_omp_clause_map): Use enum gomp_map_kind instead of enum omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (c_parser_pragma): Handle PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_UPDATE. (c_parser_omp_construct): Handle PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_WAIT. (c_parser_omp_clause_name): Handle "auto", "async", "copy", "copyout", "create", "delete", "deviceptr", "gang", "host", "num_gangs", "num_workers", "present", "present_or_copy", "pcopy", "present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout", "present_or_create", "pcreate", "seq", "self", "vector", "vector_length", "wait", "worker". (OACC_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK) (OACC_ENTER_DATA_CLAUSE_MASK, OACC_EXIT_DATA_CLAUSE_MASK) (OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK) (OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros. (c_parser_omp_variable_list): Handle OMP_CLAUSE__CACHE_. (c_parser_oacc_wait_list, c_parser_oacc_data_clause) (c_parser_oacc_data_clause_deviceptr) (c_parser_omp_clause_num_gangs, c_parser_omp_clause_num_workers) (c_parser_oacc_clause_async, c_parser_oacc_clause_wait) (c_parser_omp_clause_vector_length, c_parser_oacc_all_clauses) (c_parser_oacc_cache, c_parser_oacc_data, c_parser_oacc_kernels) (c_parser_oacc_enter_exit_data, c_parser_oacc_loop) (c_parser_oacc_parallel, c_parser_oacc_update) (c_parser_oacc_wait): New functions. * c-tree.h (c_finish_oacc_parallel, c_finish_oacc_kernels) (c_finish_oacc_data): New prototypes. * c-typeck.c: Include "gomp-constants.h". (handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (c_finish_oacc_parallel, c_finish_oacc_kernels) (c_finish_oacc_data): New functions. (c_finish_omp_clauses): Handle OMP_CLAUSE__CACHE_, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, and OMP_CLAUSE_MAP's GOMP_MAP_FORCE_DEVICEPTR. gcc/cp/ * parser.c: Include "gomp-constants.h". (cp_parser_omp_clause_map): Use enum gomp_map_kind instead of enum omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (cp_parser_omp_construct, cp_parser_pragma): Handle PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_LOOP, PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT. (cp_parser_omp_clause_name): Handle "async", "copy", "copyout", "create", "delete", "deviceptr", "host", "num_gangs", "num_workers", "present", "present_or_copy", "pcopy", "present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout", "present_or_create", "pcreate", "vector_length", "wait". (OACC_DATA_CLAUSE_MASK, OACC_ENTER_DATA_CLAUSE_MASK) (OACC_EXIT_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK) (OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK) (OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros. (cp_parser_omp_var_list_no_open): Handle OMP_CLAUSE__CACHE_. (cp_parser_oacc_data_clause, cp_parser_oacc_data_clause_deviceptr) (cp_parser_oacc_clause_vector_length, cp_parser_oacc_wait_list) (cp_parser_oacc_clause_wait, cp_parser_omp_clause_num_gangs) (cp_parser_omp_clause_num_workers, cp_parser_oacc_clause_async) (cp_parser_oacc_all_clauses, cp_parser_oacc_cache) (cp_parser_oacc_data, cp_parser_oacc_enter_exit_data) (cp_parser_oacc_kernels, cp_parser_oacc_loop) (cp_parser_oacc_parallel, cp_parser_oacc_update) (cp_parser_oacc_wait): New functions. * cp-tree.h (finish_oacc_data, finish_oacc_kernels) (finish_oacc_parallel): New prototypes. * semantics.c: Include "gomp-constants.h". (handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (finish_omp_clauses): Handle OMP_CLAUSE_ASYNC, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_WAIT, OMP_CLAUSE__CACHE_. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (finish_oacc_data, finish_oacc_kernels, finish_oacc_parallel): New functions. gcc/fortran/ * lang.opt (fopenacc): New option. * cpp.c (cpp_define_builtins): Conditionally define _OPENACC. * dump-parse-tree.c (show_omp_node): Split part of it into... (show_omp_clauses): ... this new function. (show_omp_node, show_code_node): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (show_namespace): Update for OpenACC. * f95-lang.c (DEF_FUNCTION_TYPE_VAR_2, DEF_FUNCTION_TYPE_VAR_8) (DEF_FUNCTION_TYPE_VAR_12, DEF_GOACC_BUILTIN) (DEF_GOACC_BUILTIN_COMPILER): New macros. * types.def (BT_FN_VOID_INT_INT_VAR) (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR) (BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR): New function types. * gfortran.h (gfc_statement): Add ST_OACC_PARALLEL_LOOP, ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL, ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_DATA, ST_OACC_END_DATA, ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA, ST_OACC_LOOP, ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_KERNELS_LOOP, ST_OACC_END_KERNELS_LOOP, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA, ST_OACC_ROUTINE. (struct gfc_expr_list): New data type. (gfc_get_expr_list): New macro. (gfc_omp_map_op): Add OMP_MAP_FORCE_ALLOC, OMP_MAP_FORCE_DEALLOC, OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM, OMP_MAP_FORCE_TOFROM, OMP_MAP_FORCE_PRESENT, OMP_MAP_FORCE_DEVICEPTR. (OMP_LIST_FIRST, OMP_LIST_DEVICE_RESIDENT, OMP_LIST_USE_DEVICE) (OMP_LIST_CACHE): New enumerators. (struct gfc_omp_clauses): Add async_expr, gang_expr, worker_expr, vector_expr, num_gangs_expr, num_workers_expr, vector_length_expr, wait_list, tile_list, async, gang, worker, vector, seq, independent, wait, par_auto, gang_static, and loc members. (struct gfc_namespace): Add oacc_declare_clauses member. (gfc_exec_op): Add EXEC_OACC_KERNELS_LOOP, EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (gfc_free_expr_list, gfc_resolve_oacc_directive) (gfc_resolve_oacc_declare, gfc_resolve_oacc_parallel_loop_blocks) (gfc_resolve_oacc_blocks): New prototypes. * match.c (match_exit_cycle): Handle EXEC_OACC_LOOP and EXEC_OACC_PARALLEL_LOOP. * match.h (gfc_match_oacc_cache, gfc_match_oacc_wait) (gfc_match_oacc_update, gfc_match_oacc_declare) (gfc_match_oacc_loop, gfc_match_oacc_host_data) (gfc_match_oacc_data, gfc_match_oacc_kernels) (gfc_match_oacc_kernels_loop, gfc_match_oacc_parallel) (gfc_match_oacc_parallel_loop, gfc_match_oacc_enter_data) (gfc_match_oacc_exit_data, gfc_match_oacc_routine): New prototypes. * openmp.c: Include "diagnostic.h" and "gomp-constants.h". (gfc_free_omp_clauses): Update for members added to struct gfc_omp_clauses. (gfc_match_omp_clauses): Change mask paramter to uint64_t. Add openacc parameter. (resolve_omp_clauses): Add openacc parameter. Update for OpenACC. (struct fortran_omp_context): Add is_openmp member. (gfc_resolve_omp_parallel_blocks): Initialize it. (gfc_resolve_do_iterator): Update for OpenACC. (gfc_resolve_omp_directive): Call resolve_omp_directive_inside_oacc_region. (OMP_CLAUSE_PRIVATE, OMP_CLAUSE_FIRSTPRIVATE) (OMP_CLAUSE_LASTPRIVATE, OMP_CLAUSE_COPYPRIVATE) (OMP_CLAUSE_SHARED, OMP_CLAUSE_COPYIN, OMP_CLAUSE_REDUCTION) (OMP_CLAUSE_IF, OMP_CLAUSE_NUM_THREADS, OMP_CLAUSE_SCHEDULE) (OMP_CLAUSE_DEFAULT, OMP_CLAUSE_ORDERED, OMP_CLAUSE_COLLAPSE) (OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE) (OMP_CLAUSE_ALIGNED, OMP_CLAUSE_DEPEND, OMP_CLAUSE_INBRANCH) (OMP_CLAUSE_LINEAR, OMP_CLAUSE_NOTINBRANCH, OMP_CLAUSE_PROC_BIND) (OMP_CLAUSE_SAFELEN, OMP_CLAUSE_SIMDLEN, OMP_CLAUSE_UNIFORM) (OMP_CLAUSE_DEVICE, OMP_CLAUSE_MAP, OMP_CLAUSE_TO) (OMP_CLAUSE_FROM, OMP_CLAUSE_NUM_TEAMS, OMP_CLAUSE_THREAD_LIMIT) (OMP_CLAUSE_DIST_SCHEDULE): Use uint64_t. (OMP_CLAUSE_ASYNC, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS) (OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_COPY, OMP_CLAUSE_COPYOUT) (OMP_CLAUSE_CREATE, OMP_CLAUSE_PRESENT) (OMP_CLAUSE_PRESENT_OR_COPY, OMP_CLAUSE_PRESENT_OR_COPYIN) (OMP_CLAUSE_PRESENT_OR_COPYOUT, OMP_CLAUSE_PRESENT_OR_CREATE) (OMP_CLAUSE_DEVICEPTR, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER) (OMP_CLAUSE_VECTOR, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT) (OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_DEVICE_RESIDENT) (OMP_CLAUSE_HOST_SELF, OMP_CLAUSE_OACC_DEVICE, OMP_CLAUSE_WAIT) (OMP_CLAUSE_DELETE, OMP_CLAUSE_AUTO, OMP_CLAUSE_TILE): New macros. (gfc_match_omp_clauses): Handle those. (OACC_PARALLEL_CLAUSES, OACC_KERNELS_CLAUSES, OACC_DATA_CLAUSES) (OACC_LOOP_CLAUSES, OACC_PARALLEL_LOOP_CLAUSES) (OACC_KERNELS_LOOP_CLAUSES, OACC_HOST_DATA_CLAUSES) (OACC_DECLARE_CLAUSES, OACC_UPDATE_CLAUSES) (OACC_ENTER_DATA_CLAUSES, OACC_EXIT_DATA_CLAUSES) (OACC_WAIT_CLAUSES): New macros. (gfc_free_expr_list, match_oacc_expr_list, match_oacc_clause_gang) (gfc_match_omp_map_clause, gfc_match_oacc_parallel_loop) (gfc_match_oacc_parallel, gfc_match_oacc_kernels_loop) (gfc_match_oacc_kernels, gfc_match_oacc_data) (gfc_match_oacc_host_data, gfc_match_oacc_loop) (gfc_match_oacc_declare, gfc_match_oacc_update) (gfc_match_oacc_enter_data, gfc_match_oacc_exit_data) (gfc_match_oacc_wait, gfc_match_oacc_cache) (gfc_match_oacc_routine, oacc_is_loop) (resolve_oacc_scalar_int_expr, resolve_oacc_positive_int_expr) (check_symbol_not_pointer, check_array_not_assumed) (resolve_oacc_data_clauses, resolve_oacc_deviceptr_clause) (oacc_compatible_clauses, oacc_is_parallel, oacc_is_kernels) (omp_code_to_statement, oacc_code_to_statement) (resolve_oacc_directive_inside_omp_region) (resolve_omp_directive_inside_oacc_region) (resolve_oacc_nested_loops, resolve_oacc_params_in_parallel) (resolve_oacc_loop_blocks, gfc_resolve_oacc_blocks) (resolve_oacc_loop, resolve_oacc_cache, gfc_resolve_oacc_declare) (gfc_resolve_oacc_directive): New functions. * parse.c (next_free): Update for OpenACC. Move some code into... (verify_token_free): ... this new function. (next_fixed): Update for OpenACC. Move some code into... (verify_token_fixed): ... this new function. (case_executable): Add ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_ENTER_DATA, and ST_OACC_EXIT_DATA. (case_exec_markers): Add ST_OACC_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA, ST_OACC_LOOP, ST_OACC_KERNELS_LOOP. (case_decl): Add ST_OACC_ROUTINE. (push_state, parse_critical_block, parse_progunit): Update for OpenACC. (gfc_ascii_statement): Handle ST_OACC_PARALLEL_LOOP, ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL, ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_KERNELS_LOOP, ST_OACC_END_KERNELS_LOOP, ST_OACC_DATA, ST_OACC_END_DATA, ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA, ST_OACC_LOOP, ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA, ST_OACC_ROUTINE. (verify_st_order, parse_spec): Handle ST_OACC_DECLARE. (parse_executable): Handle ST_OACC_PARALLEL_LOOP, ST_OACC_KERNELS_LOOP, ST_OACC_LOOP, ST_OACC_PARALLEL, ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA. (decode_oacc_directive, parse_oacc_structured_block) (parse_oacc_loop, is_oacc): New functions. * parse.h (struct gfc_state_data): Add oacc_declare_clauses member. (is_oacc): New prototype. * resolve.c (gfc_resolve_blocks, gfc_resolve_code): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (resolve_codes): Call gfc_resolve_oacc_declare. * scanner.c (openacc_flag, openacc_locus): New variables. (skip_free_comments): Update for OpenACC. Move some code into... (skip_omp_attribute): ... this new function. (skip_oacc_attribute): New function. (skip_fixed_comments, gfc_next_char_literal): Update for OpenACC. * st.c (gfc_free_statement): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. * trans-decl.c (gfc_generate_function_code): Update for OpenACC. * trans-openmp.c: Include "gomp-constants.h". (gfc_omp_finish_clause, gfc_trans_omp_clauses): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (gfc_trans_omp_clauses): Handle OMP_LIST_USE_DEVICE, OMP_LIST_DEVICE_RESIDENT, OMP_LIST_CACHE, and OMP_MAP_FORCE_ALLOC, OMP_MAP_FORCE_DEALLOC, OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM, OMP_MAP_FORCE_TOFROM, OMP_MAP_FORCE_PRESENT, OMP_MAP_FORCE_DEVICEPTR, and gfc_omp_clauses' async, seq, independent, wait_list, num_gangs_expr, num_workers_expr, vector_length_expr, vector, vector_expr, worker, worker_expr, gang, gang_expr members. (gfc_trans_omp_do): Handle EXEC_OACC_LOOP. (gfc_convert_expr_to_tree, gfc_trans_oacc_construct) (gfc_trans_oacc_executable_directive) (gfc_trans_oacc_wait_directive, gfc_trans_oacc_combined_directive) (gfc_trans_oacc_declare, gfc_trans_oacc_directive): New functions. * trans-stmt.c (gfc_trans_block_construct): Update for OpenACC. * trans-stmt.h (gfc_trans_oacc_directive, gfc_trans_oacc_declare): New prototypes. * trans.c (tranc_code): Handle EXEC_OACC_CACHE, EXEC_OACC_WAIT, EXEC_OACC_UPDATE, EXEC_OACC_LOOP, EXEC_OACC_HOST_DATA, EXEC_OACC_DATA, EXEC_OACC_KERNELS, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. * gfortran.texi: Update for OpenACC. * intrinsic.texi: Likewise. * invoke.texi: Likewise. gcc/lto/ * lto-lang.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): New macros. * lto.c: Include "gomp-constants.h". gcc/testsuite/ * lib/target-supports.exp (check_effective_target_fopenacc): New procedure. * g++.dg/goacc-gomp/goacc-gomp.exp: New file. * g++.dg/goacc/goacc.exp: Likewise. * gcc.dg/goacc-gomp/goacc-gomp.exp: Likewise. * gcc.dg/goacc/goacc.exp: Likewise. * gfortran.dg/goacc/goacc.exp: Likewise. * c-c++-common/cpp/openacc-define-1.c: New file. * c-c++-common/cpp/openacc-define-2.c: Likewise. * c-c++-common/cpp/openacc-define-3.c: Likewise. * c-c++-common/goacc-gomp/nesting-1.c: Likewise. * c-c++-common/goacc-gomp/nesting-fail-1.c: Likewise. * c-c++-common/goacc/acc_on_device-2-off.c: Likewise. * c-c++-common/goacc/acc_on_device-2.c: Likewise. * c-c++-common/goacc/asyncwait-1.c: Likewise. * c-c++-common/goacc/cache-1.c: Likewise. * c-c++-common/goacc/clauses-fail.c: Likewise. * c-c++-common/goacc/collapse-1.c: Likewise. * c-c++-common/goacc/data-1.c: Likewise. * c-c++-common/goacc/data-2.c: Likewise. * c-c++-common/goacc/data-clause-duplicate-1.c: Likewise. * c-c++-common/goacc/deviceptr-1.c: Likewise. * c-c++-common/goacc/deviceptr-2.c: Likewise. * c-c++-common/goacc/deviceptr-3.c: Likewise. * c-c++-common/goacc/if-clause-1.c: Likewise. * c-c++-common/goacc/if-clause-2.c: Likewise. * c-c++-common/goacc/kernels-1.c: Likewise. * c-c++-common/goacc/loop-1.c: Likewise. * c-c++-common/goacc/loop-private-1.c: Likewise. * c-c++-common/goacc/nesting-1.c: Likewise. * c-c++-common/goacc/nesting-data-1.c: Likewise. * c-c++-common/goacc/nesting-fail-1.c: Likewise. * c-c++-common/goacc/parallel-1.c: Likewise. * c-c++-common/goacc/pcopy.c: Likewise. * c-c++-common/goacc/pcopyin.c: Likewise. * c-c++-common/goacc/pcopyout.c: Likewise. * c-c++-common/goacc/pcreate.c: Likewise. * c-c++-common/goacc/pragma_context.c: Likewise. * c-c++-common/goacc/present-1.c: Likewise. * c-c++-common/goacc/reduction-1.c: Likewise. * c-c++-common/goacc/reduction-2.c: Likewise. * c-c++-common/goacc/reduction-3.c: Likewise. * c-c++-common/goacc/reduction-4.c: Likewise. * c-c++-common/goacc/sb-1.c: Likewise. * c-c++-common/goacc/sb-2.c: Likewise. * c-c++-common/goacc/sb-3.c: Likewise. * c-c++-common/goacc/update-1.c: Likewise. * gcc.dg/goacc/acc_on_device-1.c: Likewise. * gfortran.dg/goacc/acc_on_device-1.f95: Likewise. * gfortran.dg/goacc/acc_on_device-2-off.f95: Likewise. * gfortran.dg/goacc/acc_on_device-2.f95: Likewise. * gfortran.dg/goacc/assumed.f95: Likewise. * gfortran.dg/goacc/asyncwait-1.f95: Likewise. * gfortran.dg/goacc/asyncwait-2.f95: Likewise. * gfortran.dg/goacc/asyncwait-3.f95: Likewise. * gfortran.dg/goacc/asyncwait-4.f95: Likewise. * gfortran.dg/goacc/branch.f95: Likewise. * gfortran.dg/goacc/cache-1.f95: Likewise. * gfortran.dg/goacc/coarray.f95: Likewise. * gfortran.dg/goacc/continuation-free-form.f95: Likewise. * gfortran.dg/goacc/cray.f95: Likewise. * gfortran.dg/goacc/critical.f95: Likewise. * gfortran.dg/goacc/data-clauses.f95: Likewise. * gfortran.dg/goacc/data-tree.f95: Likewise. * gfortran.dg/goacc/declare-1.f95: Likewise. * gfortran.dg/goacc/enter-exit-data.f95: Likewise. * gfortran.dg/goacc/fixed-1.f: Likewise. * gfortran.dg/goacc/fixed-2.f: Likewise. * gfortran.dg/goacc/fixed-3.f: Likewise. * gfortran.dg/goacc/fixed-4.f: Likewise. * gfortran.dg/goacc/host_data-tree.f95: Likewise. * gfortran.dg/goacc/if.f95: Likewise. * gfortran.dg/goacc/kernels-tree.f95: Likewise. * gfortran.dg/goacc/list.f95: Likewise. * gfortran.dg/goacc/literal.f95: Likewise. * gfortran.dg/goacc/loop-1.f95: Likewise. * gfortran.dg/goacc/loop-2.f95: Likewise. * gfortran.dg/goacc/loop-3.f95: Likewise. * gfortran.dg/goacc/loop-tree-1.f90: Likewise. * gfortran.dg/goacc/omp.f95: Likewise. * gfortran.dg/goacc/parallel-kernels-clauses.f95: Likewise. * gfortran.dg/goacc/parallel-kernels-regions.f95: Likewise. * gfortran.dg/goacc/parallel-tree.f95: Likewise. * gfortran.dg/goacc/parameter.f95: Likewise. * gfortran.dg/goacc/private-1.f95: Likewise. * gfortran.dg/goacc/private-2.f95: Likewise. * gfortran.dg/goacc/private-3.f95: Likewise. * gfortran.dg/goacc/pure-elemental-procedures.f95: Likewise. * gfortran.dg/goacc/reduction-2.f95: Likewise. * gfortran.dg/goacc/reduction.f95: Likewise. * gfortran.dg/goacc/routine-1.f90: Likewise. * gfortran.dg/goacc/routine-2.f90: Likewise. * gfortran.dg/goacc/sentinel-free-form.f95: Likewise. * gfortran.dg/goacc/several-directives.f95: Likewise. * gfortran.dg/goacc/sie.f95: Likewise. * gfortran.dg/goacc/subarrays.f95: Likewise. * gfortran.dg/gomp/map-1.f90: Likewise. * gfortran.dg/openacc-define-1.f90: Likewise. * gfortran.dg/openacc-define-2.f90: Likewise. * gfortran.dg/openacc-define-3.f90: Likewise. * g++.dg/gomp/block-1.C: Update for changed compiler output. * g++.dg/gomp/block-2.C: Likewise. * g++.dg/gomp/block-3.C: Likewise. * g++.dg/gomp/block-5.C: Likewise. * g++.dg/gomp/target-1.C: Likewise. * g++.dg/gomp/target-2.C: Likewise. * g++.dg/gomp/taskgroup-1.C: Likewise. * g++.dg/gomp/teams-1.C: Likewise. * gcc.dg/cilk-plus/jump-openmp.c: Likewise. * gcc.dg/cilk-plus/jump.c: Likewise. * gcc.dg/gomp/block-1.c: Likewise. * gcc.dg/gomp/block-10.c: Likewise. * gcc.dg/gomp/block-2.c: Likewise. * gcc.dg/gomp/block-3.c: Likewise. * gcc.dg/gomp/block-4.c: Likewise. * gcc.dg/gomp/block-5.c: Likewise. * gcc.dg/gomp/block-6.c: Likewise. * gcc.dg/gomp/block-7.c: Likewise. * gcc.dg/gomp/block-8.c: Likewise. * gcc.dg/gomp/block-9.c: Likewise. * gcc.dg/gomp/target-1.c: Likewise. * gcc.dg/gomp/target-2.c: Likewise. * gcc.dg/gomp/taskgroup-1.c: Likewise. * gcc.dg/gomp/teams-1.c: Likewise. include/ * gomp-constants.h: New file. libgomp/ * Makefile.am (search_path): Add $(top_srcdir)/../include. (libgomp_la_SOURCES): Add splay-tree.c, libgomp-plugin.c, oacc-parallel.c, oacc-host.c, oacc-init.c, oacc-mem.c, oacc-async.c, oacc-plugin.c, oacc-cuda.c. [USE_FORTRAN] (libgomp_la_SOURCES): Add openacc.f90. Include $(top_srcdir)/plugin/Makefrag.am. (nodist_libsubinclude_HEADERS): Add openacc.h. [USE_FORTRAN] (nodist_finclude_HEADERS): Add openacc_lib.h, openacc.f90, openacc.mod, openacc_kinds.mod. (omp_lib.mod): Generalize into... (%.mod): ... this new rule. (openacc_kinds.mod, openacc.mod): New rules. * plugin/configfrag.ac: New file. * configure.ac: Move plugin/offloading support into it. Include it. Instantiate testsuite/libgomp-test-support.pt.exp. * plugin/Makefrag.am: New file. * testsuite/Makefile.am (OFFLOAD_TARGETS) (OFFLOAD_ADDITIONAL_OPTIONS, OFFLOAD_ADDITIONAL_LIB_PATHS): Don't export. (libgomp-test-support.exp): New rule. (all-local): Depend on it. * Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. * config.h.in: Likewise. * configure: Likewise. * configure.tgt: Harden shell syntax. * env.c: Include "oacc-int.h". (parse_acc_device_type): New function. (gomp_debug_var, goacc_device_type, goacc_device_num): New variables. (initialize_env): Initialize those. Call goacc_runtime_initialize. * error.c (gomp_vdebug, gomp_debug, gomp_vfatal): New functions. (gomp_fatal): Call gomp_vfatal. * libgomp.h: Include "libgomp-plugin.h" and <stdarg.h>. (gomp_debug_var, goacc_device_type, goacc_device_num, gomp_vdebug) (gomp_debug, gomp_verror, gomp_vfatal, gomp_init_targets_once) (splay_tree_node, splay_tree, splay_tree_key) (struct target_mem_desc, struct splay_tree_key_s) (struct gomp_memory_mapping, struct acc_dispatch_t) (struct gomp_device_descr, gomp_acc_insert_pointer) (gomp_acc_remove_pointer, target_mem_desc, gomp_copy_from_async) (gomp_unmap_vars, gomp_init_device, gomp_init_tables) (gomp_free_memmap, gomp_fini_device): New declarations. (gomp_vdebug, gomp_debug): New macros. Include "splay-tree.h". * libgomp.map (OACC_2.0): New symbol version. Use for acc_get_num_devices, acc_get_num_devices_h_, acc_set_device_type, acc_set_device_type_h_, acc_get_device_type, acc_get_device_type_h_, acc_set_device_num, acc_set_device_num_h_, acc_get_device_num, acc_get_device_num_h_, acc_async_test, acc_async_test_h_, acc_async_test_all, acc_async_test_all_h_, acc_wait, acc_wait_h_, acc_wait_async, acc_wait_async_h_, acc_wait_all, acc_wait_all_h_, acc_wait_all_async, acc_wait_all_async_h_, acc_init, acc_init_h_, acc_shutdown, acc_shutdown_h_, acc_on_device, acc_on_device_h_, acc_malloc, acc_free, acc_copyin, acc_copyin_32_h_, acc_copyin_64_h_, acc_copyin_array_h_, acc_present_or_copyin, acc_present_or_copyin_32_h_, acc_present_or_copyin_64_h_, acc_present_or_copyin_array_h_, acc_create, acc_create_32_h_, acc_create_64_h_, acc_create_array_h_, acc_present_or_create, acc_present_or_create_32_h_, acc_present_or_create_64_h_, acc_present_or_create_array_h_, acc_copyout, acc_copyout_32_h_, acc_copyout_64_h_, acc_copyout_array_h_, acc_delete, acc_delete_32_h_, acc_delete_64_h_, acc_delete_array_h_, acc_update_device, acc_update_device_32_h_, acc_update_device_64_h_, acc_update_device_array_h_, acc_update_self, acc_update_self_32_h_, acc_update_self_64_h_, acc_update_self_array_h_, acc_map_data, acc_unmap_data, acc_deviceptr, acc_hostptr, acc_is_present, acc_is_present_32_h_, acc_is_present_64_h_, acc_is_present_array_h_, acc_memcpy_to_device, acc_memcpy_from_device, acc_get_current_cuda_device, acc_get_current_cuda_context, acc_get_cuda_stream, acc_set_cuda_stream. (GOACC_2.0): New symbol version. Use for GOACC_data_end, GOACC_data_start, GOACC_enter_exit_data, GOACC_parallel, GOACC_update, GOACC_wait, GOACC_get_thread_num, GOACC_get_num_threads. (GOMP_PLUGIN_1.0): New symbol version. Use for GOMP_PLUGIN_malloc, GOMP_PLUGIN_malloc_cleared, GOMP_PLUGIN_realloc, GOMP_PLUGIN_debug, GOMP_PLUGIN_error, GOMP_PLUGIN_fatal, GOMP_PLUGIN_async_unmap_vars, GOMP_PLUGIN_acc_thread. * libgomp.texi: Update for OpenACC changes, and GOMP_DEBUG environment variable. * libgomp_g.h (GOACC_data_start, GOACC_data_end) (GOACC_enter_exit_data, GOACC_parallel, GOACC_update, GOACC_wait) (GOACC_get_num_threads, GOACC_get_thread_num): New declarations. * splay-tree.h (splay_tree_lookup, splay_tree_insert) (splay_tree_remove): New declarations. (rotate_left, rotate_right, splay_tree_splay, splay_tree_insert) (splay_tree_remove, splay_tree_lookup): Move into... * splay-tree.c: ... this new file. * target.c: Include "oacc-plugin.h", "oacc-int.h", <assert.h>. (splay_tree_node, splay_tree, splay_tree_key) (struct target_mem_desc, struct splay_tree_key_s) (struct gomp_device_descr): Don't declare. (num_devices_openmp): New variable. (gomp_get_num_devices ): Use it. (gomp_init_targets_once): New function. (gomp_get_num_devices ): Use it. (get_kind, gomp_copy_from_async, gomp_free_memmap) (gomp_fini_device, gomp_register_image_for_device): New functions. (gomp_map_vars): Add devaddrs parameter. (gomp_update): Add mm parameter. (gomp_init_device): Move most of it into... (gomp_init_tables): ... this new function. (gomp_register_images_for_device): Remove function. (splay_compare, gomp_map_vars, gomp_unmap_vars, gomp_init_device): Make them hidden instead of static. (gomp_map_vars_existing, gomp_map_vars, gomp_unmap_vars) (gomp_update, gomp_init_device, GOMP_target, GOMP_target_data) (GOMP_target_end_data, GOMP_target_update) (gomp_load_plugin_for_device, gomp_target_init): Update for OpenACC changes. * oacc-async.c: New file. * oacc-cuda.c: Likewise. * oacc-host.c: Likewise. * oacc-init.c: Likewise. * oacc-int.h: Likewise. * oacc-mem.c: Likewise. * oacc-parallel.c: Likewise. * oacc-plugin.c: Likewise. * oacc-plugin.h: Likewise. * oacc-ptx.h: Likewise. * openacc.f90: Likewise. * openacc.h: Likewise. * openacc_lib.h: Likewise. * plugin/plugin-host.c: Likewise. * plugin/plugin-nvptx.c: Likewise. * libgomp-plugin.c: Likewise. * libgomp-plugin.h: Likewise. * libgomp_target.h: Remove file after merging content into the former file. Update all users. * testsuite/lib/libgomp.exp: Load libgomp-test-support.exp. (offload_targets_s, offload_targets_s_openacc): New variables. (check_effective_target_openacc_nvidia_accel_present) (check_effective_target_openacc_nvidia_accel_selected): New procedures. (libgomp_init): Update for OpenACC changes. * testsuite/libgomp-test-support.exp.in: New file. * testsuite/libgomp.oacc-c++/c++.exp: Likewise. * testsuite/libgomp.oacc-c/c.exp: Likewise. * testsuite/libgomp.oacc-fortran/fortran.exp: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/asyncwait-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/cache-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/clauses-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/clauses-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-6.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-7.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-8.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/deviceptr-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/if-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/kernels-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/kernels-empty.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-10.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-11.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-12.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-13.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-14.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-15.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-16.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-17.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-18.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-19.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-20.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-21.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-22.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-23.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-24.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-25.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-26.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-27.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-28.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-29.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-30.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-31.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-32.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-33.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-34.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-35.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-36.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-37.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-38.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-39.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-40.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-41.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-42.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-43.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-44.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-45.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-46.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-47.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-48.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-49.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-50.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-51.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-52.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-53.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-54.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-55.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-56.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-57.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-58.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-59.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-6.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-60.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-61.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-62.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-63.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-64.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-65.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-66.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-67.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-68.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-69.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-7.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-70.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-71.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-72.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-73.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-74.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-75.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-76.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-77.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-78.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-79.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-80.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-81.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-82.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-83.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-84.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-85.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-86.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-87.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-88.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-89.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-9.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-90.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-91.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-92.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/nested-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/nested-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/offset-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/parallel-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/parallel-empty.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/pointer-align-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/present-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/present-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-initial-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/subr.h: Likewise. * testsuite/libgomp.oacc-c-c++-common/subr.ptx: Likewise. * testsuite/libgomp.oacc-c-c++-common/timer.h: Likewise. * testsuite/libgomp.oacc-c-c++-common/update-1-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/update-1.c: Likewise. * testsuite/libgomp.oacc-fortran/abort-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/abort-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-7.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-8.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-4-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-already-1.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-2.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-3.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-4.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-5.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-6.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-7.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-8.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-10.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-2.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-3.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-7.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-8.f90: Likewise. * testsuite/libgomp.oacc-fortran/map-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/openacc_version-1.f: Likewise. * testsuite/libgomp.oacc-fortran/openacc_version-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/pointer-align-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/pset-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/subarrays-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/subarrays-2.f90: Likewise. liboffloadmic/ * plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_get_name) (GOMP_OFFLOAD_get_caps, GOMP_OFFLOAD_fini_device): New functions. Co-Authored-By: Bernd Schmidt <bernds@codesourcery.com> Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com> Co-Authored-By: Dmitry Bocharnikov <dmitry.b@samsung.com> Co-Authored-By: Evgeny Gavrin <e.gavrin@samsung.com> Co-Authored-By: Ilmir Usmanov <i.usmanov@samsung.com> Co-Authored-By: Jakub Jelinek <jakub@redhat.com> Co-Authored-By: James Norris <jnorris@codesourcery.com> Co-Authored-By: Julian Brown <julian@codesourcery.com> Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> Co-Authored-By: Tom de Vries <tom@codesourcery.com> From-SVN: r219682
2015-01-15 21:11:12 +01:00
Multi Processing Runtime Library. This includes the GNU
implementation of the @uref{http://www.openmp.org, OpenMP} Application
Programming Interface (API) for multi-platform shared-memory parallel
programming in C/C++ and Fortran, and the GNU implementation of the
@uref{http://www.openacc.org/, OpenACC} Application Programming
Interface (API) for offloading of code to accelerator devices in C/C++
and Fortran.
Merge current set of OpenACC changes from gomp-4_0-branch. contrib/ * gcc_update (files_and_dependencies): Update rules for new libgomp/plugin/Makefrag.am and libgomp/plugin/configfrag.ac files. gcc/ * builtin-types.def (BT_FN_VOID_INT_INT_VAR) (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR) (BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR): New function types. * builtins.c: Include "gomp-constants.h". (expand_builtin_acc_on_device): New function. (expand_builtin, is_inexpensive_builtin): Handle BUILT_IN_ACC_ON_DEVICE. * builtins.def (DEF_GOACC_BUILTIN, DEF_GOACC_BUILTIN_COMPILER): New macros. * cgraph.c (cgraph_node::create): Consider flag_openacc next to flag_openmp. * config.gcc <nvptx-*> (tm_file): Add nvptx/offload.h. <*-intelmic-* | *-intelmicemul-*> (tm_file): Add i386/intelmic-offload.h. * gcc.c (LINK_COMMAND_SPEC, GOMP_SELF_SPECS): For -fopenacc, link to libgomp and its dependencies. * config/arc/arc.h (LINK_COMMAND_SPEC): Likewise. * config/darwin.h (LINK_COMMAND_SPEC_A): Likewise. * config/i386/mingw32.h (GOMP_SELF_SPECS): Likewise. * config/ia64/hpux.h (LIB_SPEC): Likewise. * config/pa/pa-hpux11.h (LIB_SPEC): Likewise. * config/pa/pa64-hpux.h (LIB_SPEC): Likewise. * doc/generic.texi: Update for OpenACC changes. * doc/gimple.texi: Likewise. * doc/invoke.texi: Likewise. * doc/sourcebuild.texi: Likewise. * gimple-pretty-print.c (dump_gimple_omp_for): Handle GF_OMP_FOR_KIND_OACC_LOOP. (dump_gimple_omp_target): Handle GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_DATA, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA. Dump more data. * gimple.c: Update comments for OpenACC changes. * gimple.def: Likewise. * gimple.h: Likewise. (enum gf_mask): Add GF_OMP_FOR_KIND_OACC_LOOP, GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_DATA, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA. (gimple_omp_for_cond, gimple_omp_for_set_cond): Sort in the appropriate place. (is_gimple_omp_oacc, is_gimple_omp_offloaded): New functions. * gimplify.c: Include "gomp-constants.h". Update comments for OpenACC changes. (is_gimple_stmt): Handle OACC_PARALLEL, OACC_KERNELS, OACC_DATA, OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle OMP_CLAUSE__CACHE_, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ. (gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (gimplify_oacc_cache): New function. (gimplify_omp_for): Handle OACC_LOOP. (gimplify_omp_workshare): Handle OACC_KERNELS, OACC_PARALLEL, OACC_DATA. (gimplify_omp_target_update): Handle OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE. (gimplify_expr): Handle OACC_LOOP, OACC_CACHE, OACC_HOST_DATA, OACC_DECLARE, OACC_KERNELS, OACC_PARALLEL, OACC_DATA, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE. (gimplify_body): Consider flag_openacc next to flag_openmp. * lto-streamer-out.c: Include "gomp-constants.h". * omp-builtins.def (BUILT_IN_ACC_GET_DEVICE_TYPE) (BUILT_IN_GOACC_DATA_START, BUILT_IN_GOACC_DATA_END) (BUILT_IN_GOACC_ENTER_EXIT_DATA, BUILT_IN_GOACC_PARALLEL) (BUILT_IN_GOACC_UPDATE, BUILT_IN_GOACC_WAIT) (BUILT_IN_GOACC_GET_THREAD_NUM, BUILT_IN_GOACC_GET_NUM_THREADS) (BUILT_IN_ACC_ON_DEVICE): New builtins. * omp-low.c: Include "gomp-constants.h". Update comments for OpenACC changes. (struct omp_context): Add reduction_map, gwv_below, gwv_this members. (extract_omp_for_data, use_pointer_for_field, install_var_field) (new_omp_context, delete_omp_context, scan_sharing_clauses) (create_omp_child_function, scan_omp_for, scan_omp_target) (check_omp_nesting_restrictions, lower_reduction_clauses) (build_omp_regions_1, diagnose_sb_0, make_gimple_omp_edges): Update for OpenACC changes. (scan_sharing_clauses): Handle OMP_CLAUSE_NUM_GANGS: OMP_CLAUSE_NUM_WORKERS: OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Handle GF_OMP_FOR_KIND_OACC_LOOP. (expand_omp_target, lower_omp_target): Handle GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA, GF_OMP_TARGET_KIND_OACC_DATA. (pass_expand_omp::execute, execute_lower_omp) (pass_diagnose_omp_blocks::gate): Consider flag_openacc next to flag_openmp. (offload_symbol_decl): New variable. (oacc_get_reduction_array_id, oacc_max_threads) (get_offload_symbol_decl, get_base_type, lookup_oacc_reduction) (maybe_lookup_oacc_reduction, enclosing_target_ctx) (oacc_loop_or_target_p, oacc_lower_reduction_var_helper) (oacc_gimple_assign, oacc_initialize_reduction_data) (oacc_finalize_reduction_data, oacc_process_reduction_data): New functions. (is_targetreg_ctx): Remove function. * tree-core.h (enum omp_clause_code): Add OMP_CLAUSE__CACHE_, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_GANG, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH. * tree.c (omp_clause_code_name, walk_tree_1): Update accordingly. * tree.h (OMP_CLAUSE_GANG_EXPR, OMP_CLAUSE_GANG_STATIC_EXPR) (OMP_CLAUSE_ASYNC_EXPR, OMP_CLAUSE_WAIT_EXPR) (OMP_CLAUSE_VECTOR_EXPR, OMP_CLAUSE_WORKER_EXPR) (OMP_CLAUSE_NUM_GANGS_EXPR, OMP_CLAUSE_NUM_WORKERS_EXPR) (OMP_CLAUSE_VECTOR_LENGTH_EXPR): New macros. * tree-core.h: Update comments for OpenACC changes. (enum omp_clause_map_kind): Remove. (struct tree_omp_clause): Change type of map_kind member from enum omp_clause_map_kind to unsigned char. * tree-inline.c: Update comments for OpenACC changes. * tree-nested.c: Likewise. Include "gomp-constants.h". (convert_nonlocal_reference_stmt, convert_local_reference_stmt) (convert_tramp_reference_stmt, convert_gimple_call): Update for OpenACC changes. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. * tree-pretty-print.c: Include "gomp-constants.h". (dump_omp_clause): Handle OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_GANG, OMP_CLAUSE_ASYNC, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_WAIT, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_INDEPENDENT. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (dump_generic_node): Handle OACC_PARALLEL, OACC_KERNELS, OACC_DATA, OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP. * tree-streamer-in.c: Include "gomp-constants.h". (unpack_ts_omp_clause_value_fields) Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. * tree-streamer-out.c: Include "gomp-constants.h". (pack_ts_omp_clause_value_fields): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. * tree.def (OACC_PARALLEL, OACC_KERNELS, OACC_DATA) (OACC_HOST_DATA, OACC_LOOP, OACC_CACHE, OACC_DECLARE) (OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE): New tree codes. * tree.c (omp_clause_num_ops): Update accordingly. * tree.h (OMP_BODY, OMP_CLAUSES, OMP_LOOP_CHECK, OMP_CLAUSE_SIZE): Likewise. (OACC_PARALLEL_BODY, OACC_PARALLEL_CLAUSES, OACC_KERNELS_BODY) (OACC_KERNELS_CLAUSES, OACC_DATA_BODY, OACC_DATA_CLAUSES) (OACC_HOST_DATA_BODY, OACC_HOST_DATA_CLAUSES, OACC_CACHE_CLAUSES) (OACC_DECLARE_CLAUSES, OACC_ENTER_DATA_CLAUSES) (OACC_EXIT_DATA_CLAUSES, OACC_UPDATE_CLAUSES) (OACC_KERNELS_COMBINED, OACC_PARALLEL_COMBINED): New macros. * tree.h (OMP_CLAUSE_MAP_KIND): Cast it to enum gomp_map_kind. (OMP_CLAUSE_SET_MAP_KIND): New macro. * varpool.c (varpool_node::get_create): Consider flag_openacc next to flag_openmp. * config/i386/intelmic-offload.h: New file. * config/nvptx/offload.h: Likewise. gcc/ada/ * gcc-interface/utils.c (DEF_FUNCTION_TYPE_VAR_8) (DEF_FUNCTION_TYPE_VAR_12): New macros. gcc/c-family/ * c.opt (fopenacc): New option. * c-cppbuiltin.c (c_cpp_builtins): Conditionally define _OPENACC. * c-common.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): New macros. * c-common.h (c_finish_oacc_wait): New prototype. * c-omp.c: Include "omp-low.h" and "gomp-constants.h". (c_finish_oacc_wait): New function. * c-pragma.c (oacc_pragmas): New variable. (c_pp_lookup_pragma, init_pragma): Handle it. * c-pragma.h (enum pragma_kind): Add PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT. (enum pragma_omp_clause): Add PRAGMA_OACC_CLAUSE_ASYNC, PRAGMA_OACC_CLAUSE_AUTO, PRAGMA_OACC_CLAUSE_COLLAPSE, PRAGMA_OACC_CLAUSE_COPY, PRAGMA_OACC_CLAUSE_COPYIN, PRAGMA_OACC_CLAUSE_COPYOUT, PRAGMA_OACC_CLAUSE_CREATE, PRAGMA_OACC_CLAUSE_DELETE, PRAGMA_OACC_CLAUSE_DEVICE, PRAGMA_OACC_CLAUSE_DEVICEPTR, PRAGMA_OACC_CLAUSE_FIRSTPRIVATE, PRAGMA_OACC_CLAUSE_GANG, PRAGMA_OACC_CLAUSE_HOST, PRAGMA_OACC_CLAUSE_IF, PRAGMA_OACC_CLAUSE_NUM_GANGS, PRAGMA_OACC_CLAUSE_NUM_WORKERS, PRAGMA_OACC_CLAUSE_PRESENT, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPY, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYIN, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYOUT, PRAGMA_OACC_CLAUSE_PRESENT_OR_CREATE, PRAGMA_OACC_CLAUSE_PRIVATE, PRAGMA_OACC_CLAUSE_REDUCTION, PRAGMA_OACC_CLAUSE_SELF, PRAGMA_OACC_CLAUSE_SEQ, PRAGMA_OACC_CLAUSE_VECTOR, PRAGMA_OACC_CLAUSE_VECTOR_LENGTH, PRAGMA_OACC_CLAUSE_WAIT, PRAGMA_OACC_CLAUSE_WORKER. gcc/c/ * c-parser.c: Include "gomp-constants.h". (c_parser_omp_clause_map): Use enum gomp_map_kind instead of enum omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (c_parser_pragma): Handle PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_UPDATE. (c_parser_omp_construct): Handle PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_WAIT. (c_parser_omp_clause_name): Handle "auto", "async", "copy", "copyout", "create", "delete", "deviceptr", "gang", "host", "num_gangs", "num_workers", "present", "present_or_copy", "pcopy", "present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout", "present_or_create", "pcreate", "seq", "self", "vector", "vector_length", "wait", "worker". (OACC_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK) (OACC_ENTER_DATA_CLAUSE_MASK, OACC_EXIT_DATA_CLAUSE_MASK) (OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK) (OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros. (c_parser_omp_variable_list): Handle OMP_CLAUSE__CACHE_. (c_parser_oacc_wait_list, c_parser_oacc_data_clause) (c_parser_oacc_data_clause_deviceptr) (c_parser_omp_clause_num_gangs, c_parser_omp_clause_num_workers) (c_parser_oacc_clause_async, c_parser_oacc_clause_wait) (c_parser_omp_clause_vector_length, c_parser_oacc_all_clauses) (c_parser_oacc_cache, c_parser_oacc_data, c_parser_oacc_kernels) (c_parser_oacc_enter_exit_data, c_parser_oacc_loop) (c_parser_oacc_parallel, c_parser_oacc_update) (c_parser_oacc_wait): New functions. * c-tree.h (c_finish_oacc_parallel, c_finish_oacc_kernels) (c_finish_oacc_data): New prototypes. * c-typeck.c: Include "gomp-constants.h". (handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (c_finish_oacc_parallel, c_finish_oacc_kernels) (c_finish_oacc_data): New functions. (c_finish_omp_clauses): Handle OMP_CLAUSE__CACHE_, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, and OMP_CLAUSE_MAP's GOMP_MAP_FORCE_DEVICEPTR. gcc/cp/ * parser.c: Include "gomp-constants.h". (cp_parser_omp_clause_map): Use enum gomp_map_kind instead of enum omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (cp_parser_omp_construct, cp_parser_pragma): Handle PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_LOOP, PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT. (cp_parser_omp_clause_name): Handle "async", "copy", "copyout", "create", "delete", "deviceptr", "host", "num_gangs", "num_workers", "present", "present_or_copy", "pcopy", "present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout", "present_or_create", "pcreate", "vector_length", "wait". (OACC_DATA_CLAUSE_MASK, OACC_ENTER_DATA_CLAUSE_MASK) (OACC_EXIT_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK) (OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK) (OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros. (cp_parser_omp_var_list_no_open): Handle OMP_CLAUSE__CACHE_. (cp_parser_oacc_data_clause, cp_parser_oacc_data_clause_deviceptr) (cp_parser_oacc_clause_vector_length, cp_parser_oacc_wait_list) (cp_parser_oacc_clause_wait, cp_parser_omp_clause_num_gangs) (cp_parser_omp_clause_num_workers, cp_parser_oacc_clause_async) (cp_parser_oacc_all_clauses, cp_parser_oacc_cache) (cp_parser_oacc_data, cp_parser_oacc_enter_exit_data) (cp_parser_oacc_kernels, cp_parser_oacc_loop) (cp_parser_oacc_parallel, cp_parser_oacc_update) (cp_parser_oacc_wait): New functions. * cp-tree.h (finish_oacc_data, finish_oacc_kernels) (finish_oacc_parallel): New prototypes. * semantics.c: Include "gomp-constants.h". (handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (finish_omp_clauses): Handle OMP_CLAUSE_ASYNC, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_WAIT, OMP_CLAUSE__CACHE_. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (finish_oacc_data, finish_oacc_kernels, finish_oacc_parallel): New functions. gcc/fortran/ * lang.opt (fopenacc): New option. * cpp.c (cpp_define_builtins): Conditionally define _OPENACC. * dump-parse-tree.c (show_omp_node): Split part of it into... (show_omp_clauses): ... this new function. (show_omp_node, show_code_node): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (show_namespace): Update for OpenACC. * f95-lang.c (DEF_FUNCTION_TYPE_VAR_2, DEF_FUNCTION_TYPE_VAR_8) (DEF_FUNCTION_TYPE_VAR_12, DEF_GOACC_BUILTIN) (DEF_GOACC_BUILTIN_COMPILER): New macros. * types.def (BT_FN_VOID_INT_INT_VAR) (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR) (BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR): New function types. * gfortran.h (gfc_statement): Add ST_OACC_PARALLEL_LOOP, ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL, ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_DATA, ST_OACC_END_DATA, ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA, ST_OACC_LOOP, ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_KERNELS_LOOP, ST_OACC_END_KERNELS_LOOP, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA, ST_OACC_ROUTINE. (struct gfc_expr_list): New data type. (gfc_get_expr_list): New macro. (gfc_omp_map_op): Add OMP_MAP_FORCE_ALLOC, OMP_MAP_FORCE_DEALLOC, OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM, OMP_MAP_FORCE_TOFROM, OMP_MAP_FORCE_PRESENT, OMP_MAP_FORCE_DEVICEPTR. (OMP_LIST_FIRST, OMP_LIST_DEVICE_RESIDENT, OMP_LIST_USE_DEVICE) (OMP_LIST_CACHE): New enumerators. (struct gfc_omp_clauses): Add async_expr, gang_expr, worker_expr, vector_expr, num_gangs_expr, num_workers_expr, vector_length_expr, wait_list, tile_list, async, gang, worker, vector, seq, independent, wait, par_auto, gang_static, and loc members. (struct gfc_namespace): Add oacc_declare_clauses member. (gfc_exec_op): Add EXEC_OACC_KERNELS_LOOP, EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (gfc_free_expr_list, gfc_resolve_oacc_directive) (gfc_resolve_oacc_declare, gfc_resolve_oacc_parallel_loop_blocks) (gfc_resolve_oacc_blocks): New prototypes. * match.c (match_exit_cycle): Handle EXEC_OACC_LOOP and EXEC_OACC_PARALLEL_LOOP. * match.h (gfc_match_oacc_cache, gfc_match_oacc_wait) (gfc_match_oacc_update, gfc_match_oacc_declare) (gfc_match_oacc_loop, gfc_match_oacc_host_data) (gfc_match_oacc_data, gfc_match_oacc_kernels) (gfc_match_oacc_kernels_loop, gfc_match_oacc_parallel) (gfc_match_oacc_parallel_loop, gfc_match_oacc_enter_data) (gfc_match_oacc_exit_data, gfc_match_oacc_routine): New prototypes. * openmp.c: Include "diagnostic.h" and "gomp-constants.h". (gfc_free_omp_clauses): Update for members added to struct gfc_omp_clauses. (gfc_match_omp_clauses): Change mask paramter to uint64_t. Add openacc parameter. (resolve_omp_clauses): Add openacc parameter. Update for OpenACC. (struct fortran_omp_context): Add is_openmp member. (gfc_resolve_omp_parallel_blocks): Initialize it. (gfc_resolve_do_iterator): Update for OpenACC. (gfc_resolve_omp_directive): Call resolve_omp_directive_inside_oacc_region. (OMP_CLAUSE_PRIVATE, OMP_CLAUSE_FIRSTPRIVATE) (OMP_CLAUSE_LASTPRIVATE, OMP_CLAUSE_COPYPRIVATE) (OMP_CLAUSE_SHARED, OMP_CLAUSE_COPYIN, OMP_CLAUSE_REDUCTION) (OMP_CLAUSE_IF, OMP_CLAUSE_NUM_THREADS, OMP_CLAUSE_SCHEDULE) (OMP_CLAUSE_DEFAULT, OMP_CLAUSE_ORDERED, OMP_CLAUSE_COLLAPSE) (OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE) (OMP_CLAUSE_ALIGNED, OMP_CLAUSE_DEPEND, OMP_CLAUSE_INBRANCH) (OMP_CLAUSE_LINEAR, OMP_CLAUSE_NOTINBRANCH, OMP_CLAUSE_PROC_BIND) (OMP_CLAUSE_SAFELEN, OMP_CLAUSE_SIMDLEN, OMP_CLAUSE_UNIFORM) (OMP_CLAUSE_DEVICE, OMP_CLAUSE_MAP, OMP_CLAUSE_TO) (OMP_CLAUSE_FROM, OMP_CLAUSE_NUM_TEAMS, OMP_CLAUSE_THREAD_LIMIT) (OMP_CLAUSE_DIST_SCHEDULE): Use uint64_t. (OMP_CLAUSE_ASYNC, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS) (OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_COPY, OMP_CLAUSE_COPYOUT) (OMP_CLAUSE_CREATE, OMP_CLAUSE_PRESENT) (OMP_CLAUSE_PRESENT_OR_COPY, OMP_CLAUSE_PRESENT_OR_COPYIN) (OMP_CLAUSE_PRESENT_OR_COPYOUT, OMP_CLAUSE_PRESENT_OR_CREATE) (OMP_CLAUSE_DEVICEPTR, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER) (OMP_CLAUSE_VECTOR, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT) (OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_DEVICE_RESIDENT) (OMP_CLAUSE_HOST_SELF, OMP_CLAUSE_OACC_DEVICE, OMP_CLAUSE_WAIT) (OMP_CLAUSE_DELETE, OMP_CLAUSE_AUTO, OMP_CLAUSE_TILE): New macros. (gfc_match_omp_clauses): Handle those. (OACC_PARALLEL_CLAUSES, OACC_KERNELS_CLAUSES, OACC_DATA_CLAUSES) (OACC_LOOP_CLAUSES, OACC_PARALLEL_LOOP_CLAUSES) (OACC_KERNELS_LOOP_CLAUSES, OACC_HOST_DATA_CLAUSES) (OACC_DECLARE_CLAUSES, OACC_UPDATE_CLAUSES) (OACC_ENTER_DATA_CLAUSES, OACC_EXIT_DATA_CLAUSES) (OACC_WAIT_CLAUSES): New macros. (gfc_free_expr_list, match_oacc_expr_list, match_oacc_clause_gang) (gfc_match_omp_map_clause, gfc_match_oacc_parallel_loop) (gfc_match_oacc_parallel, gfc_match_oacc_kernels_loop) (gfc_match_oacc_kernels, gfc_match_oacc_data) (gfc_match_oacc_host_data, gfc_match_oacc_loop) (gfc_match_oacc_declare, gfc_match_oacc_update) (gfc_match_oacc_enter_data, gfc_match_oacc_exit_data) (gfc_match_oacc_wait, gfc_match_oacc_cache) (gfc_match_oacc_routine, oacc_is_loop) (resolve_oacc_scalar_int_expr, resolve_oacc_positive_int_expr) (check_symbol_not_pointer, check_array_not_assumed) (resolve_oacc_data_clauses, resolve_oacc_deviceptr_clause) (oacc_compatible_clauses, oacc_is_parallel, oacc_is_kernels) (omp_code_to_statement, oacc_code_to_statement) (resolve_oacc_directive_inside_omp_region) (resolve_omp_directive_inside_oacc_region) (resolve_oacc_nested_loops, resolve_oacc_params_in_parallel) (resolve_oacc_loop_blocks, gfc_resolve_oacc_blocks) (resolve_oacc_loop, resolve_oacc_cache, gfc_resolve_oacc_declare) (gfc_resolve_oacc_directive): New functions. * parse.c (next_free): Update for OpenACC. Move some code into... (verify_token_free): ... this new function. (next_fixed): Update for OpenACC. Move some code into... (verify_token_fixed): ... this new function. (case_executable): Add ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_ENTER_DATA, and ST_OACC_EXIT_DATA. (case_exec_markers): Add ST_OACC_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA, ST_OACC_LOOP, ST_OACC_KERNELS_LOOP. (case_decl): Add ST_OACC_ROUTINE. (push_state, parse_critical_block, parse_progunit): Update for OpenACC. (gfc_ascii_statement): Handle ST_OACC_PARALLEL_LOOP, ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL, ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_KERNELS_LOOP, ST_OACC_END_KERNELS_LOOP, ST_OACC_DATA, ST_OACC_END_DATA, ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA, ST_OACC_LOOP, ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA, ST_OACC_ROUTINE. (verify_st_order, parse_spec): Handle ST_OACC_DECLARE. (parse_executable): Handle ST_OACC_PARALLEL_LOOP, ST_OACC_KERNELS_LOOP, ST_OACC_LOOP, ST_OACC_PARALLEL, ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA. (decode_oacc_directive, parse_oacc_structured_block) (parse_oacc_loop, is_oacc): New functions. * parse.h (struct gfc_state_data): Add oacc_declare_clauses member. (is_oacc): New prototype. * resolve.c (gfc_resolve_blocks, gfc_resolve_code): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (resolve_codes): Call gfc_resolve_oacc_declare. * scanner.c (openacc_flag, openacc_locus): New variables. (skip_free_comments): Update for OpenACC. Move some code into... (skip_omp_attribute): ... this new function. (skip_oacc_attribute): New function. (skip_fixed_comments, gfc_next_char_literal): Update for OpenACC. * st.c (gfc_free_statement): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. * trans-decl.c (gfc_generate_function_code): Update for OpenACC. * trans-openmp.c: Include "gomp-constants.h". (gfc_omp_finish_clause, gfc_trans_omp_clauses): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (gfc_trans_omp_clauses): Handle OMP_LIST_USE_DEVICE, OMP_LIST_DEVICE_RESIDENT, OMP_LIST_CACHE, and OMP_MAP_FORCE_ALLOC, OMP_MAP_FORCE_DEALLOC, OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM, OMP_MAP_FORCE_TOFROM, OMP_MAP_FORCE_PRESENT, OMP_MAP_FORCE_DEVICEPTR, and gfc_omp_clauses' async, seq, independent, wait_list, num_gangs_expr, num_workers_expr, vector_length_expr, vector, vector_expr, worker, worker_expr, gang, gang_expr members. (gfc_trans_omp_do): Handle EXEC_OACC_LOOP. (gfc_convert_expr_to_tree, gfc_trans_oacc_construct) (gfc_trans_oacc_executable_directive) (gfc_trans_oacc_wait_directive, gfc_trans_oacc_combined_directive) (gfc_trans_oacc_declare, gfc_trans_oacc_directive): New functions. * trans-stmt.c (gfc_trans_block_construct): Update for OpenACC. * trans-stmt.h (gfc_trans_oacc_directive, gfc_trans_oacc_declare): New prototypes. * trans.c (tranc_code): Handle EXEC_OACC_CACHE, EXEC_OACC_WAIT, EXEC_OACC_UPDATE, EXEC_OACC_LOOP, EXEC_OACC_HOST_DATA, EXEC_OACC_DATA, EXEC_OACC_KERNELS, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. * gfortran.texi: Update for OpenACC. * intrinsic.texi: Likewise. * invoke.texi: Likewise. gcc/lto/ * lto-lang.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): New macros. * lto.c: Include "gomp-constants.h". gcc/testsuite/ * lib/target-supports.exp (check_effective_target_fopenacc): New procedure. * g++.dg/goacc-gomp/goacc-gomp.exp: New file. * g++.dg/goacc/goacc.exp: Likewise. * gcc.dg/goacc-gomp/goacc-gomp.exp: Likewise. * gcc.dg/goacc/goacc.exp: Likewise. * gfortran.dg/goacc/goacc.exp: Likewise. * c-c++-common/cpp/openacc-define-1.c: New file. * c-c++-common/cpp/openacc-define-2.c: Likewise. * c-c++-common/cpp/openacc-define-3.c: Likewise. * c-c++-common/goacc-gomp/nesting-1.c: Likewise. * c-c++-common/goacc-gomp/nesting-fail-1.c: Likewise. * c-c++-common/goacc/acc_on_device-2-off.c: Likewise. * c-c++-common/goacc/acc_on_device-2.c: Likewise. * c-c++-common/goacc/asyncwait-1.c: Likewise. * c-c++-common/goacc/cache-1.c: Likewise. * c-c++-common/goacc/clauses-fail.c: Likewise. * c-c++-common/goacc/collapse-1.c: Likewise. * c-c++-common/goacc/data-1.c: Likewise. * c-c++-common/goacc/data-2.c: Likewise. * c-c++-common/goacc/data-clause-duplicate-1.c: Likewise. * c-c++-common/goacc/deviceptr-1.c: Likewise. * c-c++-common/goacc/deviceptr-2.c: Likewise. * c-c++-common/goacc/deviceptr-3.c: Likewise. * c-c++-common/goacc/if-clause-1.c: Likewise. * c-c++-common/goacc/if-clause-2.c: Likewise. * c-c++-common/goacc/kernels-1.c: Likewise. * c-c++-common/goacc/loop-1.c: Likewise. * c-c++-common/goacc/loop-private-1.c: Likewise. * c-c++-common/goacc/nesting-1.c: Likewise. * c-c++-common/goacc/nesting-data-1.c: Likewise. * c-c++-common/goacc/nesting-fail-1.c: Likewise. * c-c++-common/goacc/parallel-1.c: Likewise. * c-c++-common/goacc/pcopy.c: Likewise. * c-c++-common/goacc/pcopyin.c: Likewise. * c-c++-common/goacc/pcopyout.c: Likewise. * c-c++-common/goacc/pcreate.c: Likewise. * c-c++-common/goacc/pragma_context.c: Likewise. * c-c++-common/goacc/present-1.c: Likewise. * c-c++-common/goacc/reduction-1.c: Likewise. * c-c++-common/goacc/reduction-2.c: Likewise. * c-c++-common/goacc/reduction-3.c: Likewise. * c-c++-common/goacc/reduction-4.c: Likewise. * c-c++-common/goacc/sb-1.c: Likewise. * c-c++-common/goacc/sb-2.c: Likewise. * c-c++-common/goacc/sb-3.c: Likewise. * c-c++-common/goacc/update-1.c: Likewise. * gcc.dg/goacc/acc_on_device-1.c: Likewise. * gfortran.dg/goacc/acc_on_device-1.f95: Likewise. * gfortran.dg/goacc/acc_on_device-2-off.f95: Likewise. * gfortran.dg/goacc/acc_on_device-2.f95: Likewise. * gfortran.dg/goacc/assumed.f95: Likewise. * gfortran.dg/goacc/asyncwait-1.f95: Likewise. * gfortran.dg/goacc/asyncwait-2.f95: Likewise. * gfortran.dg/goacc/asyncwait-3.f95: Likewise. * gfortran.dg/goacc/asyncwait-4.f95: Likewise. * gfortran.dg/goacc/branch.f95: Likewise. * gfortran.dg/goacc/cache-1.f95: Likewise. * gfortran.dg/goacc/coarray.f95: Likewise. * gfortran.dg/goacc/continuation-free-form.f95: Likewise. * gfortran.dg/goacc/cray.f95: Likewise. * gfortran.dg/goacc/critical.f95: Likewise. * gfortran.dg/goacc/data-clauses.f95: Likewise. * gfortran.dg/goacc/data-tree.f95: Likewise. * gfortran.dg/goacc/declare-1.f95: Likewise. * gfortran.dg/goacc/enter-exit-data.f95: Likewise. * gfortran.dg/goacc/fixed-1.f: Likewise. * gfortran.dg/goacc/fixed-2.f: Likewise. * gfortran.dg/goacc/fixed-3.f: Likewise. * gfortran.dg/goacc/fixed-4.f: Likewise. * gfortran.dg/goacc/host_data-tree.f95: Likewise. * gfortran.dg/goacc/if.f95: Likewise. * gfortran.dg/goacc/kernels-tree.f95: Likewise. * gfortran.dg/goacc/list.f95: Likewise. * gfortran.dg/goacc/literal.f95: Likewise. * gfortran.dg/goacc/loop-1.f95: Likewise. * gfortran.dg/goacc/loop-2.f95: Likewise. * gfortran.dg/goacc/loop-3.f95: Likewise. * gfortran.dg/goacc/loop-tree-1.f90: Likewise. * gfortran.dg/goacc/omp.f95: Likewise. * gfortran.dg/goacc/parallel-kernels-clauses.f95: Likewise. * gfortran.dg/goacc/parallel-kernels-regions.f95: Likewise. * gfortran.dg/goacc/parallel-tree.f95: Likewise. * gfortran.dg/goacc/parameter.f95: Likewise. * gfortran.dg/goacc/private-1.f95: Likewise. * gfortran.dg/goacc/private-2.f95: Likewise. * gfortran.dg/goacc/private-3.f95: Likewise. * gfortran.dg/goacc/pure-elemental-procedures.f95: Likewise. * gfortran.dg/goacc/reduction-2.f95: Likewise. * gfortran.dg/goacc/reduction.f95: Likewise. * gfortran.dg/goacc/routine-1.f90: Likewise. * gfortran.dg/goacc/routine-2.f90: Likewise. * gfortran.dg/goacc/sentinel-free-form.f95: Likewise. * gfortran.dg/goacc/several-directives.f95: Likewise. * gfortran.dg/goacc/sie.f95: Likewise. * gfortran.dg/goacc/subarrays.f95: Likewise. * gfortran.dg/gomp/map-1.f90: Likewise. * gfortran.dg/openacc-define-1.f90: Likewise. * gfortran.dg/openacc-define-2.f90: Likewise. * gfortran.dg/openacc-define-3.f90: Likewise. * g++.dg/gomp/block-1.C: Update for changed compiler output. * g++.dg/gomp/block-2.C: Likewise. * g++.dg/gomp/block-3.C: Likewise. * g++.dg/gomp/block-5.C: Likewise. * g++.dg/gomp/target-1.C: Likewise. * g++.dg/gomp/target-2.C: Likewise. * g++.dg/gomp/taskgroup-1.C: Likewise. * g++.dg/gomp/teams-1.C: Likewise. * gcc.dg/cilk-plus/jump-openmp.c: Likewise. * gcc.dg/cilk-plus/jump.c: Likewise. * gcc.dg/gomp/block-1.c: Likewise. * gcc.dg/gomp/block-10.c: Likewise. * gcc.dg/gomp/block-2.c: Likewise. * gcc.dg/gomp/block-3.c: Likewise. * gcc.dg/gomp/block-4.c: Likewise. * gcc.dg/gomp/block-5.c: Likewise. * gcc.dg/gomp/block-6.c: Likewise. * gcc.dg/gomp/block-7.c: Likewise. * gcc.dg/gomp/block-8.c: Likewise. * gcc.dg/gomp/block-9.c: Likewise. * gcc.dg/gomp/target-1.c: Likewise. * gcc.dg/gomp/target-2.c: Likewise. * gcc.dg/gomp/taskgroup-1.c: Likewise. * gcc.dg/gomp/teams-1.c: Likewise. include/ * gomp-constants.h: New file. libgomp/ * Makefile.am (search_path): Add $(top_srcdir)/../include. (libgomp_la_SOURCES): Add splay-tree.c, libgomp-plugin.c, oacc-parallel.c, oacc-host.c, oacc-init.c, oacc-mem.c, oacc-async.c, oacc-plugin.c, oacc-cuda.c. [USE_FORTRAN] (libgomp_la_SOURCES): Add openacc.f90. Include $(top_srcdir)/plugin/Makefrag.am. (nodist_libsubinclude_HEADERS): Add openacc.h. [USE_FORTRAN] (nodist_finclude_HEADERS): Add openacc_lib.h, openacc.f90, openacc.mod, openacc_kinds.mod. (omp_lib.mod): Generalize into... (%.mod): ... this new rule. (openacc_kinds.mod, openacc.mod): New rules. * plugin/configfrag.ac: New file. * configure.ac: Move plugin/offloading support into it. Include it. Instantiate testsuite/libgomp-test-support.pt.exp. * plugin/Makefrag.am: New file. * testsuite/Makefile.am (OFFLOAD_TARGETS) (OFFLOAD_ADDITIONAL_OPTIONS, OFFLOAD_ADDITIONAL_LIB_PATHS): Don't export. (libgomp-test-support.exp): New rule. (all-local): Depend on it. * Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. * config.h.in: Likewise. * configure: Likewise. * configure.tgt: Harden shell syntax. * env.c: Include "oacc-int.h". (parse_acc_device_type): New function. (gomp_debug_var, goacc_device_type, goacc_device_num): New variables. (initialize_env): Initialize those. Call goacc_runtime_initialize. * error.c (gomp_vdebug, gomp_debug, gomp_vfatal): New functions. (gomp_fatal): Call gomp_vfatal. * libgomp.h: Include "libgomp-plugin.h" and <stdarg.h>. (gomp_debug_var, goacc_device_type, goacc_device_num, gomp_vdebug) (gomp_debug, gomp_verror, gomp_vfatal, gomp_init_targets_once) (splay_tree_node, splay_tree, splay_tree_key) (struct target_mem_desc, struct splay_tree_key_s) (struct gomp_memory_mapping, struct acc_dispatch_t) (struct gomp_device_descr, gomp_acc_insert_pointer) (gomp_acc_remove_pointer, target_mem_desc, gomp_copy_from_async) (gomp_unmap_vars, gomp_init_device, gomp_init_tables) (gomp_free_memmap, gomp_fini_device): New declarations. (gomp_vdebug, gomp_debug): New macros. Include "splay-tree.h". * libgomp.map (OACC_2.0): New symbol version. Use for acc_get_num_devices, acc_get_num_devices_h_, acc_set_device_type, acc_set_device_type_h_, acc_get_device_type, acc_get_device_type_h_, acc_set_device_num, acc_set_device_num_h_, acc_get_device_num, acc_get_device_num_h_, acc_async_test, acc_async_test_h_, acc_async_test_all, acc_async_test_all_h_, acc_wait, acc_wait_h_, acc_wait_async, acc_wait_async_h_, acc_wait_all, acc_wait_all_h_, acc_wait_all_async, acc_wait_all_async_h_, acc_init, acc_init_h_, acc_shutdown, acc_shutdown_h_, acc_on_device, acc_on_device_h_, acc_malloc, acc_free, acc_copyin, acc_copyin_32_h_, acc_copyin_64_h_, acc_copyin_array_h_, acc_present_or_copyin, acc_present_or_copyin_32_h_, acc_present_or_copyin_64_h_, acc_present_or_copyin_array_h_, acc_create, acc_create_32_h_, acc_create_64_h_, acc_create_array_h_, acc_present_or_create, acc_present_or_create_32_h_, acc_present_or_create_64_h_, acc_present_or_create_array_h_, acc_copyout, acc_copyout_32_h_, acc_copyout_64_h_, acc_copyout_array_h_, acc_delete, acc_delete_32_h_, acc_delete_64_h_, acc_delete_array_h_, acc_update_device, acc_update_device_32_h_, acc_update_device_64_h_, acc_update_device_array_h_, acc_update_self, acc_update_self_32_h_, acc_update_self_64_h_, acc_update_self_array_h_, acc_map_data, acc_unmap_data, acc_deviceptr, acc_hostptr, acc_is_present, acc_is_present_32_h_, acc_is_present_64_h_, acc_is_present_array_h_, acc_memcpy_to_device, acc_memcpy_from_device, acc_get_current_cuda_device, acc_get_current_cuda_context, acc_get_cuda_stream, acc_set_cuda_stream. (GOACC_2.0): New symbol version. Use for GOACC_data_end, GOACC_data_start, GOACC_enter_exit_data, GOACC_parallel, GOACC_update, GOACC_wait, GOACC_get_thread_num, GOACC_get_num_threads. (GOMP_PLUGIN_1.0): New symbol version. Use for GOMP_PLUGIN_malloc, GOMP_PLUGIN_malloc_cleared, GOMP_PLUGIN_realloc, GOMP_PLUGIN_debug, GOMP_PLUGIN_error, GOMP_PLUGIN_fatal, GOMP_PLUGIN_async_unmap_vars, GOMP_PLUGIN_acc_thread. * libgomp.texi: Update for OpenACC changes, and GOMP_DEBUG environment variable. * libgomp_g.h (GOACC_data_start, GOACC_data_end) (GOACC_enter_exit_data, GOACC_parallel, GOACC_update, GOACC_wait) (GOACC_get_num_threads, GOACC_get_thread_num): New declarations. * splay-tree.h (splay_tree_lookup, splay_tree_insert) (splay_tree_remove): New declarations. (rotate_left, rotate_right, splay_tree_splay, splay_tree_insert) (splay_tree_remove, splay_tree_lookup): Move into... * splay-tree.c: ... this new file. * target.c: Include "oacc-plugin.h", "oacc-int.h", <assert.h>. (splay_tree_node, splay_tree, splay_tree_key) (struct target_mem_desc, struct splay_tree_key_s) (struct gomp_device_descr): Don't declare. (num_devices_openmp): New variable. (gomp_get_num_devices ): Use it. (gomp_init_targets_once): New function. (gomp_get_num_devices ): Use it. (get_kind, gomp_copy_from_async, gomp_free_memmap) (gomp_fini_device, gomp_register_image_for_device): New functions. (gomp_map_vars): Add devaddrs parameter. (gomp_update): Add mm parameter. (gomp_init_device): Move most of it into... (gomp_init_tables): ... this new function. (gomp_register_images_for_device): Remove function. (splay_compare, gomp_map_vars, gomp_unmap_vars, gomp_init_device): Make them hidden instead of static. (gomp_map_vars_existing, gomp_map_vars, gomp_unmap_vars) (gomp_update, gomp_init_device, GOMP_target, GOMP_target_data) (GOMP_target_end_data, GOMP_target_update) (gomp_load_plugin_for_device, gomp_target_init): Update for OpenACC changes. * oacc-async.c: New file. * oacc-cuda.c: Likewise. * oacc-host.c: Likewise. * oacc-init.c: Likewise. * oacc-int.h: Likewise. * oacc-mem.c: Likewise. * oacc-parallel.c: Likewise. * oacc-plugin.c: Likewise. * oacc-plugin.h: Likewise. * oacc-ptx.h: Likewise. * openacc.f90: Likewise. * openacc.h: Likewise. * openacc_lib.h: Likewise. * plugin/plugin-host.c: Likewise. * plugin/plugin-nvptx.c: Likewise. * libgomp-plugin.c: Likewise. * libgomp-plugin.h: Likewise. * libgomp_target.h: Remove file after merging content into the former file. Update all users. * testsuite/lib/libgomp.exp: Load libgomp-test-support.exp. (offload_targets_s, offload_targets_s_openacc): New variables. (check_effective_target_openacc_nvidia_accel_present) (check_effective_target_openacc_nvidia_accel_selected): New procedures. (libgomp_init): Update for OpenACC changes. * testsuite/libgomp-test-support.exp.in: New file. * testsuite/libgomp.oacc-c++/c++.exp: Likewise. * testsuite/libgomp.oacc-c/c.exp: Likewise. * testsuite/libgomp.oacc-fortran/fortran.exp: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/asyncwait-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/cache-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/clauses-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/clauses-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-6.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-7.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-8.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/deviceptr-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/if-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/kernels-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/kernels-empty.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-10.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-11.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-12.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-13.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-14.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-15.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-16.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-17.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-18.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-19.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-20.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-21.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-22.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-23.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-24.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-25.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-26.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-27.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-28.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-29.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-30.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-31.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-32.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-33.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-34.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-35.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-36.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-37.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-38.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-39.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-40.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-41.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-42.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-43.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-44.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-45.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-46.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-47.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-48.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-49.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-50.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-51.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-52.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-53.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-54.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-55.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-56.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-57.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-58.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-59.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-6.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-60.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-61.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-62.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-63.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-64.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-65.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-66.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-67.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-68.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-69.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-7.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-70.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-71.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-72.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-73.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-74.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-75.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-76.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-77.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-78.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-79.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-80.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-81.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-82.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-83.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-84.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-85.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-86.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-87.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-88.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-89.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-9.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-90.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-91.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-92.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/nested-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/nested-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/offset-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/parallel-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/parallel-empty.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/pointer-align-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/present-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/present-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-initial-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/subr.h: Likewise. * testsuite/libgomp.oacc-c-c++-common/subr.ptx: Likewise. * testsuite/libgomp.oacc-c-c++-common/timer.h: Likewise. * testsuite/libgomp.oacc-c-c++-common/update-1-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/update-1.c: Likewise. * testsuite/libgomp.oacc-fortran/abort-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/abort-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-7.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-8.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-4-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-already-1.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-2.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-3.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-4.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-5.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-6.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-7.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-8.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-10.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-2.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-3.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-7.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-8.f90: Likewise. * testsuite/libgomp.oacc-fortran/map-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/openacc_version-1.f: Likewise. * testsuite/libgomp.oacc-fortran/openacc_version-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/pointer-align-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/pset-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/subarrays-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/subarrays-2.f90: Likewise. liboffloadmic/ * plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_get_name) (GOMP_OFFLOAD_get_caps, GOMP_OFFLOAD_fini_device): New functions. Co-Authored-By: Bernd Schmidt <bernds@codesourcery.com> Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com> Co-Authored-By: Dmitry Bocharnikov <dmitry.b@samsung.com> Co-Authored-By: Evgeny Gavrin <e.gavrin@samsung.com> Co-Authored-By: Ilmir Usmanov <i.usmanov@samsung.com> Co-Authored-By: Jakub Jelinek <jakub@redhat.com> Co-Authored-By: James Norris <jnorris@codesourcery.com> Co-Authored-By: Julian Brown <julian@codesourcery.com> Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> Co-Authored-By: Tom de Vries <tom@codesourcery.com> From-SVN: r219682
2015-01-15 21:11:12 +01:00
Originally, libgomp implemented the GNU OpenMP Runtime Library. Based
on this, support for OpenACC and offloading (both OpenACC and OpenMP
4's target construct) has been added later on, and the library's name
changed to GNU Offloading and Multi Processing Runtime Library.
@comment
@comment When you add a new menu item, please keep the right hand
@comment aligned to the same column. Do not use tabs. This provides
@comment better formatting.
@comment
@menu
* Enabling OpenMP:: How to enable OpenMP for your applications.
* Runtime Library Routines:: The OpenMP runtime application programming
interface.
* Environment Variables:: Influencing runtime behavior with environment
variables.
* The libgomp ABI:: Notes on the external ABI presented by libgomp.
* Reporting Bugs:: How to report bugs in the GNU Offloading and
Multi Processing Runtime Library.
* Copying:: GNU general public license says
how you can copy and share libgomp.
* GNU Free Documentation License::
How you can copy and share this manual.
* Funding:: How to help assure continued work for free
software.
* Library Index:: Index of this documentation.
@end menu
@c ---------------------------------------------------------------------
@c Enabling OpenMP
@c ---------------------------------------------------------------------
@node Enabling OpenMP
@chapter Enabling OpenMP
To activate the OpenMP extensions for C/C++ and Fortran, the compile-time
flag @command{-fopenmp} must be specified. This enables the OpenMP directive
@code{#pragma omp} in C/C++ and @code{!$omp} directives in free form,
@code{c$omp}, @code{*$omp} and @code{!$omp} directives in fixed form,
@code{!$} conditional compilation sentinels in free form and @code{c$},
@code{*$} and @code{!$} sentinels in fixed form, for Fortran. The flag also
arranges for automatic linking of the OpenMP runtime library
(@ref{Runtime Library Routines}).
A complete description of all OpenMP directives accepted may be found in
the @uref{http://www.openmp.org, OpenMP Application Program Interface} manual,
version 4.0.
@c ---------------------------------------------------------------------
@c Runtime Library Routines
@c ---------------------------------------------------------------------
@node Runtime Library Routines
@chapter Runtime Library Routines
The runtime routines described here are defined by Section 3 of the OpenMP
specification in version 4.0. The routines are structured in following
three parts:
@menu
Control threads, processors and the parallel environment. They have C
linkage, and do not throw exceptions.
* omp_get_active_level:: Number of active parallel regions
* omp_get_ancestor_thread_num:: Ancestor thread ID
* omp_get_cancellation:: Whether cancellation support is enabled
* omp_get_default_device:: Get the default device for target regions
* omp_get_dynamic:: Dynamic teams setting
* omp_get_level:: Number of parallel regions
* omp_get_max_active_levels:: Maximum number of active regions
* omp_get_max_threads:: Maximum number of threads of parallel region
* omp_get_nested:: Nested parallel regions
* omp_get_num_devices:: Number of target devices
* omp_get_num_procs:: Number of processors online
* omp_get_num_teams:: Number of teams
* omp_get_num_threads:: Size of the active team
* omp_get_proc_bind:: Whether theads may be moved between CPUs
* omp_get_schedule:: Obtain the runtime scheduling method
* omp_get_team_num:: Get team number
* omp_get_team_size:: Number of threads in a team
* omp_get_thread_limit:: Maximum number of threads
* omp_get_thread_num:: Current thread ID
* omp_in_parallel:: Whether a parallel region is active
backport: re PR fortran/46752 (OpenMP - Seg fault for unallocated allocatable array in firstprivate clause) Merge from gomp-3_1-branch branch: 2011-08-02 Jakub Jelinek <jakub@redhat.com> gcc/ * c-parser.c (enum c_parser_prec): New enum, moved from within c_parser_binary_expression. (c_parser_binary_expression): Add PREC argument. Stop parsing if operator has lower or equal precedence than PREC. (c_parser_conditional_expression, c_parser_omp_for_loop): Adjust callers. (c_parser_omp_atomic): Handle parsing OpenMP 3.1 atomics. Adjust c_finish_omp_atomic caller. (c_parser_omp_taskyield): New function. (c_parser_pragma): Handle PRAGMA_OMP_TASKYIELD. (c_parser_omp_clause_name): Handle final and mergeable clauses. (c_parser_omp_clause_final, c_parser_omp_clause_mergeable): New functions. (c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. (OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses. (c_parser_omp_clause_reduction): Handle min and max. * c-typeck.c (c_finish_omp_clauses): Don't complain about const qualified predetermined vars in firstprivate clause. andle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. Handle MIN_EXPR and MAX_EXPR. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (dump_generic_node): Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW. * tree.c (omp_clause_num_ops): Add OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (omp_clause_code_name): Likewise. (walk_tree_1): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * tree.h (enum omp_clause_code): Add OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (OMP_CLAUSE_FINAL_EXPR): Define. * omp-low.c (scan_sharing_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (expand_task_call): Likewise. (expand_omp_atomic_load, expand_omp_atomic_store): New functions. (expand_omp_atomic_fetch_op): Handle cases where old or new value is needed afterwards. (expand_omp_atomic): Call expand_omp_atomic_load resp. expand_omp_atomic_store. * gimplify.c (gimplify_omp_atomic, gimplify_expr): Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * tree-nested.c (convert_nonlocal_omp_clauses, convert_local_omp_clauses): Likewise. * tree.def (OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD, OMP_ATOMIC_CAPTURE_NEW): New. * gimple.h (GF_OMP_ATOMIC_NEED_VALUE): New. (gimple_omp_atomic_need_value_p, gimple_omp_atomic_set_need_value): New inlines. * omp-builtins.def (BUILT_IN_GOMP_TASKYIELD): New builtin. * doc/generic.texi: Mention OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. gcc/c-family/ * c-common.h (c_finish_omp_atomic): Adjust prototype. (c_finish_omp_taskyield): New prototype. * c-omp.c (c_finish_omp_atomic): Add OPCODE, V, LHS1 and RHS1 arguments. Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW in addition to OMP_ATOMIC. If LHS1 or RHS1 have side-effects, evaluate those too in the right spot, if it is a decl and LHS is also a decl, error out if they aren't the same. (c_finish_omp_taskyield): New function. * c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP to 201107. * c-pragma.c (omp_pragmas): Add taskyield. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_TASKYIELD. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. gcc/cp/ * cp-tree.h (finish_omp_atomic): Adjust prototype. (cxx_omp_const_qual_no_mutable): New prototype. (finish_omp_taskyield): New prototype. * parser.c (cp_parser_omp_atomic): (cp_parser_omp_atomic): Handle parsing OpenMP 3.1 atomics. Adjust finish_omp_atomic caller. (cp_parser_omp_clause_name): Handle final and mergeable clauses. (cp_parser_omp_clause_final, cp_parser_omp_clause_mergeable): New functions. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. (OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses. (cp_parser_omp_taskyield): New function. (cp_parser_pragma): Handle PRAGMA_OMP_TASKYIELD. (cp_parser_omp_clause_reduction): Handle min and max. * pt.c (tsubst_expr) <case OMP_ATOMIC>: Handle OpenMP 3.1 atomics. (tsubst_omp_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * semantics.c (finish_omp_atomic): Add OPCODE, V, LHS1 and RHS1 arguments. Handle OpenMP 3.1 atomics. Adjust c_finish_omp_atomic caller. (finish_omp_clauses): Don't complain about const qualified predetermined vars and static data members in firstprivate clause. Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. Handle MIN_EXPR and MAX_EXPR. (finish_omp_taskyield): New function. * cp-gimplify.c (cxx_omp_const_qual_no_mutable): New function. (cxx_omp_predetermined_sharing): Use it. gcc/fortran/ PR fortran/46752 * cpp.c (cpp_define_builtins): Change _OPENMP to 201107. * openmp.c (gfc_free_omp_clauses): Free also final_expr. (OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE): Define. (gfc_match_omp_clauses): Handle parsing final and mergeable clauses. (OMP_TASK_CLAUSES): Allow final and mergeable clauses. (gfc_match_omp_taskyield): New function. (resolve_omp_clauses): Resolve final clause. Allow POINTERs and Cray pointers in clauses other than REDUCTION. (gfc_match_omp_atomic): Match optional read/write/update/capture keywords after !$omp atomic. (resolve_omp_atomic): Handle all OpenMP 3.1 atomic forms. * dump-parse-tree.c (show_omp_node): Handle EXEC_OMP_TASKYIELD, print final and mergeable clauses. (show_code_node): Handle EXEC_OMP_TASKYIELD. * trans-openmp.c (gfc_trans_omp_clauses): Handle final and mergeable clauses. (gfc_trans_omp_taskyield): New function. (gfc_trans_omp_directive): Handle EXEC_OMP_TASKYIELD. (gfc_trans_omp_atomic): Handle all OpenMP 3.1 atomic forms. (gfc_omp_clause_copy_ctor): Handle non-allocated allocatable. (gfc_omp_predetermined_sharing): Adjust comment. * gfortran.h (gfc_statement): Add ST_OMP_TASKYIELD and ST_OMP_END_ATOMIC. (gfc_omp_clauses): Add final_expr and mergeable fields. (gfc_exec_op): Add EXEC_OMP_TASKYIELD. (gfc_omp_atomic_op): New enum typedef. (struct gfc_code): Add ext.omp_atomic. * trans.c (trans_code): Handle EXEC_OMP_TASKYIELD. * frontend-passes.c (gfc_code_walker): Also walk final_expr. * resolve.c (gfc_resolve_blocks, resolve_code): Handle EXEC_OMP_TASKYIELD. * st.c (gfc_free_statement): Likewise. * match.h (gfc_match_omp_taskyield): New prototype. * parse.c (decode_omp_directive): Handle taskyield directive. Handle !$omp end atomic. (case_executable): Add ST_OMP_TASKYIELD case. (gfc_ascii_statement): Handle ST_OMP_TASKYIELD. (parse_omp_atomic): Return gfc_statement instead of void. For !$omp atomic capture parse two assignments instead of just one and require !$omp end atomic afterwards, for other !$omp atomic forms just allow !$omp end atomic at the end. (parse_omp_structured_block, parse_executable): Adjust parse_omp_atomic callers. 2011-08-02 Tobias Burnus <burnus@net-b.de> * intrinsic.c (OMP_LIB): Updated openmp_version's value to 201107. * gfortran.texi (OpenMP): Update ref to OpenMP 3.1. * intrinsic.texi (OpenMP Modules): Update ref to OpenMP 3.1; remove deleted omp_integer_kind and omp_logical_kind constants. gcc/testsuite/ PR fortran/46752 * gcc.dg/gomp/atomic-5.c: Adjust expected diagnostics. * gcc.dg/gomp/atomic-15.c: New test. * g++.dg/gomp/atomic-5.C: Adjust expected diagnostics. * g++.dg/gomp/atomic-15.C: New test. * g++.dg/gomp/private-1.C: New test. * g++.dg/gomp/sharing-2.C: New test. * gfortran.dg/gomp/crayptr1.f90: Don't expect error about Cray pointer in FIRSTPRIVATE/LASTPRIVATE. * gfortran.dg/gomp/omp_atomic2.f90: New test. libgomp/ PR fortran/42041 PR fortran/46752 * omp.h.in (omp_in_final): New prototype. * omp_lib.f90.in (omp_in_final): New interface. (omp_integer_kind, omp_logical_kind): Remove and replace all its uses in the module with 4. (openmp_version): Change to 201107. * omp_lib.h.in (omp_sched_static, omp_sched_dynamic, omp_sched_guided, omp_sched_auto): Use omp_sched_kind kind for the parameters. (omp_in_final): New external. (openmp_version): Change to 201107. * task.c (omp_in_final): New function. (gomp_init_task): Initialize final_task. (GOMP_task): Remove unused attribute from flags. Handle final tasks. (GOMP_taskyield): New function. (omp_in_final): Return true if if (false) or final (true) task or descendant of final (true). * fortran.c (omp_in_final_): New function. * libgomp.map (OMP_3.1): Export omp_in_final and omp_in_final_. (GOMP_3.0): Export GOMP_taskyield. * env.c (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New variables. (parse_unsigned_long_list): New function. (initialize_env): Use it for OMP_NUM_THREADS. Call parse_boolean with "OMP_PROC_BIND". If OMP_PROC_BIND=true, call gomp_init_affinity even if parse_affinity returned false. * config/linux/affinity.c (gomp_init_affinity): Handle gomp_cpu_affinity_len == 0. * libgomp_g.h (GOMP_taskyield): New prototype. * libgomp.h (struct gomp_task): Add final_task field. (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New externs. * team.c (gomp_team_start): Override new task's nthreads_var icv if list form OMP_NUM_THREADS has been used and it has value for the new nesting level. * 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/reduction-6.c: New test. * testsuite/libgomp.c/task-5.c: New test. * testsuite/libgomp.c++/atomic-2.C: New test. * testsuite/libgomp.c++/atomic-3.C: New test. * testsuite/libgomp.c++/atomic-4.C: New test. * testsuite/libgomp.c++/atomic-5.C: New test. * testsuite/libgomp.c++/atomic-6.C: New test. * testsuite/libgomp.c++/atomic-7.C: New test. * testsuite/libgomp.c++/atomic-8.C: New test. * testsuite/libgomp.c++/atomic-9.C: New test. * testsuite/libgomp.c++/task-8.C: New test. * testsuite/libgomp.c++/reduction-4.C: New test. * testsuite/libgomp.fortran/allocatable7.f90: New test. * testsuite/libgomp.fortran/allocatable8.f90: New test. * testsuite/libgomp.fortran/crayptr3.f90: New test. * testsuite/libgomp.fortran/omp_atomic3.f90: New test. * testsuite/libgomp.fortran/omp_atomic4.f90: New test. * testsuite/libgomp.fortran/pointer1.f90: New test. * testsuite/libgomp.fortran/pointer2.f90: New test. * testsuite/libgomp.fortran/task4.f90: New test. 2011-08-02 Tobias Burnus <burnus@net-b.de> * libgomp.texi: Update OpenMP spec references to 3.1. (omp_in_final,OMP_PROC_BIND): New sections. (OMP_NUM_THREADS): Document that the value can be now a list. (GOMP_STACKSIZE,GOMP_CPU_AFFINITY): Update @ref. From-SVN: r177194
2011-08-02 18:13:29 +02:00
* omp_in_final:: Whether in final or included task region
* omp_is_initial_device:: Whether executing on the host device
* omp_set_default_device:: Set the default device for target regions
* omp_set_dynamic:: Enable/disable dynamic teams
* omp_set_max_active_levels:: Limits the number of active parallel regions
* omp_set_nested:: Enable/disable nested parallel regions
* omp_set_num_threads:: Set upper team size limit
* omp_set_schedule:: Set the runtime scheduling method
Initialize, set, test, unset and destroy simple and nested locks.
* omp_init_lock:: Initialize simple lock
* omp_set_lock:: Wait for and set simple lock
* omp_test_lock:: Test and set simple lock if available
* omp_unset_lock:: Unset simple lock
* omp_destroy_lock:: Destroy simple lock
* omp_init_nest_lock:: Initialize nested lock
* omp_set_nest_lock:: Wait for and set simple lock
* omp_test_nest_lock:: Test and set nested lock if available
* omp_unset_nest_lock:: Unset nested lock
* omp_destroy_nest_lock:: Destroy nested lock
Portable, thread-based, wall clock timer.
* omp_get_wtick:: Get timer precision.
* omp_get_wtime:: Elapsed wall clock time.
@end menu
@node omp_get_active_level
@section @code{omp_get_active_level} -- Number of parallel regions
@table @asis
@item @emph{Description}:
This function returns the nesting level for the active parallel blocks,
which enclose the calling call.
@item @emph{C/C++}
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_active_level(void);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{integer function omp_get_active_level()}
@end multitable
@item @emph{See also}:
@ref{omp_get_level}, @ref{omp_get_max_active_levels}, @ref{omp_set_max_active_levels}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.20.
@end table
@node omp_get_ancestor_thread_num
@section @code{omp_get_ancestor_thread_num} -- Ancestor thread ID
@table @asis
@item @emph{Description}:
This function returns the thread identification number for the given
nesting level of the current thread. For values of @var{level} outside
zero to @code{omp_get_level} -1 is returned; if @var{level} is
@code{omp_get_level} the result is identical to @code{omp_get_thread_num}.
@item @emph{C/C++}
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_ancestor_thread_num(int level);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{integer function omp_get_ancestor_thread_num(level)}
@item @tab @code{integer level}
@end multitable
@item @emph{See also}:
@ref{omp_get_level}, @ref{omp_get_thread_num}, @ref{omp_get_team_size}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.18.
@end table
@node omp_get_cancellation
@section @code{omp_get_cancellation} -- Whether cancellation support is enabled
@table @asis
@item @emph{Description}:
This function returns @code{true} if cancellation is activated, @code{false}
otherwise. Here, @code{true} and @code{false} represent their language-specific
counterparts. Unless @env{OMP_CANCELLATION} is set true, cancellations are
deactivated.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_cancellation(void);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{logical function omp_get_cancellation()}
@end multitable
@item @emph{See also}:
@ref{OMP_CANCELLATION}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.9.
@end table
@node omp_get_default_device
@section @code{omp_get_default_device} -- Get the default device for target regions
@table @asis
@item @emph{Description}:
Get the default device for target regions without device clause.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_default_device(void);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{integer function omp_get_default_device()}
@end multitable
@item @emph{See also}:
@ref{OMP_DEFAULT_DEVICE}, @ref{omp_set_default_device}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.24.
@end table
@node omp_get_dynamic
@section @code{omp_get_dynamic} -- Dynamic teams setting
@table @asis
@item @emph{Description}:
This function returns @code{true} if enabled, @code{false} otherwise.
Here, @code{true} and @code{false} represent their language-specific
counterparts.
The dynamic team setting may be initialized at startup by the
@env{OMP_DYNAMIC} environment variable or at runtime using
@code{omp_set_dynamic}. If undefined, dynamic adjustment is
disabled by default.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_dynamic(void);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{logical function omp_get_dynamic()}
@end multitable
@item @emph{See also}:
@ref{omp_set_dynamic}, @ref{OMP_DYNAMIC}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.8.
@end table
@node omp_get_level
@section @code{omp_get_level} -- Obtain the current nesting level
@table @asis
@item @emph{Description}:
This function returns the nesting level for the parallel blocks,
which enclose the calling call.
@item @emph{C/C++}
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_level(void);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{integer function omp_level()}
@end multitable
@item @emph{See also}:
@ref{omp_get_active_level}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.17.
@end table
@node omp_get_max_active_levels
@section @code{omp_get_max_active_levels} -- Maximum number of active regions
@table @asis
@item @emph{Description}:
This function obtains the maximum allowed number of nested, active parallel regions.
@item @emph{C/C++}
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_max_active_levels(void);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{integer function omp_get_max_active_levels()}
@end multitable
@item @emph{See also}:
@ref{omp_set_max_active_levels}, @ref{omp_get_active_level}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.16.
@end table
@node omp_get_max_threads
@section @code{omp_get_max_threads} -- Maximum number of threads of parallel region
@table @asis
@item @emph{Description}:
Return the maximum number of threads used for the current parallel region
that does not use the clause @code{num_threads}.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_max_threads(void);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{integer function omp_get_max_threads()}
@end multitable
@item @emph{See also}:
@ref{omp_set_num_threads}, @ref{omp_set_dynamic}, @ref{omp_get_thread_limit}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.3.
@end table
@node omp_get_nested
@section @code{omp_get_nested} -- Nested parallel regions
@table @asis
@item @emph{Description}:
This function returns @code{true} if nested parallel regions are
enabled, @code{false} otherwise. Here, @code{true} and @code{false}
represent their language-specific counterparts.
Nested parallel regions may be initialized at startup by the
@env{OMP_NESTED} environment variable or at runtime using
@code{omp_set_nested}. If undefined, nested parallel regions are
disabled by default.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_nested(void);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{logical function omp_get_nested()}
@end multitable
@item @emph{See also}:
@ref{omp_set_nested}, @ref{OMP_NESTED}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.11.
@end table
@node omp_get_num_devices
@section @code{omp_get_num_devices} -- Number of target devices
@table @asis
@item @emph{Description}:
Returns the number of target devices.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_num_devices(void);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{integer function omp_get_num_devices()}
@end multitable
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.25.
@end table
@node omp_get_num_procs
@section @code{omp_get_num_procs} -- Number of processors online
@table @asis
@item @emph{Description}:
Returns the number of processors online on that device.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_num_procs(void);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{integer function omp_get_num_procs()}
@end multitable
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.5.
@end table
@node omp_get_num_teams
@section @code{omp_get_num_teams} -- Number of teams
@table @asis
@item @emph{Description}:
Returns the number of teams in the current team region.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_num_teams(void);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{integer function omp_get_num_teams()}
@end multitable
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.26.
@end table
@node omp_get_num_threads
@section @code{omp_get_num_threads} -- Size of the active team
@table @asis
@item @emph{Description}:
Returns the number of threads in the current team. In a sequential section of
the program @code{omp_get_num_threads} returns 1.
The default team size may be initialized at startup by the
@env{OMP_NUM_THREADS} environment variable. At runtime, the size
of the current team may be set either by the @code{NUM_THREADS}
clause or by @code{omp_set_num_threads}. If none of the above were
used to define a specific value and @env{OMP_DYNAMIC} is disabled,
one thread per CPU online is used.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_num_threads(void);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{integer function omp_get_num_threads()}
@end multitable
@item @emph{See also}:
@ref{omp_get_max_threads}, @ref{omp_set_num_threads}, @ref{OMP_NUM_THREADS}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.2.
@end table
@node omp_get_proc_bind
@section @code{omp_get_proc_bind} -- Whether theads may be moved between CPUs
@table @asis
@item @emph{Description}:
This functions returns the currently active thread affinity policy, which is
set via @env{OMP_PROC_BIND}. Possible values are @code{omp_proc_bind_false},
@code{omp_proc_bind_true}, @code{omp_proc_bind_master},
@code{omp_proc_bind_close} and @code{omp_proc_bind_spread}.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{omp_proc_bind_t omp_get_proc_bind(void);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{integer(kind=omp_proc_bind_kind) function omp_get_proc_bind()}
@end multitable
@item @emph{See also}:
@ref{OMP_PROC_BIND}, @ref{OMP_PLACES}, @ref{GOMP_CPU_AFFINITY},
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.22.
@end table
@node omp_get_schedule
@section @code{omp_get_schedule} -- Obtain the runtime scheduling method
@table @asis
@item @emph{Description}:
Obtain the runtime scheduling method. The @var{kind} argument will be
set to the value @code{omp_sched_static}, @code{omp_sched_dynamic},
@code{omp_sched_guided} or @code{omp_sched_auto}. The second argument,
@var{modifier}, is set to the chunk size.
@item @emph{C/C++}
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_get_schedule(omp_sched_t *kind, int *modifier);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_get_schedule(kind, modifier)}
@item @tab @code{integer(kind=omp_sched_kind) kind}
@item @tab @code{integer modifier}
@end multitable
@item @emph{See also}:
@ref{omp_set_schedule}, @ref{OMP_SCHEDULE}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.13.
@end table
@node omp_get_team_num
@section @code{omp_get_team_num} -- Get team number
@table @asis
@item @emph{Description}:
Returns the team number of the calling thread.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_team_num(void);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{integer function omp_get_team_num()}
@end multitable
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.27.
@end table
@node omp_get_team_size
@section @code{omp_get_team_size} -- Number of threads in a team
@table @asis
@item @emph{Description}:
This function returns the number of threads in a thread team to which
either the current thread or its ancestor belongs. For values of @var{level}
outside zero to @code{omp_get_level}, -1 is returned; if @var{level} is zero,
1 is returned, and for @code{omp_get_level}, the result is identical
to @code{omp_get_num_threads}.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_team_size(int level);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{integer function omp_get_team_size(level)}
@item @tab @code{integer level}
@end multitable
@item @emph{See also}:
@ref{omp_get_num_threads}, @ref{omp_get_level}, @ref{omp_get_ancestor_thread_num}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.19.
@end table
@node omp_get_thread_limit
@section @code{omp_get_thread_limit} -- Maximum number of threads
@table @asis
@item @emph{Description}:
Return the maximum number of threads of the program.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_thread_limit(void);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{integer function omp_get_thread_limit()}
@end multitable
@item @emph{See also}:
@ref{omp_get_max_threads}, @ref{OMP_THREAD_LIMIT}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.14.
@end table
@node omp_get_thread_num
@section @code{omp_get_thread_num} -- Current thread ID
@table @asis
@item @emph{Description}:
Returns a unique thread identification number within the current team.
In a sequential parts of the program, @code{omp_get_thread_num}
always returns 0. In parallel regions the return value varies
from 0 to @code{omp_get_num_threads}-1 inclusive. The return
value of the master thread of a team is always 0.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_get_thread_num(void);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{integer function omp_get_thread_num()}
@end multitable
@item @emph{See also}:
@ref{omp_get_num_threads}, @ref{omp_get_ancestor_thread_num}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.4.
@end table
@node omp_in_parallel
@section @code{omp_in_parallel} -- Whether a parallel region is active
@table @asis
@item @emph{Description}:
This function returns @code{true} if currently running in parallel,
@code{false} otherwise. Here, @code{true} and @code{false} represent
their language-specific counterparts.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_in_parallel(void);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{logical function omp_in_parallel()}
@end multitable
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.6.
backport: re PR fortran/46752 (OpenMP - Seg fault for unallocated allocatable array in firstprivate clause) Merge from gomp-3_1-branch branch: 2011-08-02 Jakub Jelinek <jakub@redhat.com> gcc/ * c-parser.c (enum c_parser_prec): New enum, moved from within c_parser_binary_expression. (c_parser_binary_expression): Add PREC argument. Stop parsing if operator has lower or equal precedence than PREC. (c_parser_conditional_expression, c_parser_omp_for_loop): Adjust callers. (c_parser_omp_atomic): Handle parsing OpenMP 3.1 atomics. Adjust c_finish_omp_atomic caller. (c_parser_omp_taskyield): New function. (c_parser_pragma): Handle PRAGMA_OMP_TASKYIELD. (c_parser_omp_clause_name): Handle final and mergeable clauses. (c_parser_omp_clause_final, c_parser_omp_clause_mergeable): New functions. (c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. (OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses. (c_parser_omp_clause_reduction): Handle min and max. * c-typeck.c (c_finish_omp_clauses): Don't complain about const qualified predetermined vars in firstprivate clause. andle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. Handle MIN_EXPR and MAX_EXPR. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (dump_generic_node): Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW. * tree.c (omp_clause_num_ops): Add OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (omp_clause_code_name): Likewise. (walk_tree_1): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * tree.h (enum omp_clause_code): Add OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (OMP_CLAUSE_FINAL_EXPR): Define. * omp-low.c (scan_sharing_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (expand_task_call): Likewise. (expand_omp_atomic_load, expand_omp_atomic_store): New functions. (expand_omp_atomic_fetch_op): Handle cases where old or new value is needed afterwards. (expand_omp_atomic): Call expand_omp_atomic_load resp. expand_omp_atomic_store. * gimplify.c (gimplify_omp_atomic, gimplify_expr): Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * tree-nested.c (convert_nonlocal_omp_clauses, convert_local_omp_clauses): Likewise. * tree.def (OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD, OMP_ATOMIC_CAPTURE_NEW): New. * gimple.h (GF_OMP_ATOMIC_NEED_VALUE): New. (gimple_omp_atomic_need_value_p, gimple_omp_atomic_set_need_value): New inlines. * omp-builtins.def (BUILT_IN_GOMP_TASKYIELD): New builtin. * doc/generic.texi: Mention OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. gcc/c-family/ * c-common.h (c_finish_omp_atomic): Adjust prototype. (c_finish_omp_taskyield): New prototype. * c-omp.c (c_finish_omp_atomic): Add OPCODE, V, LHS1 and RHS1 arguments. Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW in addition to OMP_ATOMIC. If LHS1 or RHS1 have side-effects, evaluate those too in the right spot, if it is a decl and LHS is also a decl, error out if they aren't the same. (c_finish_omp_taskyield): New function. * c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP to 201107. * c-pragma.c (omp_pragmas): Add taskyield. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_TASKYIELD. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. gcc/cp/ * cp-tree.h (finish_omp_atomic): Adjust prototype. (cxx_omp_const_qual_no_mutable): New prototype. (finish_omp_taskyield): New prototype. * parser.c (cp_parser_omp_atomic): (cp_parser_omp_atomic): Handle parsing OpenMP 3.1 atomics. Adjust finish_omp_atomic caller. (cp_parser_omp_clause_name): Handle final and mergeable clauses. (cp_parser_omp_clause_final, cp_parser_omp_clause_mergeable): New functions. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. (OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses. (cp_parser_omp_taskyield): New function. (cp_parser_pragma): Handle PRAGMA_OMP_TASKYIELD. (cp_parser_omp_clause_reduction): Handle min and max. * pt.c (tsubst_expr) <case OMP_ATOMIC>: Handle OpenMP 3.1 atomics. (tsubst_omp_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * semantics.c (finish_omp_atomic): Add OPCODE, V, LHS1 and RHS1 arguments. Handle OpenMP 3.1 atomics. Adjust c_finish_omp_atomic caller. (finish_omp_clauses): Don't complain about const qualified predetermined vars and static data members in firstprivate clause. Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. Handle MIN_EXPR and MAX_EXPR. (finish_omp_taskyield): New function. * cp-gimplify.c (cxx_omp_const_qual_no_mutable): New function. (cxx_omp_predetermined_sharing): Use it. gcc/fortran/ PR fortran/46752 * cpp.c (cpp_define_builtins): Change _OPENMP to 201107. * openmp.c (gfc_free_omp_clauses): Free also final_expr. (OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE): Define. (gfc_match_omp_clauses): Handle parsing final and mergeable clauses. (OMP_TASK_CLAUSES): Allow final and mergeable clauses. (gfc_match_omp_taskyield): New function. (resolve_omp_clauses): Resolve final clause. Allow POINTERs and Cray pointers in clauses other than REDUCTION. (gfc_match_omp_atomic): Match optional read/write/update/capture keywords after !$omp atomic. (resolve_omp_atomic): Handle all OpenMP 3.1 atomic forms. * dump-parse-tree.c (show_omp_node): Handle EXEC_OMP_TASKYIELD, print final and mergeable clauses. (show_code_node): Handle EXEC_OMP_TASKYIELD. * trans-openmp.c (gfc_trans_omp_clauses): Handle final and mergeable clauses. (gfc_trans_omp_taskyield): New function. (gfc_trans_omp_directive): Handle EXEC_OMP_TASKYIELD. (gfc_trans_omp_atomic): Handle all OpenMP 3.1 atomic forms. (gfc_omp_clause_copy_ctor): Handle non-allocated allocatable. (gfc_omp_predetermined_sharing): Adjust comment. * gfortran.h (gfc_statement): Add ST_OMP_TASKYIELD and ST_OMP_END_ATOMIC. (gfc_omp_clauses): Add final_expr and mergeable fields. (gfc_exec_op): Add EXEC_OMP_TASKYIELD. (gfc_omp_atomic_op): New enum typedef. (struct gfc_code): Add ext.omp_atomic. * trans.c (trans_code): Handle EXEC_OMP_TASKYIELD. * frontend-passes.c (gfc_code_walker): Also walk final_expr. * resolve.c (gfc_resolve_blocks, resolve_code): Handle EXEC_OMP_TASKYIELD. * st.c (gfc_free_statement): Likewise. * match.h (gfc_match_omp_taskyield): New prototype. * parse.c (decode_omp_directive): Handle taskyield directive. Handle !$omp end atomic. (case_executable): Add ST_OMP_TASKYIELD case. (gfc_ascii_statement): Handle ST_OMP_TASKYIELD. (parse_omp_atomic): Return gfc_statement instead of void. For !$omp atomic capture parse two assignments instead of just one and require !$omp end atomic afterwards, for other !$omp atomic forms just allow !$omp end atomic at the end. (parse_omp_structured_block, parse_executable): Adjust parse_omp_atomic callers. 2011-08-02 Tobias Burnus <burnus@net-b.de> * intrinsic.c (OMP_LIB): Updated openmp_version's value to 201107. * gfortran.texi (OpenMP): Update ref to OpenMP 3.1. * intrinsic.texi (OpenMP Modules): Update ref to OpenMP 3.1; remove deleted omp_integer_kind and omp_logical_kind constants. gcc/testsuite/ PR fortran/46752 * gcc.dg/gomp/atomic-5.c: Adjust expected diagnostics. * gcc.dg/gomp/atomic-15.c: New test. * g++.dg/gomp/atomic-5.C: Adjust expected diagnostics. * g++.dg/gomp/atomic-15.C: New test. * g++.dg/gomp/private-1.C: New test. * g++.dg/gomp/sharing-2.C: New test. * gfortran.dg/gomp/crayptr1.f90: Don't expect error about Cray pointer in FIRSTPRIVATE/LASTPRIVATE. * gfortran.dg/gomp/omp_atomic2.f90: New test. libgomp/ PR fortran/42041 PR fortran/46752 * omp.h.in (omp_in_final): New prototype. * omp_lib.f90.in (omp_in_final): New interface. (omp_integer_kind, omp_logical_kind): Remove and replace all its uses in the module with 4. (openmp_version): Change to 201107. * omp_lib.h.in (omp_sched_static, omp_sched_dynamic, omp_sched_guided, omp_sched_auto): Use omp_sched_kind kind for the parameters. (omp_in_final): New external. (openmp_version): Change to 201107. * task.c (omp_in_final): New function. (gomp_init_task): Initialize final_task. (GOMP_task): Remove unused attribute from flags. Handle final tasks. (GOMP_taskyield): New function. (omp_in_final): Return true if if (false) or final (true) task or descendant of final (true). * fortran.c (omp_in_final_): New function. * libgomp.map (OMP_3.1): Export omp_in_final and omp_in_final_. (GOMP_3.0): Export GOMP_taskyield. * env.c (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New variables. (parse_unsigned_long_list): New function. (initialize_env): Use it for OMP_NUM_THREADS. Call parse_boolean with "OMP_PROC_BIND". If OMP_PROC_BIND=true, call gomp_init_affinity even if parse_affinity returned false. * config/linux/affinity.c (gomp_init_affinity): Handle gomp_cpu_affinity_len == 0. * libgomp_g.h (GOMP_taskyield): New prototype. * libgomp.h (struct gomp_task): Add final_task field. (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New externs. * team.c (gomp_team_start): Override new task's nthreads_var icv if list form OMP_NUM_THREADS has been used and it has value for the new nesting level. * 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/reduction-6.c: New test. * testsuite/libgomp.c/task-5.c: New test. * testsuite/libgomp.c++/atomic-2.C: New test. * testsuite/libgomp.c++/atomic-3.C: New test. * testsuite/libgomp.c++/atomic-4.C: New test. * testsuite/libgomp.c++/atomic-5.C: New test. * testsuite/libgomp.c++/atomic-6.C: New test. * testsuite/libgomp.c++/atomic-7.C: New test. * testsuite/libgomp.c++/atomic-8.C: New test. * testsuite/libgomp.c++/atomic-9.C: New test. * testsuite/libgomp.c++/task-8.C: New test. * testsuite/libgomp.c++/reduction-4.C: New test. * testsuite/libgomp.fortran/allocatable7.f90: New test. * testsuite/libgomp.fortran/allocatable8.f90: New test. * testsuite/libgomp.fortran/crayptr3.f90: New test. * testsuite/libgomp.fortran/omp_atomic3.f90: New test. * testsuite/libgomp.fortran/omp_atomic4.f90: New test. * testsuite/libgomp.fortran/pointer1.f90: New test. * testsuite/libgomp.fortran/pointer2.f90: New test. * testsuite/libgomp.fortran/task4.f90: New test. 2011-08-02 Tobias Burnus <burnus@net-b.de> * libgomp.texi: Update OpenMP spec references to 3.1. (omp_in_final,OMP_PROC_BIND): New sections. (OMP_NUM_THREADS): Document that the value can be now a list. (GOMP_STACKSIZE,GOMP_CPU_AFFINITY): Update @ref. From-SVN: r177194
2011-08-02 18:13:29 +02:00
@end table
@node omp_in_final
@section @code{omp_in_final} -- Whether in final or included task region
@table @asis
@item @emph{Description}:
This function returns @code{true} if currently running in a final
or included task region, @code{false} otherwise. Here, @code{true}
backport: re PR fortran/46752 (OpenMP - Seg fault for unallocated allocatable array in firstprivate clause) Merge from gomp-3_1-branch branch: 2011-08-02 Jakub Jelinek <jakub@redhat.com> gcc/ * c-parser.c (enum c_parser_prec): New enum, moved from within c_parser_binary_expression. (c_parser_binary_expression): Add PREC argument. Stop parsing if operator has lower or equal precedence than PREC. (c_parser_conditional_expression, c_parser_omp_for_loop): Adjust callers. (c_parser_omp_atomic): Handle parsing OpenMP 3.1 atomics. Adjust c_finish_omp_atomic caller. (c_parser_omp_taskyield): New function. (c_parser_pragma): Handle PRAGMA_OMP_TASKYIELD. (c_parser_omp_clause_name): Handle final and mergeable clauses. (c_parser_omp_clause_final, c_parser_omp_clause_mergeable): New functions. (c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. (OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses. (c_parser_omp_clause_reduction): Handle min and max. * c-typeck.c (c_finish_omp_clauses): Don't complain about const qualified predetermined vars in firstprivate clause. andle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. Handle MIN_EXPR and MAX_EXPR. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (dump_generic_node): Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW. * tree.c (omp_clause_num_ops): Add OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (omp_clause_code_name): Likewise. (walk_tree_1): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * tree.h (enum omp_clause_code): Add OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (OMP_CLAUSE_FINAL_EXPR): Define. * omp-low.c (scan_sharing_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (expand_task_call): Likewise. (expand_omp_atomic_load, expand_omp_atomic_store): New functions. (expand_omp_atomic_fetch_op): Handle cases where old or new value is needed afterwards. (expand_omp_atomic): Call expand_omp_atomic_load resp. expand_omp_atomic_store. * gimplify.c (gimplify_omp_atomic, gimplify_expr): Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * tree-nested.c (convert_nonlocal_omp_clauses, convert_local_omp_clauses): Likewise. * tree.def (OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD, OMP_ATOMIC_CAPTURE_NEW): New. * gimple.h (GF_OMP_ATOMIC_NEED_VALUE): New. (gimple_omp_atomic_need_value_p, gimple_omp_atomic_set_need_value): New inlines. * omp-builtins.def (BUILT_IN_GOMP_TASKYIELD): New builtin. * doc/generic.texi: Mention OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. gcc/c-family/ * c-common.h (c_finish_omp_atomic): Adjust prototype. (c_finish_omp_taskyield): New prototype. * c-omp.c (c_finish_omp_atomic): Add OPCODE, V, LHS1 and RHS1 arguments. Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW in addition to OMP_ATOMIC. If LHS1 or RHS1 have side-effects, evaluate those too in the right spot, if it is a decl and LHS is also a decl, error out if they aren't the same. (c_finish_omp_taskyield): New function. * c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP to 201107. * c-pragma.c (omp_pragmas): Add taskyield. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_TASKYIELD. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. gcc/cp/ * cp-tree.h (finish_omp_atomic): Adjust prototype. (cxx_omp_const_qual_no_mutable): New prototype. (finish_omp_taskyield): New prototype. * parser.c (cp_parser_omp_atomic): (cp_parser_omp_atomic): Handle parsing OpenMP 3.1 atomics. Adjust finish_omp_atomic caller. (cp_parser_omp_clause_name): Handle final and mergeable clauses. (cp_parser_omp_clause_final, cp_parser_omp_clause_mergeable): New functions. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. (OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses. (cp_parser_omp_taskyield): New function. (cp_parser_pragma): Handle PRAGMA_OMP_TASKYIELD. (cp_parser_omp_clause_reduction): Handle min and max. * pt.c (tsubst_expr) <case OMP_ATOMIC>: Handle OpenMP 3.1 atomics. (tsubst_omp_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * semantics.c (finish_omp_atomic): Add OPCODE, V, LHS1 and RHS1 arguments. Handle OpenMP 3.1 atomics. Adjust c_finish_omp_atomic caller. (finish_omp_clauses): Don't complain about const qualified predetermined vars and static data members in firstprivate clause. Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. Handle MIN_EXPR and MAX_EXPR. (finish_omp_taskyield): New function. * cp-gimplify.c (cxx_omp_const_qual_no_mutable): New function. (cxx_omp_predetermined_sharing): Use it. gcc/fortran/ PR fortran/46752 * cpp.c (cpp_define_builtins): Change _OPENMP to 201107. * openmp.c (gfc_free_omp_clauses): Free also final_expr. (OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE): Define. (gfc_match_omp_clauses): Handle parsing final and mergeable clauses. (OMP_TASK_CLAUSES): Allow final and mergeable clauses. (gfc_match_omp_taskyield): New function. (resolve_omp_clauses): Resolve final clause. Allow POINTERs and Cray pointers in clauses other than REDUCTION. (gfc_match_omp_atomic): Match optional read/write/update/capture keywords after !$omp atomic. (resolve_omp_atomic): Handle all OpenMP 3.1 atomic forms. * dump-parse-tree.c (show_omp_node): Handle EXEC_OMP_TASKYIELD, print final and mergeable clauses. (show_code_node): Handle EXEC_OMP_TASKYIELD. * trans-openmp.c (gfc_trans_omp_clauses): Handle final and mergeable clauses. (gfc_trans_omp_taskyield): New function. (gfc_trans_omp_directive): Handle EXEC_OMP_TASKYIELD. (gfc_trans_omp_atomic): Handle all OpenMP 3.1 atomic forms. (gfc_omp_clause_copy_ctor): Handle non-allocated allocatable. (gfc_omp_predetermined_sharing): Adjust comment. * gfortran.h (gfc_statement): Add ST_OMP_TASKYIELD and ST_OMP_END_ATOMIC. (gfc_omp_clauses): Add final_expr and mergeable fields. (gfc_exec_op): Add EXEC_OMP_TASKYIELD. (gfc_omp_atomic_op): New enum typedef. (struct gfc_code): Add ext.omp_atomic. * trans.c (trans_code): Handle EXEC_OMP_TASKYIELD. * frontend-passes.c (gfc_code_walker): Also walk final_expr. * resolve.c (gfc_resolve_blocks, resolve_code): Handle EXEC_OMP_TASKYIELD. * st.c (gfc_free_statement): Likewise. * match.h (gfc_match_omp_taskyield): New prototype. * parse.c (decode_omp_directive): Handle taskyield directive. Handle !$omp end atomic. (case_executable): Add ST_OMP_TASKYIELD case. (gfc_ascii_statement): Handle ST_OMP_TASKYIELD. (parse_omp_atomic): Return gfc_statement instead of void. For !$omp atomic capture parse two assignments instead of just one and require !$omp end atomic afterwards, for other !$omp atomic forms just allow !$omp end atomic at the end. (parse_omp_structured_block, parse_executable): Adjust parse_omp_atomic callers. 2011-08-02 Tobias Burnus <burnus@net-b.de> * intrinsic.c (OMP_LIB): Updated openmp_version's value to 201107. * gfortran.texi (OpenMP): Update ref to OpenMP 3.1. * intrinsic.texi (OpenMP Modules): Update ref to OpenMP 3.1; remove deleted omp_integer_kind and omp_logical_kind constants. gcc/testsuite/ PR fortran/46752 * gcc.dg/gomp/atomic-5.c: Adjust expected diagnostics. * gcc.dg/gomp/atomic-15.c: New test. * g++.dg/gomp/atomic-5.C: Adjust expected diagnostics. * g++.dg/gomp/atomic-15.C: New test. * g++.dg/gomp/private-1.C: New test. * g++.dg/gomp/sharing-2.C: New test. * gfortran.dg/gomp/crayptr1.f90: Don't expect error about Cray pointer in FIRSTPRIVATE/LASTPRIVATE. * gfortran.dg/gomp/omp_atomic2.f90: New test. libgomp/ PR fortran/42041 PR fortran/46752 * omp.h.in (omp_in_final): New prototype. * omp_lib.f90.in (omp_in_final): New interface. (omp_integer_kind, omp_logical_kind): Remove and replace all its uses in the module with 4. (openmp_version): Change to 201107. * omp_lib.h.in (omp_sched_static, omp_sched_dynamic, omp_sched_guided, omp_sched_auto): Use omp_sched_kind kind for the parameters. (omp_in_final): New external. (openmp_version): Change to 201107. * task.c (omp_in_final): New function. (gomp_init_task): Initialize final_task. (GOMP_task): Remove unused attribute from flags. Handle final tasks. (GOMP_taskyield): New function. (omp_in_final): Return true if if (false) or final (true) task or descendant of final (true). * fortran.c (omp_in_final_): New function. * libgomp.map (OMP_3.1): Export omp_in_final and omp_in_final_. (GOMP_3.0): Export GOMP_taskyield. * env.c (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New variables. (parse_unsigned_long_list): New function. (initialize_env): Use it for OMP_NUM_THREADS. Call parse_boolean with "OMP_PROC_BIND". If OMP_PROC_BIND=true, call gomp_init_affinity even if parse_affinity returned false. * config/linux/affinity.c (gomp_init_affinity): Handle gomp_cpu_affinity_len == 0. * libgomp_g.h (GOMP_taskyield): New prototype. * libgomp.h (struct gomp_task): Add final_task field. (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New externs. * team.c (gomp_team_start): Override new task's nthreads_var icv if list form OMP_NUM_THREADS has been used and it has value for the new nesting level. * 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/reduction-6.c: New test. * testsuite/libgomp.c/task-5.c: New test. * testsuite/libgomp.c++/atomic-2.C: New test. * testsuite/libgomp.c++/atomic-3.C: New test. * testsuite/libgomp.c++/atomic-4.C: New test. * testsuite/libgomp.c++/atomic-5.C: New test. * testsuite/libgomp.c++/atomic-6.C: New test. * testsuite/libgomp.c++/atomic-7.C: New test. * testsuite/libgomp.c++/atomic-8.C: New test. * testsuite/libgomp.c++/atomic-9.C: New test. * testsuite/libgomp.c++/task-8.C: New test. * testsuite/libgomp.c++/reduction-4.C: New test. * testsuite/libgomp.fortran/allocatable7.f90: New test. * testsuite/libgomp.fortran/allocatable8.f90: New test. * testsuite/libgomp.fortran/crayptr3.f90: New test. * testsuite/libgomp.fortran/omp_atomic3.f90: New test. * testsuite/libgomp.fortran/omp_atomic4.f90: New test. * testsuite/libgomp.fortran/pointer1.f90: New test. * testsuite/libgomp.fortran/pointer2.f90: New test. * testsuite/libgomp.fortran/task4.f90: New test. 2011-08-02 Tobias Burnus <burnus@net-b.de> * libgomp.texi: Update OpenMP spec references to 3.1. (omp_in_final,OMP_PROC_BIND): New sections. (OMP_NUM_THREADS): Document that the value can be now a list. (GOMP_STACKSIZE,GOMP_CPU_AFFINITY): Update @ref. From-SVN: r177194
2011-08-02 18:13:29 +02:00
and @code{false} represent their language-specific counterparts.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_in_final(void);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{logical function omp_in_final()}
@end multitable
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.21.
@end table
@node omp_is_initial_device
@section @code{omp_is_initial_device} -- Whether executing on the host device
@table @asis
@item @emph{Description}:
This function returns @code{true} if currently running on the host device,
@code{false} otherwise. Here, @code{true} and @code{false} represent
their language-specific counterparts.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_is_initial_device(void);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{logical function omp_is_initial_device()}
@end multitable
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.28.
@end table
@node omp_set_default_device
@section @code{omp_set_default_device} -- Set the default device for target regions
@table @asis
@item @emph{Description}:
Set the default device for target regions without device clause. The argument
shall be a nonnegative device number.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_set_default_device(int device_num);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_set_default_device(device_num)}
@item @tab @code{integer device_num}
@end multitable
@item @emph{See also}:
@ref{OMP_DEFAULT_DEVICE}, @ref{omp_get_default_device}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.23.
@end table
@node omp_set_dynamic
@section @code{omp_set_dynamic} -- Enable/disable dynamic teams
@table @asis
@item @emph{Description}:
Enable or disable the dynamic adjustment of the number of threads
within a team. The function takes the language-specific equivalent
of @code{true} and @code{false}, where @code{true} enables dynamic
adjustment of team sizes and @code{false} disables it.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_set_dynamic(int dynamic_threads);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_set_dynamic(dynamic_threads)}
@item @tab @code{logical, intent(in) :: dynamic_threads}
@end multitable
@item @emph{See also}:
@ref{OMP_DYNAMIC}, @ref{omp_get_dynamic}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.7.
@end table
@node omp_set_max_active_levels
@section @code{omp_set_max_active_levels} -- Limits the number of active parallel regions
@table @asis
@item @emph{Description}:
This function limits the maximum allowed number of nested, active
parallel regions.
@item @emph{C/C++}
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_set_max_active_levels(int max_levels);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_set_max_active_levels(max_levels)}
@item @tab @code{integer max_levels}
@end multitable
@item @emph{See also}:
@ref{omp_get_max_active_levels}, @ref{omp_get_active_level}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.15.
@end table
@node omp_set_nested
@section @code{omp_set_nested} -- Enable/disable nested parallel regions
@table @asis
@item @emph{Description}:
Enable or disable nested parallel regions, i.e., whether team members
are allowed to create new teams. The function takes the language-specific
equivalent of @code{true} and @code{false}, where @code{true} enables
dynamic adjustment of team sizes and @code{false} disables it.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_set_nested(int nested);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_set_nested(nested)}
@item @tab @code{logical, intent(in) :: nested}
@end multitable
@item @emph{See also}:
@ref{OMP_NESTED}, @ref{omp_get_nested}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.10.
@end table
@node omp_set_num_threads
@section @code{omp_set_num_threads} -- Set upper team size limit
@table @asis
@item @emph{Description}:
Specifies the number of threads used by default in subsequent parallel
sections, if those do not specify a @code{num_threads} clause. The
argument of @code{omp_set_num_threads} shall be a positive integer.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_set_num_threads(int num_threads);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_set_num_threads(num_threads)}
@item @tab @code{integer, intent(in) :: num_threads}
@end multitable
@item @emph{See also}:
@ref{OMP_NUM_THREADS}, @ref{omp_get_num_threads}, @ref{omp_get_max_threads}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.1.
@end table
@node omp_set_schedule
@section @code{omp_set_schedule} -- Set the runtime scheduling method
@table @asis
@item @emph{Description}:
Sets the runtime scheduling method. The @var{kind} argument can have the
value @code{omp_sched_static}, @code{omp_sched_dynamic},
@code{omp_sched_guided} or @code{omp_sched_auto}. Except for
@code{omp_sched_auto}, the chunk size is set to the value of
@var{modifier} if positive, or to the default value if zero or negative.
For @code{omp_sched_auto} the @var{modifier} argument is ignored.
@item @emph{C/C++}
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_set_schedule(omp_sched_t kind, int modifier);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_set_schedule(kind, modifier)}
@item @tab @code{integer(kind=omp_sched_kind) kind}
@item @tab @code{integer modifier}
@end multitable
@item @emph{See also}:
@ref{omp_get_schedule}
@ref{OMP_SCHEDULE}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.2.12.
@end table
@node omp_init_lock
@section @code{omp_init_lock} -- Initialize simple lock
@table @asis
@item @emph{Description}:
Initialize a simple lock. After initialization, the lock is in
an unlocked state.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_init_lock(omp_lock_t *lock);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_init_lock(svar)}
@item @tab @code{integer(omp_lock_kind), intent(out) :: svar}
@end multitable
@item @emph{See also}:
@ref{omp_destroy_lock}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.3.1.
@end table
@node omp_set_lock
@section @code{omp_set_lock} -- Wait for and set simple lock
@table @asis
@item @emph{Description}:
Before setting a simple lock, the lock variable must be initialized by
@code{omp_init_lock}. The calling thread is blocked until the lock
is available. If the lock is already held by the current thread,
a deadlock occurs.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_set_lock(omp_lock_t *lock);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_set_lock(svar)}
@item @tab @code{integer(omp_lock_kind), intent(inout) :: svar}
@end multitable
@item @emph{See also}:
@ref{omp_init_lock}, @ref{omp_test_lock}, @ref{omp_unset_lock}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.3.3.
@end table
@node omp_test_lock
@section @code{omp_test_lock} -- Test and set simple lock if available
@table @asis
@item @emph{Description}:
Before setting a simple lock, the lock variable must be initialized by
@code{omp_init_lock}. Contrary to @code{omp_set_lock}, @code{omp_test_lock}
does not block if the lock is not available. This function returns
@code{true} upon success, @code{false} otherwise. Here, @code{true} and
@code{false} represent their language-specific counterparts.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_test_lock(omp_lock_t *lock);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{logical function omp_test_lock(svar)}
@item @tab @code{integer(omp_lock_kind), intent(inout) :: svar}
@end multitable
@item @emph{See also}:
@ref{omp_init_lock}, @ref{omp_set_lock}, @ref{omp_set_lock}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.3.5.
@end table
@node omp_unset_lock
@section @code{omp_unset_lock} -- Unset simple lock
@table @asis
@item @emph{Description}:
A simple lock about to be unset must have been locked by @code{omp_set_lock}
or @code{omp_test_lock} before. In addition, the lock must be held by the
thread calling @code{omp_unset_lock}. Then, the lock becomes unlocked. If one
or more threads attempted to set the lock before, one of them is chosen to,
backport: re PR fortran/46752 (OpenMP - Seg fault for unallocated allocatable array in firstprivate clause) Merge from gomp-3_1-branch branch: 2011-08-02 Jakub Jelinek <jakub@redhat.com> gcc/ * c-parser.c (enum c_parser_prec): New enum, moved from within c_parser_binary_expression. (c_parser_binary_expression): Add PREC argument. Stop parsing if operator has lower or equal precedence than PREC. (c_parser_conditional_expression, c_parser_omp_for_loop): Adjust callers. (c_parser_omp_atomic): Handle parsing OpenMP 3.1 atomics. Adjust c_finish_omp_atomic caller. (c_parser_omp_taskyield): New function. (c_parser_pragma): Handle PRAGMA_OMP_TASKYIELD. (c_parser_omp_clause_name): Handle final and mergeable clauses. (c_parser_omp_clause_final, c_parser_omp_clause_mergeable): New functions. (c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. (OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses. (c_parser_omp_clause_reduction): Handle min and max. * c-typeck.c (c_finish_omp_clauses): Don't complain about const qualified predetermined vars in firstprivate clause. andle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. Handle MIN_EXPR and MAX_EXPR. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (dump_generic_node): Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW. * tree.c (omp_clause_num_ops): Add OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (omp_clause_code_name): Likewise. (walk_tree_1): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * tree.h (enum omp_clause_code): Add OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (OMP_CLAUSE_FINAL_EXPR): Define. * omp-low.c (scan_sharing_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (expand_task_call): Likewise. (expand_omp_atomic_load, expand_omp_atomic_store): New functions. (expand_omp_atomic_fetch_op): Handle cases where old or new value is needed afterwards. (expand_omp_atomic): Call expand_omp_atomic_load resp. expand_omp_atomic_store. * gimplify.c (gimplify_omp_atomic, gimplify_expr): Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * tree-nested.c (convert_nonlocal_omp_clauses, convert_local_omp_clauses): Likewise. * tree.def (OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD, OMP_ATOMIC_CAPTURE_NEW): New. * gimple.h (GF_OMP_ATOMIC_NEED_VALUE): New. (gimple_omp_atomic_need_value_p, gimple_omp_atomic_set_need_value): New inlines. * omp-builtins.def (BUILT_IN_GOMP_TASKYIELD): New builtin. * doc/generic.texi: Mention OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. gcc/c-family/ * c-common.h (c_finish_omp_atomic): Adjust prototype. (c_finish_omp_taskyield): New prototype. * c-omp.c (c_finish_omp_atomic): Add OPCODE, V, LHS1 and RHS1 arguments. Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW in addition to OMP_ATOMIC. If LHS1 or RHS1 have side-effects, evaluate those too in the right spot, if it is a decl and LHS is also a decl, error out if they aren't the same. (c_finish_omp_taskyield): New function. * c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP to 201107. * c-pragma.c (omp_pragmas): Add taskyield. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_TASKYIELD. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. gcc/cp/ * cp-tree.h (finish_omp_atomic): Adjust prototype. (cxx_omp_const_qual_no_mutable): New prototype. (finish_omp_taskyield): New prototype. * parser.c (cp_parser_omp_atomic): (cp_parser_omp_atomic): Handle parsing OpenMP 3.1 atomics. Adjust finish_omp_atomic caller. (cp_parser_omp_clause_name): Handle final and mergeable clauses. (cp_parser_omp_clause_final, cp_parser_omp_clause_mergeable): New functions. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. (OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses. (cp_parser_omp_taskyield): New function. (cp_parser_pragma): Handle PRAGMA_OMP_TASKYIELD. (cp_parser_omp_clause_reduction): Handle min and max. * pt.c (tsubst_expr) <case OMP_ATOMIC>: Handle OpenMP 3.1 atomics. (tsubst_omp_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * semantics.c (finish_omp_atomic): Add OPCODE, V, LHS1 and RHS1 arguments. Handle OpenMP 3.1 atomics. Adjust c_finish_omp_atomic caller. (finish_omp_clauses): Don't complain about const qualified predetermined vars and static data members in firstprivate clause. Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. Handle MIN_EXPR and MAX_EXPR. (finish_omp_taskyield): New function. * cp-gimplify.c (cxx_omp_const_qual_no_mutable): New function. (cxx_omp_predetermined_sharing): Use it. gcc/fortran/ PR fortran/46752 * cpp.c (cpp_define_builtins): Change _OPENMP to 201107. * openmp.c (gfc_free_omp_clauses): Free also final_expr. (OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE): Define. (gfc_match_omp_clauses): Handle parsing final and mergeable clauses. (OMP_TASK_CLAUSES): Allow final and mergeable clauses. (gfc_match_omp_taskyield): New function. (resolve_omp_clauses): Resolve final clause. Allow POINTERs and Cray pointers in clauses other than REDUCTION. (gfc_match_omp_atomic): Match optional read/write/update/capture keywords after !$omp atomic. (resolve_omp_atomic): Handle all OpenMP 3.1 atomic forms. * dump-parse-tree.c (show_omp_node): Handle EXEC_OMP_TASKYIELD, print final and mergeable clauses. (show_code_node): Handle EXEC_OMP_TASKYIELD. * trans-openmp.c (gfc_trans_omp_clauses): Handle final and mergeable clauses. (gfc_trans_omp_taskyield): New function. (gfc_trans_omp_directive): Handle EXEC_OMP_TASKYIELD. (gfc_trans_omp_atomic): Handle all OpenMP 3.1 atomic forms. (gfc_omp_clause_copy_ctor): Handle non-allocated allocatable. (gfc_omp_predetermined_sharing): Adjust comment. * gfortran.h (gfc_statement): Add ST_OMP_TASKYIELD and ST_OMP_END_ATOMIC. (gfc_omp_clauses): Add final_expr and mergeable fields. (gfc_exec_op): Add EXEC_OMP_TASKYIELD. (gfc_omp_atomic_op): New enum typedef. (struct gfc_code): Add ext.omp_atomic. * trans.c (trans_code): Handle EXEC_OMP_TASKYIELD. * frontend-passes.c (gfc_code_walker): Also walk final_expr. * resolve.c (gfc_resolve_blocks, resolve_code): Handle EXEC_OMP_TASKYIELD. * st.c (gfc_free_statement): Likewise. * match.h (gfc_match_omp_taskyield): New prototype. * parse.c (decode_omp_directive): Handle taskyield directive. Handle !$omp end atomic. (case_executable): Add ST_OMP_TASKYIELD case. (gfc_ascii_statement): Handle ST_OMP_TASKYIELD. (parse_omp_atomic): Return gfc_statement instead of void. For !$omp atomic capture parse two assignments instead of just one and require !$omp end atomic afterwards, for other !$omp atomic forms just allow !$omp end atomic at the end. (parse_omp_structured_block, parse_executable): Adjust parse_omp_atomic callers. 2011-08-02 Tobias Burnus <burnus@net-b.de> * intrinsic.c (OMP_LIB): Updated openmp_version's value to 201107. * gfortran.texi (OpenMP): Update ref to OpenMP 3.1. * intrinsic.texi (OpenMP Modules): Update ref to OpenMP 3.1; remove deleted omp_integer_kind and omp_logical_kind constants. gcc/testsuite/ PR fortran/46752 * gcc.dg/gomp/atomic-5.c: Adjust expected diagnostics. * gcc.dg/gomp/atomic-15.c: New test. * g++.dg/gomp/atomic-5.C: Adjust expected diagnostics. * g++.dg/gomp/atomic-15.C: New test. * g++.dg/gomp/private-1.C: New test. * g++.dg/gomp/sharing-2.C: New test. * gfortran.dg/gomp/crayptr1.f90: Don't expect error about Cray pointer in FIRSTPRIVATE/LASTPRIVATE. * gfortran.dg/gomp/omp_atomic2.f90: New test. libgomp/ PR fortran/42041 PR fortran/46752 * omp.h.in (omp_in_final): New prototype. * omp_lib.f90.in (omp_in_final): New interface. (omp_integer_kind, omp_logical_kind): Remove and replace all its uses in the module with 4. (openmp_version): Change to 201107. * omp_lib.h.in (omp_sched_static, omp_sched_dynamic, omp_sched_guided, omp_sched_auto): Use omp_sched_kind kind for the parameters. (omp_in_final): New external. (openmp_version): Change to 201107. * task.c (omp_in_final): New function. (gomp_init_task): Initialize final_task. (GOMP_task): Remove unused attribute from flags. Handle final tasks. (GOMP_taskyield): New function. (omp_in_final): Return true if if (false) or final (true) task or descendant of final (true). * fortran.c (omp_in_final_): New function. * libgomp.map (OMP_3.1): Export omp_in_final and omp_in_final_. (GOMP_3.0): Export GOMP_taskyield. * env.c (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New variables. (parse_unsigned_long_list): New function. (initialize_env): Use it for OMP_NUM_THREADS. Call parse_boolean with "OMP_PROC_BIND". If OMP_PROC_BIND=true, call gomp_init_affinity even if parse_affinity returned false. * config/linux/affinity.c (gomp_init_affinity): Handle gomp_cpu_affinity_len == 0. * libgomp_g.h (GOMP_taskyield): New prototype. * libgomp.h (struct gomp_task): Add final_task field. (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New externs. * team.c (gomp_team_start): Override new task's nthreads_var icv if list form OMP_NUM_THREADS has been used and it has value for the new nesting level. * 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/reduction-6.c: New test. * testsuite/libgomp.c/task-5.c: New test. * testsuite/libgomp.c++/atomic-2.C: New test. * testsuite/libgomp.c++/atomic-3.C: New test. * testsuite/libgomp.c++/atomic-4.C: New test. * testsuite/libgomp.c++/atomic-5.C: New test. * testsuite/libgomp.c++/atomic-6.C: New test. * testsuite/libgomp.c++/atomic-7.C: New test. * testsuite/libgomp.c++/atomic-8.C: New test. * testsuite/libgomp.c++/atomic-9.C: New test. * testsuite/libgomp.c++/task-8.C: New test. * testsuite/libgomp.c++/reduction-4.C: New test. * testsuite/libgomp.fortran/allocatable7.f90: New test. * testsuite/libgomp.fortran/allocatable8.f90: New test. * testsuite/libgomp.fortran/crayptr3.f90: New test. * testsuite/libgomp.fortran/omp_atomic3.f90: New test. * testsuite/libgomp.fortran/omp_atomic4.f90: New test. * testsuite/libgomp.fortran/pointer1.f90: New test. * testsuite/libgomp.fortran/pointer2.f90: New test. * testsuite/libgomp.fortran/task4.f90: New test. 2011-08-02 Tobias Burnus <burnus@net-b.de> * libgomp.texi: Update OpenMP spec references to 3.1. (omp_in_final,OMP_PROC_BIND): New sections. (OMP_NUM_THREADS): Document that the value can be now a list. (GOMP_STACKSIZE,GOMP_CPU_AFFINITY): Update @ref. From-SVN: r177194
2011-08-02 18:13:29 +02:00
again, set the lock to itself.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_unset_lock(omp_lock_t *lock);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_unset_lock(svar)}
@item @tab @code{integer(omp_lock_kind), intent(inout) :: svar}
@end multitable
@item @emph{See also}:
@ref{omp_set_lock}, @ref{omp_test_lock}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.3.4.
@end table
@node omp_destroy_lock
@section @code{omp_destroy_lock} -- Destroy simple lock
@table @asis
@item @emph{Description}:
Destroy a simple lock. In order to be destroyed, a simple lock must be
in the unlocked state.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_destroy_lock(omp_lock_t *lock);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_destroy_lock(svar)}
@item @tab @code{integer(omp_lock_kind), intent(inout) :: svar}
@end multitable
@item @emph{See also}:
@ref{omp_init_lock}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.3.2.
@end table
@node omp_init_nest_lock
@section @code{omp_init_nest_lock} -- Initialize nested lock
@table @asis
@item @emph{Description}:
Initialize a nested lock. After initialization, the lock is in
an unlocked state and the nesting count is set to zero.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_init_nest_lock(omp_nest_lock_t *lock);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_init_nest_lock(nvar)}
@item @tab @code{integer(omp_nest_lock_kind), intent(out) :: nvar}
@end multitable
@item @emph{See also}:
@ref{omp_destroy_nest_lock}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.3.1.
@end table
@node omp_set_nest_lock
@section @code{omp_set_nest_lock} -- Wait for and set nested lock
@table @asis
@item @emph{Description}:
Before setting a nested lock, the lock variable must be initialized by
@code{omp_init_nest_lock}. The calling thread is blocked until the lock
is available. If the lock is already held by the current thread, the
backport: re PR fortran/46752 (OpenMP - Seg fault for unallocated allocatable array in firstprivate clause) Merge from gomp-3_1-branch branch: 2011-08-02 Jakub Jelinek <jakub@redhat.com> gcc/ * c-parser.c (enum c_parser_prec): New enum, moved from within c_parser_binary_expression. (c_parser_binary_expression): Add PREC argument. Stop parsing if operator has lower or equal precedence than PREC. (c_parser_conditional_expression, c_parser_omp_for_loop): Adjust callers. (c_parser_omp_atomic): Handle parsing OpenMP 3.1 atomics. Adjust c_finish_omp_atomic caller. (c_parser_omp_taskyield): New function. (c_parser_pragma): Handle PRAGMA_OMP_TASKYIELD. (c_parser_omp_clause_name): Handle final and mergeable clauses. (c_parser_omp_clause_final, c_parser_omp_clause_mergeable): New functions. (c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. (OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses. (c_parser_omp_clause_reduction): Handle min and max. * c-typeck.c (c_finish_omp_clauses): Don't complain about const qualified predetermined vars in firstprivate clause. andle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. Handle MIN_EXPR and MAX_EXPR. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (dump_generic_node): Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW. * tree.c (omp_clause_num_ops): Add OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (omp_clause_code_name): Likewise. (walk_tree_1): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * tree.h (enum omp_clause_code): Add OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (OMP_CLAUSE_FINAL_EXPR): Define. * omp-low.c (scan_sharing_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (expand_task_call): Likewise. (expand_omp_atomic_load, expand_omp_atomic_store): New functions. (expand_omp_atomic_fetch_op): Handle cases where old or new value is needed afterwards. (expand_omp_atomic): Call expand_omp_atomic_load resp. expand_omp_atomic_store. * gimplify.c (gimplify_omp_atomic, gimplify_expr): Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * tree-nested.c (convert_nonlocal_omp_clauses, convert_local_omp_clauses): Likewise. * tree.def (OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD, OMP_ATOMIC_CAPTURE_NEW): New. * gimple.h (GF_OMP_ATOMIC_NEED_VALUE): New. (gimple_omp_atomic_need_value_p, gimple_omp_atomic_set_need_value): New inlines. * omp-builtins.def (BUILT_IN_GOMP_TASKYIELD): New builtin. * doc/generic.texi: Mention OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. gcc/c-family/ * c-common.h (c_finish_omp_atomic): Adjust prototype. (c_finish_omp_taskyield): New prototype. * c-omp.c (c_finish_omp_atomic): Add OPCODE, V, LHS1 and RHS1 arguments. Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW in addition to OMP_ATOMIC. If LHS1 or RHS1 have side-effects, evaluate those too in the right spot, if it is a decl and LHS is also a decl, error out if they aren't the same. (c_finish_omp_taskyield): New function. * c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP to 201107. * c-pragma.c (omp_pragmas): Add taskyield. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_TASKYIELD. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. gcc/cp/ * cp-tree.h (finish_omp_atomic): Adjust prototype. (cxx_omp_const_qual_no_mutable): New prototype. (finish_omp_taskyield): New prototype. * parser.c (cp_parser_omp_atomic): (cp_parser_omp_atomic): Handle parsing OpenMP 3.1 atomics. Adjust finish_omp_atomic caller. (cp_parser_omp_clause_name): Handle final and mergeable clauses. (cp_parser_omp_clause_final, cp_parser_omp_clause_mergeable): New functions. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. (OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses. (cp_parser_omp_taskyield): New function. (cp_parser_pragma): Handle PRAGMA_OMP_TASKYIELD. (cp_parser_omp_clause_reduction): Handle min and max. * pt.c (tsubst_expr) <case OMP_ATOMIC>: Handle OpenMP 3.1 atomics. (tsubst_omp_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * semantics.c (finish_omp_atomic): Add OPCODE, V, LHS1 and RHS1 arguments. Handle OpenMP 3.1 atomics. Adjust c_finish_omp_atomic caller. (finish_omp_clauses): Don't complain about const qualified predetermined vars and static data members in firstprivate clause. Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. Handle MIN_EXPR and MAX_EXPR. (finish_omp_taskyield): New function. * cp-gimplify.c (cxx_omp_const_qual_no_mutable): New function. (cxx_omp_predetermined_sharing): Use it. gcc/fortran/ PR fortran/46752 * cpp.c (cpp_define_builtins): Change _OPENMP to 201107. * openmp.c (gfc_free_omp_clauses): Free also final_expr. (OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE): Define. (gfc_match_omp_clauses): Handle parsing final and mergeable clauses. (OMP_TASK_CLAUSES): Allow final and mergeable clauses. (gfc_match_omp_taskyield): New function. (resolve_omp_clauses): Resolve final clause. Allow POINTERs and Cray pointers in clauses other than REDUCTION. (gfc_match_omp_atomic): Match optional read/write/update/capture keywords after !$omp atomic. (resolve_omp_atomic): Handle all OpenMP 3.1 atomic forms. * dump-parse-tree.c (show_omp_node): Handle EXEC_OMP_TASKYIELD, print final and mergeable clauses. (show_code_node): Handle EXEC_OMP_TASKYIELD. * trans-openmp.c (gfc_trans_omp_clauses): Handle final and mergeable clauses. (gfc_trans_omp_taskyield): New function. (gfc_trans_omp_directive): Handle EXEC_OMP_TASKYIELD. (gfc_trans_omp_atomic): Handle all OpenMP 3.1 atomic forms. (gfc_omp_clause_copy_ctor): Handle non-allocated allocatable. (gfc_omp_predetermined_sharing): Adjust comment. * gfortran.h (gfc_statement): Add ST_OMP_TASKYIELD and ST_OMP_END_ATOMIC. (gfc_omp_clauses): Add final_expr and mergeable fields. (gfc_exec_op): Add EXEC_OMP_TASKYIELD. (gfc_omp_atomic_op): New enum typedef. (struct gfc_code): Add ext.omp_atomic. * trans.c (trans_code): Handle EXEC_OMP_TASKYIELD. * frontend-passes.c (gfc_code_walker): Also walk final_expr. * resolve.c (gfc_resolve_blocks, resolve_code): Handle EXEC_OMP_TASKYIELD. * st.c (gfc_free_statement): Likewise. * match.h (gfc_match_omp_taskyield): New prototype. * parse.c (decode_omp_directive): Handle taskyield directive. Handle !$omp end atomic. (case_executable): Add ST_OMP_TASKYIELD case. (gfc_ascii_statement): Handle ST_OMP_TASKYIELD. (parse_omp_atomic): Return gfc_statement instead of void. For !$omp atomic capture parse two assignments instead of just one and require !$omp end atomic afterwards, for other !$omp atomic forms just allow !$omp end atomic at the end. (parse_omp_structured_block, parse_executable): Adjust parse_omp_atomic callers. 2011-08-02 Tobias Burnus <burnus@net-b.de> * intrinsic.c (OMP_LIB): Updated openmp_version's value to 201107. * gfortran.texi (OpenMP): Update ref to OpenMP 3.1. * intrinsic.texi (OpenMP Modules): Update ref to OpenMP 3.1; remove deleted omp_integer_kind and omp_logical_kind constants. gcc/testsuite/ PR fortran/46752 * gcc.dg/gomp/atomic-5.c: Adjust expected diagnostics. * gcc.dg/gomp/atomic-15.c: New test. * g++.dg/gomp/atomic-5.C: Adjust expected diagnostics. * g++.dg/gomp/atomic-15.C: New test. * g++.dg/gomp/private-1.C: New test. * g++.dg/gomp/sharing-2.C: New test. * gfortran.dg/gomp/crayptr1.f90: Don't expect error about Cray pointer in FIRSTPRIVATE/LASTPRIVATE. * gfortran.dg/gomp/omp_atomic2.f90: New test. libgomp/ PR fortran/42041 PR fortran/46752 * omp.h.in (omp_in_final): New prototype. * omp_lib.f90.in (omp_in_final): New interface. (omp_integer_kind, omp_logical_kind): Remove and replace all its uses in the module with 4. (openmp_version): Change to 201107. * omp_lib.h.in (omp_sched_static, omp_sched_dynamic, omp_sched_guided, omp_sched_auto): Use omp_sched_kind kind for the parameters. (omp_in_final): New external. (openmp_version): Change to 201107. * task.c (omp_in_final): New function. (gomp_init_task): Initialize final_task. (GOMP_task): Remove unused attribute from flags. Handle final tasks. (GOMP_taskyield): New function. (omp_in_final): Return true if if (false) or final (true) task or descendant of final (true). * fortran.c (omp_in_final_): New function. * libgomp.map (OMP_3.1): Export omp_in_final and omp_in_final_. (GOMP_3.0): Export GOMP_taskyield. * env.c (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New variables. (parse_unsigned_long_list): New function. (initialize_env): Use it for OMP_NUM_THREADS. Call parse_boolean with "OMP_PROC_BIND". If OMP_PROC_BIND=true, call gomp_init_affinity even if parse_affinity returned false. * config/linux/affinity.c (gomp_init_affinity): Handle gomp_cpu_affinity_len == 0. * libgomp_g.h (GOMP_taskyield): New prototype. * libgomp.h (struct gomp_task): Add final_task field. (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New externs. * team.c (gomp_team_start): Override new task's nthreads_var icv if list form OMP_NUM_THREADS has been used and it has value for the new nesting level. * 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/reduction-6.c: New test. * testsuite/libgomp.c/task-5.c: New test. * testsuite/libgomp.c++/atomic-2.C: New test. * testsuite/libgomp.c++/atomic-3.C: New test. * testsuite/libgomp.c++/atomic-4.C: New test. * testsuite/libgomp.c++/atomic-5.C: New test. * testsuite/libgomp.c++/atomic-6.C: New test. * testsuite/libgomp.c++/atomic-7.C: New test. * testsuite/libgomp.c++/atomic-8.C: New test. * testsuite/libgomp.c++/atomic-9.C: New test. * testsuite/libgomp.c++/task-8.C: New test. * testsuite/libgomp.c++/reduction-4.C: New test. * testsuite/libgomp.fortran/allocatable7.f90: New test. * testsuite/libgomp.fortran/allocatable8.f90: New test. * testsuite/libgomp.fortran/crayptr3.f90: New test. * testsuite/libgomp.fortran/omp_atomic3.f90: New test. * testsuite/libgomp.fortran/omp_atomic4.f90: New test. * testsuite/libgomp.fortran/pointer1.f90: New test. * testsuite/libgomp.fortran/pointer2.f90: New test. * testsuite/libgomp.fortran/task4.f90: New test. 2011-08-02 Tobias Burnus <burnus@net-b.de> * libgomp.texi: Update OpenMP spec references to 3.1. (omp_in_final,OMP_PROC_BIND): New sections. (OMP_NUM_THREADS): Document that the value can be now a list. (GOMP_STACKSIZE,GOMP_CPU_AFFINITY): Update @ref. From-SVN: r177194
2011-08-02 18:13:29 +02:00
nesting count for the lock is incremented.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_set_nest_lock(omp_nest_lock_t *lock);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_set_nest_lock(nvar)}
@item @tab @code{integer(omp_nest_lock_kind), intent(inout) :: nvar}
@end multitable
@item @emph{See also}:
@ref{omp_init_nest_lock}, @ref{omp_unset_nest_lock}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.3.3.
@end table
@node omp_test_nest_lock
@section @code{omp_test_nest_lock} -- Test and set nested lock if available
@table @asis
@item @emph{Description}:
Before setting a nested lock, the lock variable must be initialized by
@code{omp_init_nest_lock}. Contrary to @code{omp_set_nest_lock},
@code{omp_test_nest_lock} does not block if the lock is not available.
If the lock is already held by the current thread, the new nesting count
is returned. Otherwise, the return value equals zero.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{int omp_test_nest_lock(omp_nest_lock_t *lock);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{logical function omp_test_nest_lock(nvar)}
@item @tab @code{integer(omp_nest_lock_kind), intent(inout) :: nvar}
@end multitable
@item @emph{See also}:
@ref{omp_init_lock}, @ref{omp_set_lock}, @ref{omp_set_lock}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.3.5.
@end table
@node omp_unset_nest_lock
@section @code{omp_unset_nest_lock} -- Unset nested lock
@table @asis
@item @emph{Description}:
A nested lock about to be unset must have been locked by @code{omp_set_nested_lock}
or @code{omp_test_nested_lock} before. In addition, the lock must be held by the
thread calling @code{omp_unset_nested_lock}. If the nesting count drops to zero, the
lock becomes unlocked. If one ore more threads attempted to set the lock before,
backport: re PR fortran/46752 (OpenMP - Seg fault for unallocated allocatable array in firstprivate clause) Merge from gomp-3_1-branch branch: 2011-08-02 Jakub Jelinek <jakub@redhat.com> gcc/ * c-parser.c (enum c_parser_prec): New enum, moved from within c_parser_binary_expression. (c_parser_binary_expression): Add PREC argument. Stop parsing if operator has lower or equal precedence than PREC. (c_parser_conditional_expression, c_parser_omp_for_loop): Adjust callers. (c_parser_omp_atomic): Handle parsing OpenMP 3.1 atomics. Adjust c_finish_omp_atomic caller. (c_parser_omp_taskyield): New function. (c_parser_pragma): Handle PRAGMA_OMP_TASKYIELD. (c_parser_omp_clause_name): Handle final and mergeable clauses. (c_parser_omp_clause_final, c_parser_omp_clause_mergeable): New functions. (c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. (OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses. (c_parser_omp_clause_reduction): Handle min and max. * c-typeck.c (c_finish_omp_clauses): Don't complain about const qualified predetermined vars in firstprivate clause. andle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. Handle MIN_EXPR and MAX_EXPR. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (dump_generic_node): Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW. * tree.c (omp_clause_num_ops): Add OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (omp_clause_code_name): Likewise. (walk_tree_1): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * tree.h (enum omp_clause_code): Add OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (OMP_CLAUSE_FINAL_EXPR): Define. * omp-low.c (scan_sharing_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (expand_task_call): Likewise. (expand_omp_atomic_load, expand_omp_atomic_store): New functions. (expand_omp_atomic_fetch_op): Handle cases where old or new value is needed afterwards. (expand_omp_atomic): Call expand_omp_atomic_load resp. expand_omp_atomic_store. * gimplify.c (gimplify_omp_atomic, gimplify_expr): Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * tree-nested.c (convert_nonlocal_omp_clauses, convert_local_omp_clauses): Likewise. * tree.def (OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD, OMP_ATOMIC_CAPTURE_NEW): New. * gimple.h (GF_OMP_ATOMIC_NEED_VALUE): New. (gimple_omp_atomic_need_value_p, gimple_omp_atomic_set_need_value): New inlines. * omp-builtins.def (BUILT_IN_GOMP_TASKYIELD): New builtin. * doc/generic.texi: Mention OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. gcc/c-family/ * c-common.h (c_finish_omp_atomic): Adjust prototype. (c_finish_omp_taskyield): New prototype. * c-omp.c (c_finish_omp_atomic): Add OPCODE, V, LHS1 and RHS1 arguments. Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW in addition to OMP_ATOMIC. If LHS1 or RHS1 have side-effects, evaluate those too in the right spot, if it is a decl and LHS is also a decl, error out if they aren't the same. (c_finish_omp_taskyield): New function. * c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP to 201107. * c-pragma.c (omp_pragmas): Add taskyield. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_TASKYIELD. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. gcc/cp/ * cp-tree.h (finish_omp_atomic): Adjust prototype. (cxx_omp_const_qual_no_mutable): New prototype. (finish_omp_taskyield): New prototype. * parser.c (cp_parser_omp_atomic): (cp_parser_omp_atomic): Handle parsing OpenMP 3.1 atomics. Adjust finish_omp_atomic caller. (cp_parser_omp_clause_name): Handle final and mergeable clauses. (cp_parser_omp_clause_final, cp_parser_omp_clause_mergeable): New functions. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. (OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses. (cp_parser_omp_taskyield): New function. (cp_parser_pragma): Handle PRAGMA_OMP_TASKYIELD. (cp_parser_omp_clause_reduction): Handle min and max. * pt.c (tsubst_expr) <case OMP_ATOMIC>: Handle OpenMP 3.1 atomics. (tsubst_omp_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * semantics.c (finish_omp_atomic): Add OPCODE, V, LHS1 and RHS1 arguments. Handle OpenMP 3.1 atomics. Adjust c_finish_omp_atomic caller. (finish_omp_clauses): Don't complain about const qualified predetermined vars and static data members in firstprivate clause. Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. Handle MIN_EXPR and MAX_EXPR. (finish_omp_taskyield): New function. * cp-gimplify.c (cxx_omp_const_qual_no_mutable): New function. (cxx_omp_predetermined_sharing): Use it. gcc/fortran/ PR fortran/46752 * cpp.c (cpp_define_builtins): Change _OPENMP to 201107. * openmp.c (gfc_free_omp_clauses): Free also final_expr. (OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE): Define. (gfc_match_omp_clauses): Handle parsing final and mergeable clauses. (OMP_TASK_CLAUSES): Allow final and mergeable clauses. (gfc_match_omp_taskyield): New function. (resolve_omp_clauses): Resolve final clause. Allow POINTERs and Cray pointers in clauses other than REDUCTION. (gfc_match_omp_atomic): Match optional read/write/update/capture keywords after !$omp atomic. (resolve_omp_atomic): Handle all OpenMP 3.1 atomic forms. * dump-parse-tree.c (show_omp_node): Handle EXEC_OMP_TASKYIELD, print final and mergeable clauses. (show_code_node): Handle EXEC_OMP_TASKYIELD. * trans-openmp.c (gfc_trans_omp_clauses): Handle final and mergeable clauses. (gfc_trans_omp_taskyield): New function. (gfc_trans_omp_directive): Handle EXEC_OMP_TASKYIELD. (gfc_trans_omp_atomic): Handle all OpenMP 3.1 atomic forms. (gfc_omp_clause_copy_ctor): Handle non-allocated allocatable. (gfc_omp_predetermined_sharing): Adjust comment. * gfortran.h (gfc_statement): Add ST_OMP_TASKYIELD and ST_OMP_END_ATOMIC. (gfc_omp_clauses): Add final_expr and mergeable fields. (gfc_exec_op): Add EXEC_OMP_TASKYIELD. (gfc_omp_atomic_op): New enum typedef. (struct gfc_code): Add ext.omp_atomic. * trans.c (trans_code): Handle EXEC_OMP_TASKYIELD. * frontend-passes.c (gfc_code_walker): Also walk final_expr. * resolve.c (gfc_resolve_blocks, resolve_code): Handle EXEC_OMP_TASKYIELD. * st.c (gfc_free_statement): Likewise. * match.h (gfc_match_omp_taskyield): New prototype. * parse.c (decode_omp_directive): Handle taskyield directive. Handle !$omp end atomic. (case_executable): Add ST_OMP_TASKYIELD case. (gfc_ascii_statement): Handle ST_OMP_TASKYIELD. (parse_omp_atomic): Return gfc_statement instead of void. For !$omp atomic capture parse two assignments instead of just one and require !$omp end atomic afterwards, for other !$omp atomic forms just allow !$omp end atomic at the end. (parse_omp_structured_block, parse_executable): Adjust parse_omp_atomic callers. 2011-08-02 Tobias Burnus <burnus@net-b.de> * intrinsic.c (OMP_LIB): Updated openmp_version's value to 201107. * gfortran.texi (OpenMP): Update ref to OpenMP 3.1. * intrinsic.texi (OpenMP Modules): Update ref to OpenMP 3.1; remove deleted omp_integer_kind and omp_logical_kind constants. gcc/testsuite/ PR fortran/46752 * gcc.dg/gomp/atomic-5.c: Adjust expected diagnostics. * gcc.dg/gomp/atomic-15.c: New test. * g++.dg/gomp/atomic-5.C: Adjust expected diagnostics. * g++.dg/gomp/atomic-15.C: New test. * g++.dg/gomp/private-1.C: New test. * g++.dg/gomp/sharing-2.C: New test. * gfortran.dg/gomp/crayptr1.f90: Don't expect error about Cray pointer in FIRSTPRIVATE/LASTPRIVATE. * gfortran.dg/gomp/omp_atomic2.f90: New test. libgomp/ PR fortran/42041 PR fortran/46752 * omp.h.in (omp_in_final): New prototype. * omp_lib.f90.in (omp_in_final): New interface. (omp_integer_kind, omp_logical_kind): Remove and replace all its uses in the module with 4. (openmp_version): Change to 201107. * omp_lib.h.in (omp_sched_static, omp_sched_dynamic, omp_sched_guided, omp_sched_auto): Use omp_sched_kind kind for the parameters. (omp_in_final): New external. (openmp_version): Change to 201107. * task.c (omp_in_final): New function. (gomp_init_task): Initialize final_task. (GOMP_task): Remove unused attribute from flags. Handle final tasks. (GOMP_taskyield): New function. (omp_in_final): Return true if if (false) or final (true) task or descendant of final (true). * fortran.c (omp_in_final_): New function. * libgomp.map (OMP_3.1): Export omp_in_final and omp_in_final_. (GOMP_3.0): Export GOMP_taskyield. * env.c (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New variables. (parse_unsigned_long_list): New function. (initialize_env): Use it for OMP_NUM_THREADS. Call parse_boolean with "OMP_PROC_BIND". If OMP_PROC_BIND=true, call gomp_init_affinity even if parse_affinity returned false. * config/linux/affinity.c (gomp_init_affinity): Handle gomp_cpu_affinity_len == 0. * libgomp_g.h (GOMP_taskyield): New prototype. * libgomp.h (struct gomp_task): Add final_task field. (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New externs. * team.c (gomp_team_start): Override new task's nthreads_var icv if list form OMP_NUM_THREADS has been used and it has value for the new nesting level. * 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/reduction-6.c: New test. * testsuite/libgomp.c/task-5.c: New test. * testsuite/libgomp.c++/atomic-2.C: New test. * testsuite/libgomp.c++/atomic-3.C: New test. * testsuite/libgomp.c++/atomic-4.C: New test. * testsuite/libgomp.c++/atomic-5.C: New test. * testsuite/libgomp.c++/atomic-6.C: New test. * testsuite/libgomp.c++/atomic-7.C: New test. * testsuite/libgomp.c++/atomic-8.C: New test. * testsuite/libgomp.c++/atomic-9.C: New test. * testsuite/libgomp.c++/task-8.C: New test. * testsuite/libgomp.c++/reduction-4.C: New test. * testsuite/libgomp.fortran/allocatable7.f90: New test. * testsuite/libgomp.fortran/allocatable8.f90: New test. * testsuite/libgomp.fortran/crayptr3.f90: New test. * testsuite/libgomp.fortran/omp_atomic3.f90: New test. * testsuite/libgomp.fortran/omp_atomic4.f90: New test. * testsuite/libgomp.fortran/pointer1.f90: New test. * testsuite/libgomp.fortran/pointer2.f90: New test. * testsuite/libgomp.fortran/task4.f90: New test. 2011-08-02 Tobias Burnus <burnus@net-b.de> * libgomp.texi: Update OpenMP spec references to 3.1. (omp_in_final,OMP_PROC_BIND): New sections. (OMP_NUM_THREADS): Document that the value can be now a list. (GOMP_STACKSIZE,GOMP_CPU_AFFINITY): Update @ref. From-SVN: r177194
2011-08-02 18:13:29 +02:00
one of them is chosen to, again, set the lock to itself.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_unset_nest_lock(omp_nest_lock_t *lock);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_unset_nest_lock(nvar)}
@item @tab @code{integer(omp_nest_lock_kind), intent(inout) :: nvar}
@end multitable
@item @emph{See also}:
@ref{omp_set_nest_lock}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.3.4.
@end table
@node omp_destroy_nest_lock
@section @code{omp_destroy_nest_lock} -- Destroy nested lock
@table @asis
@item @emph{Description}:
Destroy a nested lock. In order to be destroyed, a nested lock must be
in the unlocked state and its nesting count must equal zero.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{void omp_destroy_nest_lock(omp_nest_lock_t *);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{subroutine omp_destroy_nest_lock(nvar)}
@item @tab @code{integer(omp_nest_lock_kind), intent(inout) :: nvar}
@end multitable
@item @emph{See also}:
@ref{omp_init_lock}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.3.2.
@end table
@node omp_get_wtick
@section @code{omp_get_wtick} -- Get timer precision
@table @asis
@item @emph{Description}:
Gets the timer precision, i.e., the number of seconds between two
successive clock ticks.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{double omp_get_wtick(void);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{double precision function omp_get_wtick()}
@end multitable
@item @emph{See also}:
@ref{omp_get_wtime}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.4.2.
@end table
@node omp_get_wtime
@section @code{omp_get_wtime} -- Elapsed wall clock time
@table @asis
@item @emph{Description}:
Elapsed wall clock time in seconds. The time is measured per thread, no
guarantee can be made that two distinct threads measure the same time.
Time is measured from some "time in the past", which is an arbitrary time
guaranteed not to change during the execution of the program.
@item @emph{C/C++}:
@multitable @columnfractions .20 .80
@item @emph{Prototype}: @tab @code{double omp_get_wtime(void);}
@end multitable
@item @emph{Fortran}:
@multitable @columnfractions .20 .80
@item @emph{Interface}: @tab @code{double precision function omp_get_wtime()}
@end multitable
@item @emph{See also}:
@ref{omp_get_wtick}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 3.4.1.
@end table
@c ---------------------------------------------------------------------
@c Environment Variables
@c ---------------------------------------------------------------------
@node Environment Variables
@chapter Environment Variables
target.c: New file. 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: Richard Henderson <rth@redhat.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> From-SVN: r203408
2013-10-11 11:26:50 +02:00
The environment variables which beginning with @env{OMP_} are defined by
section 4 of the OpenMP specification in version 4.0, while those
beginning with @env{GOMP_} are GNU extensions.
@menu
* OMP_CANCELLATION:: Set whether cancellation is activated
* OMP_DISPLAY_ENV:: Show OpenMP version and environment variables
* OMP_DEFAULT_DEVICE:: Set the device used in target regions
* OMP_DYNAMIC:: Dynamic adjustment of threads
* OMP_MAX_ACTIVE_LEVELS:: Set the maximum number of nested parallel regions
* OMP_NESTED:: Nested parallel regions
* OMP_NUM_THREADS:: Specifies the number of threads to use
* OMP_PROC_BIND:: Whether theads may be moved between CPUs
* OMP_PLACES:: Specifies on which CPUs the theads should be placed
* OMP_STACKSIZE:: Set default thread stack size
* OMP_SCHEDULE:: How threads are scheduled
* OMP_THREAD_LIMIT:: Set the maximum number of threads
* OMP_WAIT_POLICY:: How waiting threads are handled
* GOMP_CPU_AFFINITY:: Bind threads to specific CPUs
Merge current set of OpenACC changes from gomp-4_0-branch. contrib/ * gcc_update (files_and_dependencies): Update rules for new libgomp/plugin/Makefrag.am and libgomp/plugin/configfrag.ac files. gcc/ * builtin-types.def (BT_FN_VOID_INT_INT_VAR) (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR) (BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR): New function types. * builtins.c: Include "gomp-constants.h". (expand_builtin_acc_on_device): New function. (expand_builtin, is_inexpensive_builtin): Handle BUILT_IN_ACC_ON_DEVICE. * builtins.def (DEF_GOACC_BUILTIN, DEF_GOACC_BUILTIN_COMPILER): New macros. * cgraph.c (cgraph_node::create): Consider flag_openacc next to flag_openmp. * config.gcc <nvptx-*> (tm_file): Add nvptx/offload.h. <*-intelmic-* | *-intelmicemul-*> (tm_file): Add i386/intelmic-offload.h. * gcc.c (LINK_COMMAND_SPEC, GOMP_SELF_SPECS): For -fopenacc, link to libgomp and its dependencies. * config/arc/arc.h (LINK_COMMAND_SPEC): Likewise. * config/darwin.h (LINK_COMMAND_SPEC_A): Likewise. * config/i386/mingw32.h (GOMP_SELF_SPECS): Likewise. * config/ia64/hpux.h (LIB_SPEC): Likewise. * config/pa/pa-hpux11.h (LIB_SPEC): Likewise. * config/pa/pa64-hpux.h (LIB_SPEC): Likewise. * doc/generic.texi: Update for OpenACC changes. * doc/gimple.texi: Likewise. * doc/invoke.texi: Likewise. * doc/sourcebuild.texi: Likewise. * gimple-pretty-print.c (dump_gimple_omp_for): Handle GF_OMP_FOR_KIND_OACC_LOOP. (dump_gimple_omp_target): Handle GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_DATA, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA. Dump more data. * gimple.c: Update comments for OpenACC changes. * gimple.def: Likewise. * gimple.h: Likewise. (enum gf_mask): Add GF_OMP_FOR_KIND_OACC_LOOP, GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_DATA, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA. (gimple_omp_for_cond, gimple_omp_for_set_cond): Sort in the appropriate place. (is_gimple_omp_oacc, is_gimple_omp_offloaded): New functions. * gimplify.c: Include "gomp-constants.h". Update comments for OpenACC changes. (is_gimple_stmt): Handle OACC_PARALLEL, OACC_KERNELS, OACC_DATA, OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle OMP_CLAUSE__CACHE_, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ. (gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (gimplify_oacc_cache): New function. (gimplify_omp_for): Handle OACC_LOOP. (gimplify_omp_workshare): Handle OACC_KERNELS, OACC_PARALLEL, OACC_DATA. (gimplify_omp_target_update): Handle OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE. (gimplify_expr): Handle OACC_LOOP, OACC_CACHE, OACC_HOST_DATA, OACC_DECLARE, OACC_KERNELS, OACC_PARALLEL, OACC_DATA, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE. (gimplify_body): Consider flag_openacc next to flag_openmp. * lto-streamer-out.c: Include "gomp-constants.h". * omp-builtins.def (BUILT_IN_ACC_GET_DEVICE_TYPE) (BUILT_IN_GOACC_DATA_START, BUILT_IN_GOACC_DATA_END) (BUILT_IN_GOACC_ENTER_EXIT_DATA, BUILT_IN_GOACC_PARALLEL) (BUILT_IN_GOACC_UPDATE, BUILT_IN_GOACC_WAIT) (BUILT_IN_GOACC_GET_THREAD_NUM, BUILT_IN_GOACC_GET_NUM_THREADS) (BUILT_IN_ACC_ON_DEVICE): New builtins. * omp-low.c: Include "gomp-constants.h". Update comments for OpenACC changes. (struct omp_context): Add reduction_map, gwv_below, gwv_this members. (extract_omp_for_data, use_pointer_for_field, install_var_field) (new_omp_context, delete_omp_context, scan_sharing_clauses) (create_omp_child_function, scan_omp_for, scan_omp_target) (check_omp_nesting_restrictions, lower_reduction_clauses) (build_omp_regions_1, diagnose_sb_0, make_gimple_omp_edges): Update for OpenACC changes. (scan_sharing_clauses): Handle OMP_CLAUSE_NUM_GANGS: OMP_CLAUSE_NUM_WORKERS: OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Handle GF_OMP_FOR_KIND_OACC_LOOP. (expand_omp_target, lower_omp_target): Handle GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA, GF_OMP_TARGET_KIND_OACC_DATA. (pass_expand_omp::execute, execute_lower_omp) (pass_diagnose_omp_blocks::gate): Consider flag_openacc next to flag_openmp. (offload_symbol_decl): New variable. (oacc_get_reduction_array_id, oacc_max_threads) (get_offload_symbol_decl, get_base_type, lookup_oacc_reduction) (maybe_lookup_oacc_reduction, enclosing_target_ctx) (oacc_loop_or_target_p, oacc_lower_reduction_var_helper) (oacc_gimple_assign, oacc_initialize_reduction_data) (oacc_finalize_reduction_data, oacc_process_reduction_data): New functions. (is_targetreg_ctx): Remove function. * tree-core.h (enum omp_clause_code): Add OMP_CLAUSE__CACHE_, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_GANG, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH. * tree.c (omp_clause_code_name, walk_tree_1): Update accordingly. * tree.h (OMP_CLAUSE_GANG_EXPR, OMP_CLAUSE_GANG_STATIC_EXPR) (OMP_CLAUSE_ASYNC_EXPR, OMP_CLAUSE_WAIT_EXPR) (OMP_CLAUSE_VECTOR_EXPR, OMP_CLAUSE_WORKER_EXPR) (OMP_CLAUSE_NUM_GANGS_EXPR, OMP_CLAUSE_NUM_WORKERS_EXPR) (OMP_CLAUSE_VECTOR_LENGTH_EXPR): New macros. * tree-core.h: Update comments for OpenACC changes. (enum omp_clause_map_kind): Remove. (struct tree_omp_clause): Change type of map_kind member from enum omp_clause_map_kind to unsigned char. * tree-inline.c: Update comments for OpenACC changes. * tree-nested.c: Likewise. Include "gomp-constants.h". (convert_nonlocal_reference_stmt, convert_local_reference_stmt) (convert_tramp_reference_stmt, convert_gimple_call): Update for OpenACC changes. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. * tree-pretty-print.c: Include "gomp-constants.h". (dump_omp_clause): Handle OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_GANG, OMP_CLAUSE_ASYNC, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_WAIT, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_INDEPENDENT. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (dump_generic_node): Handle OACC_PARALLEL, OACC_KERNELS, OACC_DATA, OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP. * tree-streamer-in.c: Include "gomp-constants.h". (unpack_ts_omp_clause_value_fields) Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. * tree-streamer-out.c: Include "gomp-constants.h". (pack_ts_omp_clause_value_fields): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. * tree.def (OACC_PARALLEL, OACC_KERNELS, OACC_DATA) (OACC_HOST_DATA, OACC_LOOP, OACC_CACHE, OACC_DECLARE) (OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE): New tree codes. * tree.c (omp_clause_num_ops): Update accordingly. * tree.h (OMP_BODY, OMP_CLAUSES, OMP_LOOP_CHECK, OMP_CLAUSE_SIZE): Likewise. (OACC_PARALLEL_BODY, OACC_PARALLEL_CLAUSES, OACC_KERNELS_BODY) (OACC_KERNELS_CLAUSES, OACC_DATA_BODY, OACC_DATA_CLAUSES) (OACC_HOST_DATA_BODY, OACC_HOST_DATA_CLAUSES, OACC_CACHE_CLAUSES) (OACC_DECLARE_CLAUSES, OACC_ENTER_DATA_CLAUSES) (OACC_EXIT_DATA_CLAUSES, OACC_UPDATE_CLAUSES) (OACC_KERNELS_COMBINED, OACC_PARALLEL_COMBINED): New macros. * tree.h (OMP_CLAUSE_MAP_KIND): Cast it to enum gomp_map_kind. (OMP_CLAUSE_SET_MAP_KIND): New macro. * varpool.c (varpool_node::get_create): Consider flag_openacc next to flag_openmp. * config/i386/intelmic-offload.h: New file. * config/nvptx/offload.h: Likewise. gcc/ada/ * gcc-interface/utils.c (DEF_FUNCTION_TYPE_VAR_8) (DEF_FUNCTION_TYPE_VAR_12): New macros. gcc/c-family/ * c.opt (fopenacc): New option. * c-cppbuiltin.c (c_cpp_builtins): Conditionally define _OPENACC. * c-common.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): New macros. * c-common.h (c_finish_oacc_wait): New prototype. * c-omp.c: Include "omp-low.h" and "gomp-constants.h". (c_finish_oacc_wait): New function. * c-pragma.c (oacc_pragmas): New variable. (c_pp_lookup_pragma, init_pragma): Handle it. * c-pragma.h (enum pragma_kind): Add PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT. (enum pragma_omp_clause): Add PRAGMA_OACC_CLAUSE_ASYNC, PRAGMA_OACC_CLAUSE_AUTO, PRAGMA_OACC_CLAUSE_COLLAPSE, PRAGMA_OACC_CLAUSE_COPY, PRAGMA_OACC_CLAUSE_COPYIN, PRAGMA_OACC_CLAUSE_COPYOUT, PRAGMA_OACC_CLAUSE_CREATE, PRAGMA_OACC_CLAUSE_DELETE, PRAGMA_OACC_CLAUSE_DEVICE, PRAGMA_OACC_CLAUSE_DEVICEPTR, PRAGMA_OACC_CLAUSE_FIRSTPRIVATE, PRAGMA_OACC_CLAUSE_GANG, PRAGMA_OACC_CLAUSE_HOST, PRAGMA_OACC_CLAUSE_IF, PRAGMA_OACC_CLAUSE_NUM_GANGS, PRAGMA_OACC_CLAUSE_NUM_WORKERS, PRAGMA_OACC_CLAUSE_PRESENT, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPY, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYIN, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYOUT, PRAGMA_OACC_CLAUSE_PRESENT_OR_CREATE, PRAGMA_OACC_CLAUSE_PRIVATE, PRAGMA_OACC_CLAUSE_REDUCTION, PRAGMA_OACC_CLAUSE_SELF, PRAGMA_OACC_CLAUSE_SEQ, PRAGMA_OACC_CLAUSE_VECTOR, PRAGMA_OACC_CLAUSE_VECTOR_LENGTH, PRAGMA_OACC_CLAUSE_WAIT, PRAGMA_OACC_CLAUSE_WORKER. gcc/c/ * c-parser.c: Include "gomp-constants.h". (c_parser_omp_clause_map): Use enum gomp_map_kind instead of enum omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (c_parser_pragma): Handle PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_UPDATE. (c_parser_omp_construct): Handle PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_WAIT. (c_parser_omp_clause_name): Handle "auto", "async", "copy", "copyout", "create", "delete", "deviceptr", "gang", "host", "num_gangs", "num_workers", "present", "present_or_copy", "pcopy", "present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout", "present_or_create", "pcreate", "seq", "self", "vector", "vector_length", "wait", "worker". (OACC_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK) (OACC_ENTER_DATA_CLAUSE_MASK, OACC_EXIT_DATA_CLAUSE_MASK) (OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK) (OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros. (c_parser_omp_variable_list): Handle OMP_CLAUSE__CACHE_. (c_parser_oacc_wait_list, c_parser_oacc_data_clause) (c_parser_oacc_data_clause_deviceptr) (c_parser_omp_clause_num_gangs, c_parser_omp_clause_num_workers) (c_parser_oacc_clause_async, c_parser_oacc_clause_wait) (c_parser_omp_clause_vector_length, c_parser_oacc_all_clauses) (c_parser_oacc_cache, c_parser_oacc_data, c_parser_oacc_kernels) (c_parser_oacc_enter_exit_data, c_parser_oacc_loop) (c_parser_oacc_parallel, c_parser_oacc_update) (c_parser_oacc_wait): New functions. * c-tree.h (c_finish_oacc_parallel, c_finish_oacc_kernels) (c_finish_oacc_data): New prototypes. * c-typeck.c: Include "gomp-constants.h". (handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (c_finish_oacc_parallel, c_finish_oacc_kernels) (c_finish_oacc_data): New functions. (c_finish_omp_clauses): Handle OMP_CLAUSE__CACHE_, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, and OMP_CLAUSE_MAP's GOMP_MAP_FORCE_DEVICEPTR. gcc/cp/ * parser.c: Include "gomp-constants.h". (cp_parser_omp_clause_map): Use enum gomp_map_kind instead of enum omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (cp_parser_omp_construct, cp_parser_pragma): Handle PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_LOOP, PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT. (cp_parser_omp_clause_name): Handle "async", "copy", "copyout", "create", "delete", "deviceptr", "host", "num_gangs", "num_workers", "present", "present_or_copy", "pcopy", "present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout", "present_or_create", "pcreate", "vector_length", "wait". (OACC_DATA_CLAUSE_MASK, OACC_ENTER_DATA_CLAUSE_MASK) (OACC_EXIT_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK) (OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK) (OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros. (cp_parser_omp_var_list_no_open): Handle OMP_CLAUSE__CACHE_. (cp_parser_oacc_data_clause, cp_parser_oacc_data_clause_deviceptr) (cp_parser_oacc_clause_vector_length, cp_parser_oacc_wait_list) (cp_parser_oacc_clause_wait, cp_parser_omp_clause_num_gangs) (cp_parser_omp_clause_num_workers, cp_parser_oacc_clause_async) (cp_parser_oacc_all_clauses, cp_parser_oacc_cache) (cp_parser_oacc_data, cp_parser_oacc_enter_exit_data) (cp_parser_oacc_kernels, cp_parser_oacc_loop) (cp_parser_oacc_parallel, cp_parser_oacc_update) (cp_parser_oacc_wait): New functions. * cp-tree.h (finish_oacc_data, finish_oacc_kernels) (finish_oacc_parallel): New prototypes. * semantics.c: Include "gomp-constants.h". (handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (finish_omp_clauses): Handle OMP_CLAUSE_ASYNC, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_WAIT, OMP_CLAUSE__CACHE_. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (finish_oacc_data, finish_oacc_kernels, finish_oacc_parallel): New functions. gcc/fortran/ * lang.opt (fopenacc): New option. * cpp.c (cpp_define_builtins): Conditionally define _OPENACC. * dump-parse-tree.c (show_omp_node): Split part of it into... (show_omp_clauses): ... this new function. (show_omp_node, show_code_node): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (show_namespace): Update for OpenACC. * f95-lang.c (DEF_FUNCTION_TYPE_VAR_2, DEF_FUNCTION_TYPE_VAR_8) (DEF_FUNCTION_TYPE_VAR_12, DEF_GOACC_BUILTIN) (DEF_GOACC_BUILTIN_COMPILER): New macros. * types.def (BT_FN_VOID_INT_INT_VAR) (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR) (BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR): New function types. * gfortran.h (gfc_statement): Add ST_OACC_PARALLEL_LOOP, ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL, ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_DATA, ST_OACC_END_DATA, ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA, ST_OACC_LOOP, ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_KERNELS_LOOP, ST_OACC_END_KERNELS_LOOP, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA, ST_OACC_ROUTINE. (struct gfc_expr_list): New data type. (gfc_get_expr_list): New macro. (gfc_omp_map_op): Add OMP_MAP_FORCE_ALLOC, OMP_MAP_FORCE_DEALLOC, OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM, OMP_MAP_FORCE_TOFROM, OMP_MAP_FORCE_PRESENT, OMP_MAP_FORCE_DEVICEPTR. (OMP_LIST_FIRST, OMP_LIST_DEVICE_RESIDENT, OMP_LIST_USE_DEVICE) (OMP_LIST_CACHE): New enumerators. (struct gfc_omp_clauses): Add async_expr, gang_expr, worker_expr, vector_expr, num_gangs_expr, num_workers_expr, vector_length_expr, wait_list, tile_list, async, gang, worker, vector, seq, independent, wait, par_auto, gang_static, and loc members. (struct gfc_namespace): Add oacc_declare_clauses member. (gfc_exec_op): Add EXEC_OACC_KERNELS_LOOP, EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (gfc_free_expr_list, gfc_resolve_oacc_directive) (gfc_resolve_oacc_declare, gfc_resolve_oacc_parallel_loop_blocks) (gfc_resolve_oacc_blocks): New prototypes. * match.c (match_exit_cycle): Handle EXEC_OACC_LOOP and EXEC_OACC_PARALLEL_LOOP. * match.h (gfc_match_oacc_cache, gfc_match_oacc_wait) (gfc_match_oacc_update, gfc_match_oacc_declare) (gfc_match_oacc_loop, gfc_match_oacc_host_data) (gfc_match_oacc_data, gfc_match_oacc_kernels) (gfc_match_oacc_kernels_loop, gfc_match_oacc_parallel) (gfc_match_oacc_parallel_loop, gfc_match_oacc_enter_data) (gfc_match_oacc_exit_data, gfc_match_oacc_routine): New prototypes. * openmp.c: Include "diagnostic.h" and "gomp-constants.h". (gfc_free_omp_clauses): Update for members added to struct gfc_omp_clauses. (gfc_match_omp_clauses): Change mask paramter to uint64_t. Add openacc parameter. (resolve_omp_clauses): Add openacc parameter. Update for OpenACC. (struct fortran_omp_context): Add is_openmp member. (gfc_resolve_omp_parallel_blocks): Initialize it. (gfc_resolve_do_iterator): Update for OpenACC. (gfc_resolve_omp_directive): Call resolve_omp_directive_inside_oacc_region. (OMP_CLAUSE_PRIVATE, OMP_CLAUSE_FIRSTPRIVATE) (OMP_CLAUSE_LASTPRIVATE, OMP_CLAUSE_COPYPRIVATE) (OMP_CLAUSE_SHARED, OMP_CLAUSE_COPYIN, OMP_CLAUSE_REDUCTION) (OMP_CLAUSE_IF, OMP_CLAUSE_NUM_THREADS, OMP_CLAUSE_SCHEDULE) (OMP_CLAUSE_DEFAULT, OMP_CLAUSE_ORDERED, OMP_CLAUSE_COLLAPSE) (OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE) (OMP_CLAUSE_ALIGNED, OMP_CLAUSE_DEPEND, OMP_CLAUSE_INBRANCH) (OMP_CLAUSE_LINEAR, OMP_CLAUSE_NOTINBRANCH, OMP_CLAUSE_PROC_BIND) (OMP_CLAUSE_SAFELEN, OMP_CLAUSE_SIMDLEN, OMP_CLAUSE_UNIFORM) (OMP_CLAUSE_DEVICE, OMP_CLAUSE_MAP, OMP_CLAUSE_TO) (OMP_CLAUSE_FROM, OMP_CLAUSE_NUM_TEAMS, OMP_CLAUSE_THREAD_LIMIT) (OMP_CLAUSE_DIST_SCHEDULE): Use uint64_t. (OMP_CLAUSE_ASYNC, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS) (OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_COPY, OMP_CLAUSE_COPYOUT) (OMP_CLAUSE_CREATE, OMP_CLAUSE_PRESENT) (OMP_CLAUSE_PRESENT_OR_COPY, OMP_CLAUSE_PRESENT_OR_COPYIN) (OMP_CLAUSE_PRESENT_OR_COPYOUT, OMP_CLAUSE_PRESENT_OR_CREATE) (OMP_CLAUSE_DEVICEPTR, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER) (OMP_CLAUSE_VECTOR, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT) (OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_DEVICE_RESIDENT) (OMP_CLAUSE_HOST_SELF, OMP_CLAUSE_OACC_DEVICE, OMP_CLAUSE_WAIT) (OMP_CLAUSE_DELETE, OMP_CLAUSE_AUTO, OMP_CLAUSE_TILE): New macros. (gfc_match_omp_clauses): Handle those. (OACC_PARALLEL_CLAUSES, OACC_KERNELS_CLAUSES, OACC_DATA_CLAUSES) (OACC_LOOP_CLAUSES, OACC_PARALLEL_LOOP_CLAUSES) (OACC_KERNELS_LOOP_CLAUSES, OACC_HOST_DATA_CLAUSES) (OACC_DECLARE_CLAUSES, OACC_UPDATE_CLAUSES) (OACC_ENTER_DATA_CLAUSES, OACC_EXIT_DATA_CLAUSES) (OACC_WAIT_CLAUSES): New macros. (gfc_free_expr_list, match_oacc_expr_list, match_oacc_clause_gang) (gfc_match_omp_map_clause, gfc_match_oacc_parallel_loop) (gfc_match_oacc_parallel, gfc_match_oacc_kernels_loop) (gfc_match_oacc_kernels, gfc_match_oacc_data) (gfc_match_oacc_host_data, gfc_match_oacc_loop) (gfc_match_oacc_declare, gfc_match_oacc_update) (gfc_match_oacc_enter_data, gfc_match_oacc_exit_data) (gfc_match_oacc_wait, gfc_match_oacc_cache) (gfc_match_oacc_routine, oacc_is_loop) (resolve_oacc_scalar_int_expr, resolve_oacc_positive_int_expr) (check_symbol_not_pointer, check_array_not_assumed) (resolve_oacc_data_clauses, resolve_oacc_deviceptr_clause) (oacc_compatible_clauses, oacc_is_parallel, oacc_is_kernels) (omp_code_to_statement, oacc_code_to_statement) (resolve_oacc_directive_inside_omp_region) (resolve_omp_directive_inside_oacc_region) (resolve_oacc_nested_loops, resolve_oacc_params_in_parallel) (resolve_oacc_loop_blocks, gfc_resolve_oacc_blocks) (resolve_oacc_loop, resolve_oacc_cache, gfc_resolve_oacc_declare) (gfc_resolve_oacc_directive): New functions. * parse.c (next_free): Update for OpenACC. Move some code into... (verify_token_free): ... this new function. (next_fixed): Update for OpenACC. Move some code into... (verify_token_fixed): ... this new function. (case_executable): Add ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_ENTER_DATA, and ST_OACC_EXIT_DATA. (case_exec_markers): Add ST_OACC_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA, ST_OACC_LOOP, ST_OACC_KERNELS_LOOP. (case_decl): Add ST_OACC_ROUTINE. (push_state, parse_critical_block, parse_progunit): Update for OpenACC. (gfc_ascii_statement): Handle ST_OACC_PARALLEL_LOOP, ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL, ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_KERNELS_LOOP, ST_OACC_END_KERNELS_LOOP, ST_OACC_DATA, ST_OACC_END_DATA, ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA, ST_OACC_LOOP, ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA, ST_OACC_ROUTINE. (verify_st_order, parse_spec): Handle ST_OACC_DECLARE. (parse_executable): Handle ST_OACC_PARALLEL_LOOP, ST_OACC_KERNELS_LOOP, ST_OACC_LOOP, ST_OACC_PARALLEL, ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA. (decode_oacc_directive, parse_oacc_structured_block) (parse_oacc_loop, is_oacc): New functions. * parse.h (struct gfc_state_data): Add oacc_declare_clauses member. (is_oacc): New prototype. * resolve.c (gfc_resolve_blocks, gfc_resolve_code): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (resolve_codes): Call gfc_resolve_oacc_declare. * scanner.c (openacc_flag, openacc_locus): New variables. (skip_free_comments): Update for OpenACC. Move some code into... (skip_omp_attribute): ... this new function. (skip_oacc_attribute): New function. (skip_fixed_comments, gfc_next_char_literal): Update for OpenACC. * st.c (gfc_free_statement): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. * trans-decl.c (gfc_generate_function_code): Update for OpenACC. * trans-openmp.c: Include "gomp-constants.h". (gfc_omp_finish_clause, gfc_trans_omp_clauses): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (gfc_trans_omp_clauses): Handle OMP_LIST_USE_DEVICE, OMP_LIST_DEVICE_RESIDENT, OMP_LIST_CACHE, and OMP_MAP_FORCE_ALLOC, OMP_MAP_FORCE_DEALLOC, OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM, OMP_MAP_FORCE_TOFROM, OMP_MAP_FORCE_PRESENT, OMP_MAP_FORCE_DEVICEPTR, and gfc_omp_clauses' async, seq, independent, wait_list, num_gangs_expr, num_workers_expr, vector_length_expr, vector, vector_expr, worker, worker_expr, gang, gang_expr members. (gfc_trans_omp_do): Handle EXEC_OACC_LOOP. (gfc_convert_expr_to_tree, gfc_trans_oacc_construct) (gfc_trans_oacc_executable_directive) (gfc_trans_oacc_wait_directive, gfc_trans_oacc_combined_directive) (gfc_trans_oacc_declare, gfc_trans_oacc_directive): New functions. * trans-stmt.c (gfc_trans_block_construct): Update for OpenACC. * trans-stmt.h (gfc_trans_oacc_directive, gfc_trans_oacc_declare): New prototypes. * trans.c (tranc_code): Handle EXEC_OACC_CACHE, EXEC_OACC_WAIT, EXEC_OACC_UPDATE, EXEC_OACC_LOOP, EXEC_OACC_HOST_DATA, EXEC_OACC_DATA, EXEC_OACC_KERNELS, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. * gfortran.texi: Update for OpenACC. * intrinsic.texi: Likewise. * invoke.texi: Likewise. gcc/lto/ * lto-lang.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): New macros. * lto.c: Include "gomp-constants.h". gcc/testsuite/ * lib/target-supports.exp (check_effective_target_fopenacc): New procedure. * g++.dg/goacc-gomp/goacc-gomp.exp: New file. * g++.dg/goacc/goacc.exp: Likewise. * gcc.dg/goacc-gomp/goacc-gomp.exp: Likewise. * gcc.dg/goacc/goacc.exp: Likewise. * gfortran.dg/goacc/goacc.exp: Likewise. * c-c++-common/cpp/openacc-define-1.c: New file. * c-c++-common/cpp/openacc-define-2.c: Likewise. * c-c++-common/cpp/openacc-define-3.c: Likewise. * c-c++-common/goacc-gomp/nesting-1.c: Likewise. * c-c++-common/goacc-gomp/nesting-fail-1.c: Likewise. * c-c++-common/goacc/acc_on_device-2-off.c: Likewise. * c-c++-common/goacc/acc_on_device-2.c: Likewise. * c-c++-common/goacc/asyncwait-1.c: Likewise. * c-c++-common/goacc/cache-1.c: Likewise. * c-c++-common/goacc/clauses-fail.c: Likewise. * c-c++-common/goacc/collapse-1.c: Likewise. * c-c++-common/goacc/data-1.c: Likewise. * c-c++-common/goacc/data-2.c: Likewise. * c-c++-common/goacc/data-clause-duplicate-1.c: Likewise. * c-c++-common/goacc/deviceptr-1.c: Likewise. * c-c++-common/goacc/deviceptr-2.c: Likewise. * c-c++-common/goacc/deviceptr-3.c: Likewise. * c-c++-common/goacc/if-clause-1.c: Likewise. * c-c++-common/goacc/if-clause-2.c: Likewise. * c-c++-common/goacc/kernels-1.c: Likewise. * c-c++-common/goacc/loop-1.c: Likewise. * c-c++-common/goacc/loop-private-1.c: Likewise. * c-c++-common/goacc/nesting-1.c: Likewise. * c-c++-common/goacc/nesting-data-1.c: Likewise. * c-c++-common/goacc/nesting-fail-1.c: Likewise. * c-c++-common/goacc/parallel-1.c: Likewise. * c-c++-common/goacc/pcopy.c: Likewise. * c-c++-common/goacc/pcopyin.c: Likewise. * c-c++-common/goacc/pcopyout.c: Likewise. * c-c++-common/goacc/pcreate.c: Likewise. * c-c++-common/goacc/pragma_context.c: Likewise. * c-c++-common/goacc/present-1.c: Likewise. * c-c++-common/goacc/reduction-1.c: Likewise. * c-c++-common/goacc/reduction-2.c: Likewise. * c-c++-common/goacc/reduction-3.c: Likewise. * c-c++-common/goacc/reduction-4.c: Likewise. * c-c++-common/goacc/sb-1.c: Likewise. * c-c++-common/goacc/sb-2.c: Likewise. * c-c++-common/goacc/sb-3.c: Likewise. * c-c++-common/goacc/update-1.c: Likewise. * gcc.dg/goacc/acc_on_device-1.c: Likewise. * gfortran.dg/goacc/acc_on_device-1.f95: Likewise. * gfortran.dg/goacc/acc_on_device-2-off.f95: Likewise. * gfortran.dg/goacc/acc_on_device-2.f95: Likewise. * gfortran.dg/goacc/assumed.f95: Likewise. * gfortran.dg/goacc/asyncwait-1.f95: Likewise. * gfortran.dg/goacc/asyncwait-2.f95: Likewise. * gfortran.dg/goacc/asyncwait-3.f95: Likewise. * gfortran.dg/goacc/asyncwait-4.f95: Likewise. * gfortran.dg/goacc/branch.f95: Likewise. * gfortran.dg/goacc/cache-1.f95: Likewise. * gfortran.dg/goacc/coarray.f95: Likewise. * gfortran.dg/goacc/continuation-free-form.f95: Likewise. * gfortran.dg/goacc/cray.f95: Likewise. * gfortran.dg/goacc/critical.f95: Likewise. * gfortran.dg/goacc/data-clauses.f95: Likewise. * gfortran.dg/goacc/data-tree.f95: Likewise. * gfortran.dg/goacc/declare-1.f95: Likewise. * gfortran.dg/goacc/enter-exit-data.f95: Likewise. * gfortran.dg/goacc/fixed-1.f: Likewise. * gfortran.dg/goacc/fixed-2.f: Likewise. * gfortran.dg/goacc/fixed-3.f: Likewise. * gfortran.dg/goacc/fixed-4.f: Likewise. * gfortran.dg/goacc/host_data-tree.f95: Likewise. * gfortran.dg/goacc/if.f95: Likewise. * gfortran.dg/goacc/kernels-tree.f95: Likewise. * gfortran.dg/goacc/list.f95: Likewise. * gfortran.dg/goacc/literal.f95: Likewise. * gfortran.dg/goacc/loop-1.f95: Likewise. * gfortran.dg/goacc/loop-2.f95: Likewise. * gfortran.dg/goacc/loop-3.f95: Likewise. * gfortran.dg/goacc/loop-tree-1.f90: Likewise. * gfortran.dg/goacc/omp.f95: Likewise. * gfortran.dg/goacc/parallel-kernels-clauses.f95: Likewise. * gfortran.dg/goacc/parallel-kernels-regions.f95: Likewise. * gfortran.dg/goacc/parallel-tree.f95: Likewise. * gfortran.dg/goacc/parameter.f95: Likewise. * gfortran.dg/goacc/private-1.f95: Likewise. * gfortran.dg/goacc/private-2.f95: Likewise. * gfortran.dg/goacc/private-3.f95: Likewise. * gfortran.dg/goacc/pure-elemental-procedures.f95: Likewise. * gfortran.dg/goacc/reduction-2.f95: Likewise. * gfortran.dg/goacc/reduction.f95: Likewise. * gfortran.dg/goacc/routine-1.f90: Likewise. * gfortran.dg/goacc/routine-2.f90: Likewise. * gfortran.dg/goacc/sentinel-free-form.f95: Likewise. * gfortran.dg/goacc/several-directives.f95: Likewise. * gfortran.dg/goacc/sie.f95: Likewise. * gfortran.dg/goacc/subarrays.f95: Likewise. * gfortran.dg/gomp/map-1.f90: Likewise. * gfortran.dg/openacc-define-1.f90: Likewise. * gfortran.dg/openacc-define-2.f90: Likewise. * gfortran.dg/openacc-define-3.f90: Likewise. * g++.dg/gomp/block-1.C: Update for changed compiler output. * g++.dg/gomp/block-2.C: Likewise. * g++.dg/gomp/block-3.C: Likewise. * g++.dg/gomp/block-5.C: Likewise. * g++.dg/gomp/target-1.C: Likewise. * g++.dg/gomp/target-2.C: Likewise. * g++.dg/gomp/taskgroup-1.C: Likewise. * g++.dg/gomp/teams-1.C: Likewise. * gcc.dg/cilk-plus/jump-openmp.c: Likewise. * gcc.dg/cilk-plus/jump.c: Likewise. * gcc.dg/gomp/block-1.c: Likewise. * gcc.dg/gomp/block-10.c: Likewise. * gcc.dg/gomp/block-2.c: Likewise. * gcc.dg/gomp/block-3.c: Likewise. * gcc.dg/gomp/block-4.c: Likewise. * gcc.dg/gomp/block-5.c: Likewise. * gcc.dg/gomp/block-6.c: Likewise. * gcc.dg/gomp/block-7.c: Likewise. * gcc.dg/gomp/block-8.c: Likewise. * gcc.dg/gomp/block-9.c: Likewise. * gcc.dg/gomp/target-1.c: Likewise. * gcc.dg/gomp/target-2.c: Likewise. * gcc.dg/gomp/taskgroup-1.c: Likewise. * gcc.dg/gomp/teams-1.c: Likewise. include/ * gomp-constants.h: New file. libgomp/ * Makefile.am (search_path): Add $(top_srcdir)/../include. (libgomp_la_SOURCES): Add splay-tree.c, libgomp-plugin.c, oacc-parallel.c, oacc-host.c, oacc-init.c, oacc-mem.c, oacc-async.c, oacc-plugin.c, oacc-cuda.c. [USE_FORTRAN] (libgomp_la_SOURCES): Add openacc.f90. Include $(top_srcdir)/plugin/Makefrag.am. (nodist_libsubinclude_HEADERS): Add openacc.h. [USE_FORTRAN] (nodist_finclude_HEADERS): Add openacc_lib.h, openacc.f90, openacc.mod, openacc_kinds.mod. (omp_lib.mod): Generalize into... (%.mod): ... this new rule. (openacc_kinds.mod, openacc.mod): New rules. * plugin/configfrag.ac: New file. * configure.ac: Move plugin/offloading support into it. Include it. Instantiate testsuite/libgomp-test-support.pt.exp. * plugin/Makefrag.am: New file. * testsuite/Makefile.am (OFFLOAD_TARGETS) (OFFLOAD_ADDITIONAL_OPTIONS, OFFLOAD_ADDITIONAL_LIB_PATHS): Don't export. (libgomp-test-support.exp): New rule. (all-local): Depend on it. * Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. * config.h.in: Likewise. * configure: Likewise. * configure.tgt: Harden shell syntax. * env.c: Include "oacc-int.h". (parse_acc_device_type): New function. (gomp_debug_var, goacc_device_type, goacc_device_num): New variables. (initialize_env): Initialize those. Call goacc_runtime_initialize. * error.c (gomp_vdebug, gomp_debug, gomp_vfatal): New functions. (gomp_fatal): Call gomp_vfatal. * libgomp.h: Include "libgomp-plugin.h" and <stdarg.h>. (gomp_debug_var, goacc_device_type, goacc_device_num, gomp_vdebug) (gomp_debug, gomp_verror, gomp_vfatal, gomp_init_targets_once) (splay_tree_node, splay_tree, splay_tree_key) (struct target_mem_desc, struct splay_tree_key_s) (struct gomp_memory_mapping, struct acc_dispatch_t) (struct gomp_device_descr, gomp_acc_insert_pointer) (gomp_acc_remove_pointer, target_mem_desc, gomp_copy_from_async) (gomp_unmap_vars, gomp_init_device, gomp_init_tables) (gomp_free_memmap, gomp_fini_device): New declarations. (gomp_vdebug, gomp_debug): New macros. Include "splay-tree.h". * libgomp.map (OACC_2.0): New symbol version. Use for acc_get_num_devices, acc_get_num_devices_h_, acc_set_device_type, acc_set_device_type_h_, acc_get_device_type, acc_get_device_type_h_, acc_set_device_num, acc_set_device_num_h_, acc_get_device_num, acc_get_device_num_h_, acc_async_test, acc_async_test_h_, acc_async_test_all, acc_async_test_all_h_, acc_wait, acc_wait_h_, acc_wait_async, acc_wait_async_h_, acc_wait_all, acc_wait_all_h_, acc_wait_all_async, acc_wait_all_async_h_, acc_init, acc_init_h_, acc_shutdown, acc_shutdown_h_, acc_on_device, acc_on_device_h_, acc_malloc, acc_free, acc_copyin, acc_copyin_32_h_, acc_copyin_64_h_, acc_copyin_array_h_, acc_present_or_copyin, acc_present_or_copyin_32_h_, acc_present_or_copyin_64_h_, acc_present_or_copyin_array_h_, acc_create, acc_create_32_h_, acc_create_64_h_, acc_create_array_h_, acc_present_or_create, acc_present_or_create_32_h_, acc_present_or_create_64_h_, acc_present_or_create_array_h_, acc_copyout, acc_copyout_32_h_, acc_copyout_64_h_, acc_copyout_array_h_, acc_delete, acc_delete_32_h_, acc_delete_64_h_, acc_delete_array_h_, acc_update_device, acc_update_device_32_h_, acc_update_device_64_h_, acc_update_device_array_h_, acc_update_self, acc_update_self_32_h_, acc_update_self_64_h_, acc_update_self_array_h_, acc_map_data, acc_unmap_data, acc_deviceptr, acc_hostptr, acc_is_present, acc_is_present_32_h_, acc_is_present_64_h_, acc_is_present_array_h_, acc_memcpy_to_device, acc_memcpy_from_device, acc_get_current_cuda_device, acc_get_current_cuda_context, acc_get_cuda_stream, acc_set_cuda_stream. (GOACC_2.0): New symbol version. Use for GOACC_data_end, GOACC_data_start, GOACC_enter_exit_data, GOACC_parallel, GOACC_update, GOACC_wait, GOACC_get_thread_num, GOACC_get_num_threads. (GOMP_PLUGIN_1.0): New symbol version. Use for GOMP_PLUGIN_malloc, GOMP_PLUGIN_malloc_cleared, GOMP_PLUGIN_realloc, GOMP_PLUGIN_debug, GOMP_PLUGIN_error, GOMP_PLUGIN_fatal, GOMP_PLUGIN_async_unmap_vars, GOMP_PLUGIN_acc_thread. * libgomp.texi: Update for OpenACC changes, and GOMP_DEBUG environment variable. * libgomp_g.h (GOACC_data_start, GOACC_data_end) (GOACC_enter_exit_data, GOACC_parallel, GOACC_update, GOACC_wait) (GOACC_get_num_threads, GOACC_get_thread_num): New declarations. * splay-tree.h (splay_tree_lookup, splay_tree_insert) (splay_tree_remove): New declarations. (rotate_left, rotate_right, splay_tree_splay, splay_tree_insert) (splay_tree_remove, splay_tree_lookup): Move into... * splay-tree.c: ... this new file. * target.c: Include "oacc-plugin.h", "oacc-int.h", <assert.h>. (splay_tree_node, splay_tree, splay_tree_key) (struct target_mem_desc, struct splay_tree_key_s) (struct gomp_device_descr): Don't declare. (num_devices_openmp): New variable. (gomp_get_num_devices ): Use it. (gomp_init_targets_once): New function. (gomp_get_num_devices ): Use it. (get_kind, gomp_copy_from_async, gomp_free_memmap) (gomp_fini_device, gomp_register_image_for_device): New functions. (gomp_map_vars): Add devaddrs parameter. (gomp_update): Add mm parameter. (gomp_init_device): Move most of it into... (gomp_init_tables): ... this new function. (gomp_register_images_for_device): Remove function. (splay_compare, gomp_map_vars, gomp_unmap_vars, gomp_init_device): Make them hidden instead of static. (gomp_map_vars_existing, gomp_map_vars, gomp_unmap_vars) (gomp_update, gomp_init_device, GOMP_target, GOMP_target_data) (GOMP_target_end_data, GOMP_target_update) (gomp_load_plugin_for_device, gomp_target_init): Update for OpenACC changes. * oacc-async.c: New file. * oacc-cuda.c: Likewise. * oacc-host.c: Likewise. * oacc-init.c: Likewise. * oacc-int.h: Likewise. * oacc-mem.c: Likewise. * oacc-parallel.c: Likewise. * oacc-plugin.c: Likewise. * oacc-plugin.h: Likewise. * oacc-ptx.h: Likewise. * openacc.f90: Likewise. * openacc.h: Likewise. * openacc_lib.h: Likewise. * plugin/plugin-host.c: Likewise. * plugin/plugin-nvptx.c: Likewise. * libgomp-plugin.c: Likewise. * libgomp-plugin.h: Likewise. * libgomp_target.h: Remove file after merging content into the former file. Update all users. * testsuite/lib/libgomp.exp: Load libgomp-test-support.exp. (offload_targets_s, offload_targets_s_openacc): New variables. (check_effective_target_openacc_nvidia_accel_present) (check_effective_target_openacc_nvidia_accel_selected): New procedures. (libgomp_init): Update for OpenACC changes. * testsuite/libgomp-test-support.exp.in: New file. * testsuite/libgomp.oacc-c++/c++.exp: Likewise. * testsuite/libgomp.oacc-c/c.exp: Likewise. * testsuite/libgomp.oacc-fortran/fortran.exp: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/asyncwait-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/cache-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/clauses-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/clauses-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-6.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-7.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-8.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/deviceptr-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/if-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/kernels-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/kernels-empty.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-10.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-11.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-12.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-13.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-14.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-15.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-16.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-17.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-18.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-19.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-20.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-21.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-22.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-23.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-24.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-25.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-26.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-27.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-28.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-29.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-30.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-31.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-32.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-33.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-34.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-35.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-36.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-37.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-38.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-39.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-40.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-41.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-42.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-43.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-44.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-45.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-46.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-47.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-48.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-49.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-50.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-51.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-52.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-53.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-54.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-55.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-56.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-57.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-58.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-59.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-6.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-60.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-61.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-62.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-63.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-64.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-65.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-66.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-67.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-68.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-69.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-7.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-70.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-71.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-72.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-73.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-74.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-75.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-76.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-77.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-78.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-79.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-80.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-81.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-82.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-83.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-84.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-85.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-86.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-87.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-88.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-89.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-9.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-90.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-91.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-92.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/nested-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/nested-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/offset-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/parallel-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/parallel-empty.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/pointer-align-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/present-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/present-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-initial-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/subr.h: Likewise. * testsuite/libgomp.oacc-c-c++-common/subr.ptx: Likewise. * testsuite/libgomp.oacc-c-c++-common/timer.h: Likewise. * testsuite/libgomp.oacc-c-c++-common/update-1-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/update-1.c: Likewise. * testsuite/libgomp.oacc-fortran/abort-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/abort-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-7.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-8.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-4-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-already-1.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-2.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-3.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-4.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-5.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-6.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-7.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-8.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-10.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-2.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-3.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-7.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-8.f90: Likewise. * testsuite/libgomp.oacc-fortran/map-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/openacc_version-1.f: Likewise. * testsuite/libgomp.oacc-fortran/openacc_version-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/pointer-align-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/pset-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/subarrays-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/subarrays-2.f90: Likewise. liboffloadmic/ * plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_get_name) (GOMP_OFFLOAD_get_caps, GOMP_OFFLOAD_fini_device): New functions. Co-Authored-By: Bernd Schmidt <bernds@codesourcery.com> Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com> Co-Authored-By: Dmitry Bocharnikov <dmitry.b@samsung.com> Co-Authored-By: Evgeny Gavrin <e.gavrin@samsung.com> Co-Authored-By: Ilmir Usmanov <i.usmanov@samsung.com> Co-Authored-By: Jakub Jelinek <jakub@redhat.com> Co-Authored-By: James Norris <jnorris@codesourcery.com> Co-Authored-By: Julian Brown <julian@codesourcery.com> Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> Co-Authored-By: Tom de Vries <tom@codesourcery.com> From-SVN: r219682
2015-01-15 21:11:12 +01:00
* GOMP_DEBUG:: Enable debugging output
* GOMP_STACKSIZE:: Set default thread stack size
target.c: New file. 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: Richard Henderson <rth@redhat.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> From-SVN: r203408
2013-10-11 11:26:50 +02:00
* GOMP_SPINCOUNT:: Set the busy-wait spin count
@end menu
@node OMP_CANCELLATION
@section @env{OMP_CANCELLATION} -- Set whether cancellation is activated
@cindex Environment Variable
@table @asis
@item @emph{Description}:
If set to @code{TRUE}, the cancellation is activated. If set to @code{FALSE} or
if unset, cancellation is disabled and the @code{cancel} construct is ignored.
@item @emph{See also}:
@ref{omp_get_cancellation}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.11
@end table
@node OMP_DISPLAY_ENV
@section @env{OMP_DISPLAY_ENV} -- Show OpenMP version and environment variables
@cindex Environment Variable
@table @asis
@item @emph{Description}:
If set to @code{TRUE}, the OpenMP version number and the values
associated with the OpenMP environment variables are printed to @code{stderr}.
If set to @code{VERBOSE}, it additionally shows the value of the environment
variables which are GNU extensions. If undefined or set to @code{FALSE},
this information will not be shown.
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.12
@end table
@node OMP_DEFAULT_DEVICE
@section @env{OMP_DEFAULT_DEVICE} -- Set the device used in target regions
@cindex Environment Variable
@table @asis
@item @emph{Description}:
Set to choose the device which is used in a @code{target} region, unless the
value is overridden by @code{omp_set_default_device} or by a @code{device}
clause. The value shall be the nonnegative device number. If no device with
the given device number exists, the code is executed on the host. If unset,
device number 0 will be used.
@item @emph{See also}:
@ref{omp_get_default_device}, @ref{omp_set_default_device},
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.11
@end table
@node OMP_DYNAMIC
@section @env{OMP_DYNAMIC} -- Dynamic adjustment of threads
@cindex Environment Variable
@table @asis
@item @emph{Description}:
Enable or disable the dynamic adjustment of the number of threads
within a team. The value of this environment variable shall be
@code{TRUE} or @code{FALSE}. If undefined, dynamic adjustment is
disabled by default.
@item @emph{See also}:
@ref{omp_set_dynamic}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.3
@end table
@node OMP_MAX_ACTIVE_LEVELS
@section @env{OMP_MAX_ACTIVE_LEVELS} -- Set the maximum number of nested parallel regions
@cindex Environment Variable
@table @asis
@item @emph{Description}:
Specifies the initial value for the maximum number of nested parallel
regions. The value of this variable shall be a positive integer.
If undefined, the number of active levels is unlimited.
@item @emph{See also}:
@ref{omp_set_max_active_levels}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.9
@end table
@node OMP_NESTED
@section @env{OMP_NESTED} -- Nested parallel regions
@cindex Environment Variable
@cindex Implementation specific setting
@table @asis
@item @emph{Description}:
Enable or disable nested parallel regions, i.e., whether team members
are allowed to create new teams. The value of this environment variable
shall be @code{TRUE} or @code{FALSE}. If undefined, nested parallel
regions are disabled by default.
@item @emph{See also}:
@ref{omp_set_nested}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.6
@end table
@node OMP_NUM_THREADS
@section @env{OMP_NUM_THREADS} -- Specifies the number of threads to use
@cindex Environment Variable
@cindex Implementation specific setting
@table @asis
@item @emph{Description}:
Specifies the default number of threads to use in parallel regions. The
backport: re PR fortran/46752 (OpenMP - Seg fault for unallocated allocatable array in firstprivate clause) Merge from gomp-3_1-branch branch: 2011-08-02 Jakub Jelinek <jakub@redhat.com> gcc/ * c-parser.c (enum c_parser_prec): New enum, moved from within c_parser_binary_expression. (c_parser_binary_expression): Add PREC argument. Stop parsing if operator has lower or equal precedence than PREC. (c_parser_conditional_expression, c_parser_omp_for_loop): Adjust callers. (c_parser_omp_atomic): Handle parsing OpenMP 3.1 atomics. Adjust c_finish_omp_atomic caller. (c_parser_omp_taskyield): New function. (c_parser_pragma): Handle PRAGMA_OMP_TASKYIELD. (c_parser_omp_clause_name): Handle final and mergeable clauses. (c_parser_omp_clause_final, c_parser_omp_clause_mergeable): New functions. (c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. (OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses. (c_parser_omp_clause_reduction): Handle min and max. * c-typeck.c (c_finish_omp_clauses): Don't complain about const qualified predetermined vars in firstprivate clause. andle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. Handle MIN_EXPR and MAX_EXPR. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (dump_generic_node): Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW. * tree.c (omp_clause_num_ops): Add OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (omp_clause_code_name): Likewise. (walk_tree_1): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * tree.h (enum omp_clause_code): Add OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (OMP_CLAUSE_FINAL_EXPR): Define. * omp-low.c (scan_sharing_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (expand_task_call): Likewise. (expand_omp_atomic_load, expand_omp_atomic_store): New functions. (expand_omp_atomic_fetch_op): Handle cases where old or new value is needed afterwards. (expand_omp_atomic): Call expand_omp_atomic_load resp. expand_omp_atomic_store. * gimplify.c (gimplify_omp_atomic, gimplify_expr): Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * tree-nested.c (convert_nonlocal_omp_clauses, convert_local_omp_clauses): Likewise. * tree.def (OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD, OMP_ATOMIC_CAPTURE_NEW): New. * gimple.h (GF_OMP_ATOMIC_NEED_VALUE): New. (gimple_omp_atomic_need_value_p, gimple_omp_atomic_set_need_value): New inlines. * omp-builtins.def (BUILT_IN_GOMP_TASKYIELD): New builtin. * doc/generic.texi: Mention OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. gcc/c-family/ * c-common.h (c_finish_omp_atomic): Adjust prototype. (c_finish_omp_taskyield): New prototype. * c-omp.c (c_finish_omp_atomic): Add OPCODE, V, LHS1 and RHS1 arguments. Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW in addition to OMP_ATOMIC. If LHS1 or RHS1 have side-effects, evaluate those too in the right spot, if it is a decl and LHS is also a decl, error out if they aren't the same. (c_finish_omp_taskyield): New function. * c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP to 201107. * c-pragma.c (omp_pragmas): Add taskyield. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_TASKYIELD. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. gcc/cp/ * cp-tree.h (finish_omp_atomic): Adjust prototype. (cxx_omp_const_qual_no_mutable): New prototype. (finish_omp_taskyield): New prototype. * parser.c (cp_parser_omp_atomic): (cp_parser_omp_atomic): Handle parsing OpenMP 3.1 atomics. Adjust finish_omp_atomic caller. (cp_parser_omp_clause_name): Handle final and mergeable clauses. (cp_parser_omp_clause_final, cp_parser_omp_clause_mergeable): New functions. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. (OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses. (cp_parser_omp_taskyield): New function. (cp_parser_pragma): Handle PRAGMA_OMP_TASKYIELD. (cp_parser_omp_clause_reduction): Handle min and max. * pt.c (tsubst_expr) <case OMP_ATOMIC>: Handle OpenMP 3.1 atomics. (tsubst_omp_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * semantics.c (finish_omp_atomic): Add OPCODE, V, LHS1 and RHS1 arguments. Handle OpenMP 3.1 atomics. Adjust c_finish_omp_atomic caller. (finish_omp_clauses): Don't complain about const qualified predetermined vars and static data members in firstprivate clause. Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. Handle MIN_EXPR and MAX_EXPR. (finish_omp_taskyield): New function. * cp-gimplify.c (cxx_omp_const_qual_no_mutable): New function. (cxx_omp_predetermined_sharing): Use it. gcc/fortran/ PR fortran/46752 * cpp.c (cpp_define_builtins): Change _OPENMP to 201107. * openmp.c (gfc_free_omp_clauses): Free also final_expr. (OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE): Define. (gfc_match_omp_clauses): Handle parsing final and mergeable clauses. (OMP_TASK_CLAUSES): Allow final and mergeable clauses. (gfc_match_omp_taskyield): New function. (resolve_omp_clauses): Resolve final clause. Allow POINTERs and Cray pointers in clauses other than REDUCTION. (gfc_match_omp_atomic): Match optional read/write/update/capture keywords after !$omp atomic. (resolve_omp_atomic): Handle all OpenMP 3.1 atomic forms. * dump-parse-tree.c (show_omp_node): Handle EXEC_OMP_TASKYIELD, print final and mergeable clauses. (show_code_node): Handle EXEC_OMP_TASKYIELD. * trans-openmp.c (gfc_trans_omp_clauses): Handle final and mergeable clauses. (gfc_trans_omp_taskyield): New function. (gfc_trans_omp_directive): Handle EXEC_OMP_TASKYIELD. (gfc_trans_omp_atomic): Handle all OpenMP 3.1 atomic forms. (gfc_omp_clause_copy_ctor): Handle non-allocated allocatable. (gfc_omp_predetermined_sharing): Adjust comment. * gfortran.h (gfc_statement): Add ST_OMP_TASKYIELD and ST_OMP_END_ATOMIC. (gfc_omp_clauses): Add final_expr and mergeable fields. (gfc_exec_op): Add EXEC_OMP_TASKYIELD. (gfc_omp_atomic_op): New enum typedef. (struct gfc_code): Add ext.omp_atomic. * trans.c (trans_code): Handle EXEC_OMP_TASKYIELD. * frontend-passes.c (gfc_code_walker): Also walk final_expr. * resolve.c (gfc_resolve_blocks, resolve_code): Handle EXEC_OMP_TASKYIELD. * st.c (gfc_free_statement): Likewise. * match.h (gfc_match_omp_taskyield): New prototype. * parse.c (decode_omp_directive): Handle taskyield directive. Handle !$omp end atomic. (case_executable): Add ST_OMP_TASKYIELD case. (gfc_ascii_statement): Handle ST_OMP_TASKYIELD. (parse_omp_atomic): Return gfc_statement instead of void. For !$omp atomic capture parse two assignments instead of just one and require !$omp end atomic afterwards, for other !$omp atomic forms just allow !$omp end atomic at the end. (parse_omp_structured_block, parse_executable): Adjust parse_omp_atomic callers. 2011-08-02 Tobias Burnus <burnus@net-b.de> * intrinsic.c (OMP_LIB): Updated openmp_version's value to 201107. * gfortran.texi (OpenMP): Update ref to OpenMP 3.1. * intrinsic.texi (OpenMP Modules): Update ref to OpenMP 3.1; remove deleted omp_integer_kind and omp_logical_kind constants. gcc/testsuite/ PR fortran/46752 * gcc.dg/gomp/atomic-5.c: Adjust expected diagnostics. * gcc.dg/gomp/atomic-15.c: New test. * g++.dg/gomp/atomic-5.C: Adjust expected diagnostics. * g++.dg/gomp/atomic-15.C: New test. * g++.dg/gomp/private-1.C: New test. * g++.dg/gomp/sharing-2.C: New test. * gfortran.dg/gomp/crayptr1.f90: Don't expect error about Cray pointer in FIRSTPRIVATE/LASTPRIVATE. * gfortran.dg/gomp/omp_atomic2.f90: New test. libgomp/ PR fortran/42041 PR fortran/46752 * omp.h.in (omp_in_final): New prototype. * omp_lib.f90.in (omp_in_final): New interface. (omp_integer_kind, omp_logical_kind): Remove and replace all its uses in the module with 4. (openmp_version): Change to 201107. * omp_lib.h.in (omp_sched_static, omp_sched_dynamic, omp_sched_guided, omp_sched_auto): Use omp_sched_kind kind for the parameters. (omp_in_final): New external. (openmp_version): Change to 201107. * task.c (omp_in_final): New function. (gomp_init_task): Initialize final_task. (GOMP_task): Remove unused attribute from flags. Handle final tasks. (GOMP_taskyield): New function. (omp_in_final): Return true if if (false) or final (true) task or descendant of final (true). * fortran.c (omp_in_final_): New function. * libgomp.map (OMP_3.1): Export omp_in_final and omp_in_final_. (GOMP_3.0): Export GOMP_taskyield. * env.c (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New variables. (parse_unsigned_long_list): New function. (initialize_env): Use it for OMP_NUM_THREADS. Call parse_boolean with "OMP_PROC_BIND". If OMP_PROC_BIND=true, call gomp_init_affinity even if parse_affinity returned false. * config/linux/affinity.c (gomp_init_affinity): Handle gomp_cpu_affinity_len == 0. * libgomp_g.h (GOMP_taskyield): New prototype. * libgomp.h (struct gomp_task): Add final_task field. (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New externs. * team.c (gomp_team_start): Override new task's nthreads_var icv if list form OMP_NUM_THREADS has been used and it has value for the new nesting level. * 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/reduction-6.c: New test. * testsuite/libgomp.c/task-5.c: New test. * testsuite/libgomp.c++/atomic-2.C: New test. * testsuite/libgomp.c++/atomic-3.C: New test. * testsuite/libgomp.c++/atomic-4.C: New test. * testsuite/libgomp.c++/atomic-5.C: New test. * testsuite/libgomp.c++/atomic-6.C: New test. * testsuite/libgomp.c++/atomic-7.C: New test. * testsuite/libgomp.c++/atomic-8.C: New test. * testsuite/libgomp.c++/atomic-9.C: New test. * testsuite/libgomp.c++/task-8.C: New test. * testsuite/libgomp.c++/reduction-4.C: New test. * testsuite/libgomp.fortran/allocatable7.f90: New test. * testsuite/libgomp.fortran/allocatable8.f90: New test. * testsuite/libgomp.fortran/crayptr3.f90: New test. * testsuite/libgomp.fortran/omp_atomic3.f90: New test. * testsuite/libgomp.fortran/omp_atomic4.f90: New test. * testsuite/libgomp.fortran/pointer1.f90: New test. * testsuite/libgomp.fortran/pointer2.f90: New test. * testsuite/libgomp.fortran/task4.f90: New test. 2011-08-02 Tobias Burnus <burnus@net-b.de> * libgomp.texi: Update OpenMP spec references to 3.1. (omp_in_final,OMP_PROC_BIND): New sections. (OMP_NUM_THREADS): Document that the value can be now a list. (GOMP_STACKSIZE,GOMP_CPU_AFFINITY): Update @ref. From-SVN: r177194
2011-08-02 18:13:29 +02:00
value of this variable shall be a comma-separated list of positive integers;
the value specified the number of threads to use for the corresponding nested
level. If undefined one thread per CPU is used.
@item @emph{See also}:
@ref{omp_set_num_threads}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.2
@end table
@node OMP_PROC_BIND
@section @env{OMP_PROC_BIND} -- Whether theads may be moved between CPUs
@cindex Environment Variable
@table @asis
@item @emph{Description}:
Specifies whether threads may be moved between processors. If set to
@code{TRUE}, OpenMP theads should not be moved; if set to @code{FALSE}
they may be moved. Alternatively, a comma separated list with the
values @code{MASTER}, @code{CLOSE} and @code{SPREAD} can be used to specify
the thread affinity policy for the corresponding nesting level. With
@code{MASTER} the worker threads are in the same place partition as the
master thread. With @code{CLOSE} those are kept close to the master thread
in contiguous place partitions. And with @code{SPREAD} a sparse distribution
across the place partitions is used.
When undefined, @env{OMP_PROC_BIND} defaults to @code{TRUE} when
@env{OMP_PLACES} or @env{GOMP_CPU_AFFINITY} is set and @code{FALSE} otherwise.
@item @emph{See also}:
@ref{OMP_PLACES}, @ref{GOMP_CPU_AFFINITY}, @ref{omp_get_proc_bind}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.4
@end table
@node OMP_PLACES
@section @env{OMP_PLACES} -- Specifies on which CPUs the theads should be placed
@cindex Environment Variable
@table @asis
@item @emph{Description}:
The thread placement can be either specified using an abstract name or by an
explicit list of the places. The abstract names @code{threads}, @code{cores}
and @code{sockets} can be optionally followed by a positive number in
parentheses, which denotes the how many places shall be created. With
@code{threads} each place corresponds to a single hardware thread; @code{cores}
to a single core with the corresponding number of hardware threads; and with
@code{sockets} the place corresponds to a single socket. The resulting
placement can be shown by setting the @env{OMP_DISPLAY_ENV} environment
variable.
Alternatively, the placement can be specified explicitly as comma-separated
list of places. A place is specified by set of nonnegative numbers in curly
braces, denoting the denoting the hardware threads. The hardware threads
belonging to a place can either be specified as comma-separated list of
nonnegative thread numbers or using an interval. Multiple places can also be
either specified by a comma-separated list of places or by an interval. To
specify an interval, a colon followed by the count is placed after after
the hardware thread number or the place. Optionally, the length can be
followed by a colon and the stride number -- otherwise a unit stride is
assumed. For instance, the following specifies the same places list:
@code{"@{0,1,2@}, @{3,4,6@}, @{7,8,9@}, @{10,11,12@}"};
@code{"@{0:3@}, @{3:3@}, @{7:3@}, @{10:3@}"}; and @code{"@{0:2@}:4:3"}.
If @env{OMP_PLACES} and @env{GOMP_CPU_AFFINITY} are unset and
@env{OMP_PROC_BIND} is either unset or @code{false}, threads may be moved
between CPUs following no placement policy.
@item @emph{See also}:
@ref{OMP_PROC_BIND}, @ref{GOMP_CPU_AFFINITY}, @ref{omp_get_proc_bind},
@ref{OMP_DISPLAY_ENV}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.5
@end table
@node OMP_STACKSIZE
@section @env{OMP_STACKSIZE} -- Set default thread stack size
@cindex Environment Variable
@table @asis
@item @emph{Description}:
Set the default thread stack size in kilobytes, unless the number
is suffixed by @code{B}, @code{K}, @code{M} or @code{G}, in which
case the size is, respectively, in bytes, kilobytes, megabytes
or gigabytes. This is different from @code{pthread_attr_setstacksize}
which gets the number of bytes as an argument. If the stack size cannot
be set due to system constraints, an error is reported and the initial
stack size is left unchanged. If undefined, the stack size is system
dependent.
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.7
@end table
@node OMP_SCHEDULE
@section @env{OMP_SCHEDULE} -- How threads are scheduled
@cindex Environment Variable
@cindex Implementation specific setting
@table @asis
@item @emph{Description}:
Allows to specify @code{schedule type} and @code{chunk size}.
The value of the variable shall have the form: @code{type[,chunk]} where
@code{type} is one of @code{static}, @code{dynamic}, @code{guided} or @code{auto}
The optional @code{chunk} size shall be a positive integer. If undefined,
dynamic scheduling and a chunk size of 1 is used.
@item @emph{See also}:
@ref{omp_set_schedule}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Sections 2.7.1 and 4.1
@end table
@node OMP_THREAD_LIMIT
@section @env{OMP_THREAD_LIMIT} -- Set the maximum number of threads
@cindex Environment Variable
@table @asis
@item @emph{Description}:
Specifies the number of threads to use for the whole program. The
value of this variable shall be a positive integer. If undefined,
the number of threads is not limited.
@item @emph{See also}:
@ref{OMP_NUM_THREADS}, @ref{omp_get_thread_limit}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.10
@end table
@node OMP_WAIT_POLICY
@section @env{OMP_WAIT_POLICY} -- How waiting threads are handled
@cindex Environment Variable
@table @asis
@item @emph{Description}:
Specifies whether waiting threads should be active or passive. If
the value is @code{PASSIVE}, waiting threads should not consume CPU
power while waiting; while the value is @code{ACTIVE} specifies that
they should. If undefined, threads wait actively for a short time
target.c: New file. 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: Richard Henderson <rth@redhat.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> From-SVN: r203408
2013-10-11 11:26:50 +02:00
before waiting passively.
@item @emph{See also}:
@ref{GOMP_SPINCOUNT}
@item @emph{Reference}:
@uref{http://www.openmp.org/, OpenMP specification v4.0}, Section 4.8
@end table
@node GOMP_CPU_AFFINITY
@section @env{GOMP_CPU_AFFINITY} -- Bind threads to specific CPUs
@cindex Environment Variable
@table @asis
@item @emph{Description}:
Binds threads to specific CPUs. The variable should contain a space-separated
or comma-separated list of CPUs. This list may contain different kinds of
entries: either single CPU numbers in any order, a range of CPUs (M-N)
or a range with some stride (M-N:S). CPU numbers are zero based. For example,
@code{GOMP_CPU_AFFINITY="0 3 1-2 4-15:2"} will bind the initial thread
to CPU 0, the second to CPU 3, the third to CPU 1, the fourth to
CPU 2, the fifth to CPU 4, the sixth through tenth to CPUs 6, 8, 10, 12,
and 14 respectively and then start assigning back from the beginning of
the list. @code{GOMP_CPU_AFFINITY=0} binds all threads to CPU 0.
There is no libgomp library routine to determine whether a CPU affinity
specification is in effect. As a workaround, language-specific library
functions, e.g., @code{getenv} in C or @code{GET_ENVIRONMENT_VARIABLE} in
Fortran, may be used to query the setting of the @code{GOMP_CPU_AFFINITY}
environment variable. A defined CPU affinity on startup cannot be changed
or disabled during the runtime of the application.
If both @env{GOMP_CPU_AFFINITY} and @env{OMP_PROC_BIND} are set,
@env{OMP_PROC_BIND} has a higher precedence. If neither has been set and
@env{OMP_PROC_BIND} is unset, or when @env{OMP_PROC_BIND} is set to
@code{FALSE}, the host system will handle the assignment of threads to CPUs.
backport: re PR fortran/46752 (OpenMP - Seg fault for unallocated allocatable array in firstprivate clause) Merge from gomp-3_1-branch branch: 2011-08-02 Jakub Jelinek <jakub@redhat.com> gcc/ * c-parser.c (enum c_parser_prec): New enum, moved from within c_parser_binary_expression. (c_parser_binary_expression): Add PREC argument. Stop parsing if operator has lower or equal precedence than PREC. (c_parser_conditional_expression, c_parser_omp_for_loop): Adjust callers. (c_parser_omp_atomic): Handle parsing OpenMP 3.1 atomics. Adjust c_finish_omp_atomic caller. (c_parser_omp_taskyield): New function. (c_parser_pragma): Handle PRAGMA_OMP_TASKYIELD. (c_parser_omp_clause_name): Handle final and mergeable clauses. (c_parser_omp_clause_final, c_parser_omp_clause_mergeable): New functions. (c_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. (OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses. (c_parser_omp_clause_reduction): Handle min and max. * c-typeck.c (c_finish_omp_clauses): Don't complain about const qualified predetermined vars in firstprivate clause. andle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. Handle MIN_EXPR and MAX_EXPR. * tree-pretty-print.c (dump_omp_clause): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (dump_generic_node): Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW. * tree.c (omp_clause_num_ops): Add OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (omp_clause_code_name): Likewise. (walk_tree_1): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * tree.h (enum omp_clause_code): Add OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (OMP_CLAUSE_FINAL_EXPR): Define. * omp-low.c (scan_sharing_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. (expand_task_call): Likewise. (expand_omp_atomic_load, expand_omp_atomic_store): New functions. (expand_omp_atomic_fetch_op): Handle cases where old or new value is needed afterwards. (expand_omp_atomic): Call expand_omp_atomic_load resp. expand_omp_atomic_store. * gimplify.c (gimplify_omp_atomic, gimplify_expr): Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * tree-nested.c (convert_nonlocal_omp_clauses, convert_local_omp_clauses): Likewise. * tree.def (OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD, OMP_ATOMIC_CAPTURE_NEW): New. * gimple.h (GF_OMP_ATOMIC_NEED_VALUE): New. (gimple_omp_atomic_need_value_p, gimple_omp_atomic_set_need_value): New inlines. * omp-builtins.def (BUILT_IN_GOMP_TASKYIELD): New builtin. * doc/generic.texi: Mention OMP_CLAUSE_COLLAPSE, OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. gcc/c-family/ * c-common.h (c_finish_omp_atomic): Adjust prototype. (c_finish_omp_taskyield): New prototype. * c-omp.c (c_finish_omp_atomic): Add OPCODE, V, LHS1 and RHS1 arguments. Handle OMP_ATOMIC_READ, OMP_ATOMIC_CAPTURE_OLD and OMP_ATOMIC_CAPTURE_NEW in addition to OMP_ATOMIC. If LHS1 or RHS1 have side-effects, evaluate those too in the right spot, if it is a decl and LHS is also a decl, error out if they aren't the same. (c_finish_omp_taskyield): New function. * c-cppbuiltin.c (c_cpp_builtins): Change _OPENMP to 201107. * c-pragma.c (omp_pragmas): Add taskyield. * c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_TASKYIELD. (enum pragma_omp_clause): Add PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. gcc/cp/ * cp-tree.h (finish_omp_atomic): Adjust prototype. (cxx_omp_const_qual_no_mutable): New prototype. (finish_omp_taskyield): New prototype. * parser.c (cp_parser_omp_atomic): (cp_parser_omp_atomic): Handle parsing OpenMP 3.1 atomics. Adjust finish_omp_atomic caller. (cp_parser_omp_clause_name): Handle final and mergeable clauses. (cp_parser_omp_clause_final, cp_parser_omp_clause_mergeable): New functions. (cp_parser_omp_all_clauses): Handle PRAGMA_OMP_CLAUSE_FINAL and PRAGMA_OMP_CLAUSE_MERGEABLE. (OMP_TASK_CLAUSE_MASK): Allow final and mergeable clauses. (cp_parser_omp_taskyield): New function. (cp_parser_pragma): Handle PRAGMA_OMP_TASKYIELD. (cp_parser_omp_clause_reduction): Handle min and max. * pt.c (tsubst_expr) <case OMP_ATOMIC>: Handle OpenMP 3.1 atomics. (tsubst_omp_clauses): Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. * semantics.c (finish_omp_atomic): Add OPCODE, V, LHS1 and RHS1 arguments. Handle OpenMP 3.1 atomics. Adjust c_finish_omp_atomic caller. (finish_omp_clauses): Don't complain about const qualified predetermined vars and static data members in firstprivate clause. Handle OMP_CLAUSE_FINAL and OMP_CLAUSE_MERGEABLE. Handle MIN_EXPR and MAX_EXPR. (finish_omp_taskyield): New function. * cp-gimplify.c (cxx_omp_const_qual_no_mutable): New function. (cxx_omp_predetermined_sharing): Use it. gcc/fortran/ PR fortran/46752 * cpp.c (cpp_define_builtins): Change _OPENMP to 201107. * openmp.c (gfc_free_omp_clauses): Free also final_expr. (OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE): Define. (gfc_match_omp_clauses): Handle parsing final and mergeable clauses. (OMP_TASK_CLAUSES): Allow final and mergeable clauses. (gfc_match_omp_taskyield): New function. (resolve_omp_clauses): Resolve final clause. Allow POINTERs and Cray pointers in clauses other than REDUCTION. (gfc_match_omp_atomic): Match optional read/write/update/capture keywords after !$omp atomic. (resolve_omp_atomic): Handle all OpenMP 3.1 atomic forms. * dump-parse-tree.c (show_omp_node): Handle EXEC_OMP_TASKYIELD, print final and mergeable clauses. (show_code_node): Handle EXEC_OMP_TASKYIELD. * trans-openmp.c (gfc_trans_omp_clauses): Handle final and mergeable clauses. (gfc_trans_omp_taskyield): New function. (gfc_trans_omp_directive): Handle EXEC_OMP_TASKYIELD. (gfc_trans_omp_atomic): Handle all OpenMP 3.1 atomic forms. (gfc_omp_clause_copy_ctor): Handle non-allocated allocatable. (gfc_omp_predetermined_sharing): Adjust comment. * gfortran.h (gfc_statement): Add ST_OMP_TASKYIELD and ST_OMP_END_ATOMIC. (gfc_omp_clauses): Add final_expr and mergeable fields. (gfc_exec_op): Add EXEC_OMP_TASKYIELD. (gfc_omp_atomic_op): New enum typedef. (struct gfc_code): Add ext.omp_atomic. * trans.c (trans_code): Handle EXEC_OMP_TASKYIELD. * frontend-passes.c (gfc_code_walker): Also walk final_expr. * resolve.c (gfc_resolve_blocks, resolve_code): Handle EXEC_OMP_TASKYIELD. * st.c (gfc_free_statement): Likewise. * match.h (gfc_match_omp_taskyield): New prototype. * parse.c (decode_omp_directive): Handle taskyield directive. Handle !$omp end atomic. (case_executable): Add ST_OMP_TASKYIELD case. (gfc_ascii_statement): Handle ST_OMP_TASKYIELD. (parse_omp_atomic): Return gfc_statement instead of void. For !$omp atomic capture parse two assignments instead of just one and require !$omp end atomic afterwards, for other !$omp atomic forms just allow !$omp end atomic at the end. (parse_omp_structured_block, parse_executable): Adjust parse_omp_atomic callers. 2011-08-02 Tobias Burnus <burnus@net-b.de> * intrinsic.c (OMP_LIB): Updated openmp_version's value to 201107. * gfortran.texi (OpenMP): Update ref to OpenMP 3.1. * intrinsic.texi (OpenMP Modules): Update ref to OpenMP 3.1; remove deleted omp_integer_kind and omp_logical_kind constants. gcc/testsuite/ PR fortran/46752 * gcc.dg/gomp/atomic-5.c: Adjust expected diagnostics. * gcc.dg/gomp/atomic-15.c: New test. * g++.dg/gomp/atomic-5.C: Adjust expected diagnostics. * g++.dg/gomp/atomic-15.C: New test. * g++.dg/gomp/private-1.C: New test. * g++.dg/gomp/sharing-2.C: New test. * gfortran.dg/gomp/crayptr1.f90: Don't expect error about Cray pointer in FIRSTPRIVATE/LASTPRIVATE. * gfortran.dg/gomp/omp_atomic2.f90: New test. libgomp/ PR fortran/42041 PR fortran/46752 * omp.h.in (omp_in_final): New prototype. * omp_lib.f90.in (omp_in_final): New interface. (omp_integer_kind, omp_logical_kind): Remove and replace all its uses in the module with 4. (openmp_version): Change to 201107. * omp_lib.h.in (omp_sched_static, omp_sched_dynamic, omp_sched_guided, omp_sched_auto): Use omp_sched_kind kind for the parameters. (omp_in_final): New external. (openmp_version): Change to 201107. * task.c (omp_in_final): New function. (gomp_init_task): Initialize final_task. (GOMP_task): Remove unused attribute from flags. Handle final tasks. (GOMP_taskyield): New function. (omp_in_final): Return true if if (false) or final (true) task or descendant of final (true). * fortran.c (omp_in_final_): New function. * libgomp.map (OMP_3.1): Export omp_in_final and omp_in_final_. (GOMP_3.0): Export GOMP_taskyield. * env.c (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New variables. (parse_unsigned_long_list): New function. (initialize_env): Use it for OMP_NUM_THREADS. Call parse_boolean with "OMP_PROC_BIND". If OMP_PROC_BIND=true, call gomp_init_affinity even if parse_affinity returned false. * config/linux/affinity.c (gomp_init_affinity): Handle gomp_cpu_affinity_len == 0. * libgomp_g.h (GOMP_taskyield): New prototype. * libgomp.h (struct gomp_task): Add final_task field. (gomp_nthreads_var_list, gomp_nthreads_var_list_len): New externs. * team.c (gomp_team_start): Override new task's nthreads_var icv if list form OMP_NUM_THREADS has been used and it has value for the new nesting level. * 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/reduction-6.c: New test. * testsuite/libgomp.c/task-5.c: New test. * testsuite/libgomp.c++/atomic-2.C: New test. * testsuite/libgomp.c++/atomic-3.C: New test. * testsuite/libgomp.c++/atomic-4.C: New test. * testsuite/libgomp.c++/atomic-5.C: New test. * testsuite/libgomp.c++/atomic-6.C: New test. * testsuite/libgomp.c++/atomic-7.C: New test. * testsuite/libgomp.c++/atomic-8.C: New test. * testsuite/libgomp.c++/atomic-9.C: New test. * testsuite/libgomp.c++/task-8.C: New test. * testsuite/libgomp.c++/reduction-4.C: New test. * testsuite/libgomp.fortran/allocatable7.f90: New test. * testsuite/libgomp.fortran/allocatable8.f90: New test. * testsuite/libgomp.fortran/crayptr3.f90: New test. * testsuite/libgomp.fortran/omp_atomic3.f90: New test. * testsuite/libgomp.fortran/omp_atomic4.f90: New test. * testsuite/libgomp.fortran/pointer1.f90: New test. * testsuite/libgomp.fortran/pointer2.f90: New test. * testsuite/libgomp.fortran/task4.f90: New test. 2011-08-02 Tobias Burnus <burnus@net-b.de> * libgomp.texi: Update OpenMP spec references to 3.1. (omp_in_final,OMP_PROC_BIND): New sections. (OMP_NUM_THREADS): Document that the value can be now a list. (GOMP_STACKSIZE,GOMP_CPU_AFFINITY): Update @ref. From-SVN: r177194
2011-08-02 18:13:29 +02:00
@item @emph{See also}:
@ref{OMP_PLACES}, @ref{OMP_PROC_BIND}
@end table
Merge current set of OpenACC changes from gomp-4_0-branch. contrib/ * gcc_update (files_and_dependencies): Update rules for new libgomp/plugin/Makefrag.am and libgomp/plugin/configfrag.ac files. gcc/ * builtin-types.def (BT_FN_VOID_INT_INT_VAR) (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR) (BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR): New function types. * builtins.c: Include "gomp-constants.h". (expand_builtin_acc_on_device): New function. (expand_builtin, is_inexpensive_builtin): Handle BUILT_IN_ACC_ON_DEVICE. * builtins.def (DEF_GOACC_BUILTIN, DEF_GOACC_BUILTIN_COMPILER): New macros. * cgraph.c (cgraph_node::create): Consider flag_openacc next to flag_openmp. * config.gcc <nvptx-*> (tm_file): Add nvptx/offload.h. <*-intelmic-* | *-intelmicemul-*> (tm_file): Add i386/intelmic-offload.h. * gcc.c (LINK_COMMAND_SPEC, GOMP_SELF_SPECS): For -fopenacc, link to libgomp and its dependencies. * config/arc/arc.h (LINK_COMMAND_SPEC): Likewise. * config/darwin.h (LINK_COMMAND_SPEC_A): Likewise. * config/i386/mingw32.h (GOMP_SELF_SPECS): Likewise. * config/ia64/hpux.h (LIB_SPEC): Likewise. * config/pa/pa-hpux11.h (LIB_SPEC): Likewise. * config/pa/pa64-hpux.h (LIB_SPEC): Likewise. * doc/generic.texi: Update for OpenACC changes. * doc/gimple.texi: Likewise. * doc/invoke.texi: Likewise. * doc/sourcebuild.texi: Likewise. * gimple-pretty-print.c (dump_gimple_omp_for): Handle GF_OMP_FOR_KIND_OACC_LOOP. (dump_gimple_omp_target): Handle GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_DATA, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA. Dump more data. * gimple.c: Update comments for OpenACC changes. * gimple.def: Likewise. * gimple.h: Likewise. (enum gf_mask): Add GF_OMP_FOR_KIND_OACC_LOOP, GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_DATA, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA. (gimple_omp_for_cond, gimple_omp_for_set_cond): Sort in the appropriate place. (is_gimple_omp_oacc, is_gimple_omp_offloaded): New functions. * gimplify.c: Include "gomp-constants.h". Update comments for OpenACC changes. (is_gimple_stmt): Handle OACC_PARALLEL, OACC_KERNELS, OACC_DATA, OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle OMP_CLAUSE__CACHE_, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ. (gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (gimplify_oacc_cache): New function. (gimplify_omp_for): Handle OACC_LOOP. (gimplify_omp_workshare): Handle OACC_KERNELS, OACC_PARALLEL, OACC_DATA. (gimplify_omp_target_update): Handle OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE. (gimplify_expr): Handle OACC_LOOP, OACC_CACHE, OACC_HOST_DATA, OACC_DECLARE, OACC_KERNELS, OACC_PARALLEL, OACC_DATA, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE. (gimplify_body): Consider flag_openacc next to flag_openmp. * lto-streamer-out.c: Include "gomp-constants.h". * omp-builtins.def (BUILT_IN_ACC_GET_DEVICE_TYPE) (BUILT_IN_GOACC_DATA_START, BUILT_IN_GOACC_DATA_END) (BUILT_IN_GOACC_ENTER_EXIT_DATA, BUILT_IN_GOACC_PARALLEL) (BUILT_IN_GOACC_UPDATE, BUILT_IN_GOACC_WAIT) (BUILT_IN_GOACC_GET_THREAD_NUM, BUILT_IN_GOACC_GET_NUM_THREADS) (BUILT_IN_ACC_ON_DEVICE): New builtins. * omp-low.c: Include "gomp-constants.h". Update comments for OpenACC changes. (struct omp_context): Add reduction_map, gwv_below, gwv_this members. (extract_omp_for_data, use_pointer_for_field, install_var_field) (new_omp_context, delete_omp_context, scan_sharing_clauses) (create_omp_child_function, scan_omp_for, scan_omp_target) (check_omp_nesting_restrictions, lower_reduction_clauses) (build_omp_regions_1, diagnose_sb_0, make_gimple_omp_edges): Update for OpenACC changes. (scan_sharing_clauses): Handle OMP_CLAUSE_NUM_GANGS: OMP_CLAUSE_NUM_WORKERS: OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Handle GF_OMP_FOR_KIND_OACC_LOOP. (expand_omp_target, lower_omp_target): Handle GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA, GF_OMP_TARGET_KIND_OACC_DATA. (pass_expand_omp::execute, execute_lower_omp) (pass_diagnose_omp_blocks::gate): Consider flag_openacc next to flag_openmp. (offload_symbol_decl): New variable. (oacc_get_reduction_array_id, oacc_max_threads) (get_offload_symbol_decl, get_base_type, lookup_oacc_reduction) (maybe_lookup_oacc_reduction, enclosing_target_ctx) (oacc_loop_or_target_p, oacc_lower_reduction_var_helper) (oacc_gimple_assign, oacc_initialize_reduction_data) (oacc_finalize_reduction_data, oacc_process_reduction_data): New functions. (is_targetreg_ctx): Remove function. * tree-core.h (enum omp_clause_code): Add OMP_CLAUSE__CACHE_, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_GANG, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH. * tree.c (omp_clause_code_name, walk_tree_1): Update accordingly. * tree.h (OMP_CLAUSE_GANG_EXPR, OMP_CLAUSE_GANG_STATIC_EXPR) (OMP_CLAUSE_ASYNC_EXPR, OMP_CLAUSE_WAIT_EXPR) (OMP_CLAUSE_VECTOR_EXPR, OMP_CLAUSE_WORKER_EXPR) (OMP_CLAUSE_NUM_GANGS_EXPR, OMP_CLAUSE_NUM_WORKERS_EXPR) (OMP_CLAUSE_VECTOR_LENGTH_EXPR): New macros. * tree-core.h: Update comments for OpenACC changes. (enum omp_clause_map_kind): Remove. (struct tree_omp_clause): Change type of map_kind member from enum omp_clause_map_kind to unsigned char. * tree-inline.c: Update comments for OpenACC changes. * tree-nested.c: Likewise. Include "gomp-constants.h". (convert_nonlocal_reference_stmt, convert_local_reference_stmt) (convert_tramp_reference_stmt, convert_gimple_call): Update for OpenACC changes. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. * tree-pretty-print.c: Include "gomp-constants.h". (dump_omp_clause): Handle OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_GANG, OMP_CLAUSE_ASYNC, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_WAIT, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_INDEPENDENT. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (dump_generic_node): Handle OACC_PARALLEL, OACC_KERNELS, OACC_DATA, OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP. * tree-streamer-in.c: Include "gomp-constants.h". (unpack_ts_omp_clause_value_fields) Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. * tree-streamer-out.c: Include "gomp-constants.h". (pack_ts_omp_clause_value_fields): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. * tree.def (OACC_PARALLEL, OACC_KERNELS, OACC_DATA) (OACC_HOST_DATA, OACC_LOOP, OACC_CACHE, OACC_DECLARE) (OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE): New tree codes. * tree.c (omp_clause_num_ops): Update accordingly. * tree.h (OMP_BODY, OMP_CLAUSES, OMP_LOOP_CHECK, OMP_CLAUSE_SIZE): Likewise. (OACC_PARALLEL_BODY, OACC_PARALLEL_CLAUSES, OACC_KERNELS_BODY) (OACC_KERNELS_CLAUSES, OACC_DATA_BODY, OACC_DATA_CLAUSES) (OACC_HOST_DATA_BODY, OACC_HOST_DATA_CLAUSES, OACC_CACHE_CLAUSES) (OACC_DECLARE_CLAUSES, OACC_ENTER_DATA_CLAUSES) (OACC_EXIT_DATA_CLAUSES, OACC_UPDATE_CLAUSES) (OACC_KERNELS_COMBINED, OACC_PARALLEL_COMBINED): New macros. * tree.h (OMP_CLAUSE_MAP_KIND): Cast it to enum gomp_map_kind. (OMP_CLAUSE_SET_MAP_KIND): New macro. * varpool.c (varpool_node::get_create): Consider flag_openacc next to flag_openmp. * config/i386/intelmic-offload.h: New file. * config/nvptx/offload.h: Likewise. gcc/ada/ * gcc-interface/utils.c (DEF_FUNCTION_TYPE_VAR_8) (DEF_FUNCTION_TYPE_VAR_12): New macros. gcc/c-family/ * c.opt (fopenacc): New option. * c-cppbuiltin.c (c_cpp_builtins): Conditionally define _OPENACC. * c-common.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): New macros. * c-common.h (c_finish_oacc_wait): New prototype. * c-omp.c: Include "omp-low.h" and "gomp-constants.h". (c_finish_oacc_wait): New function. * c-pragma.c (oacc_pragmas): New variable. (c_pp_lookup_pragma, init_pragma): Handle it. * c-pragma.h (enum pragma_kind): Add PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT. (enum pragma_omp_clause): Add PRAGMA_OACC_CLAUSE_ASYNC, PRAGMA_OACC_CLAUSE_AUTO, PRAGMA_OACC_CLAUSE_COLLAPSE, PRAGMA_OACC_CLAUSE_COPY, PRAGMA_OACC_CLAUSE_COPYIN, PRAGMA_OACC_CLAUSE_COPYOUT, PRAGMA_OACC_CLAUSE_CREATE, PRAGMA_OACC_CLAUSE_DELETE, PRAGMA_OACC_CLAUSE_DEVICE, PRAGMA_OACC_CLAUSE_DEVICEPTR, PRAGMA_OACC_CLAUSE_FIRSTPRIVATE, PRAGMA_OACC_CLAUSE_GANG, PRAGMA_OACC_CLAUSE_HOST, PRAGMA_OACC_CLAUSE_IF, PRAGMA_OACC_CLAUSE_NUM_GANGS, PRAGMA_OACC_CLAUSE_NUM_WORKERS, PRAGMA_OACC_CLAUSE_PRESENT, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPY, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYIN, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYOUT, PRAGMA_OACC_CLAUSE_PRESENT_OR_CREATE, PRAGMA_OACC_CLAUSE_PRIVATE, PRAGMA_OACC_CLAUSE_REDUCTION, PRAGMA_OACC_CLAUSE_SELF, PRAGMA_OACC_CLAUSE_SEQ, PRAGMA_OACC_CLAUSE_VECTOR, PRAGMA_OACC_CLAUSE_VECTOR_LENGTH, PRAGMA_OACC_CLAUSE_WAIT, PRAGMA_OACC_CLAUSE_WORKER. gcc/c/ * c-parser.c: Include "gomp-constants.h". (c_parser_omp_clause_map): Use enum gomp_map_kind instead of enum omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (c_parser_pragma): Handle PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_UPDATE. (c_parser_omp_construct): Handle PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_WAIT. (c_parser_omp_clause_name): Handle "auto", "async", "copy", "copyout", "create", "delete", "deviceptr", "gang", "host", "num_gangs", "num_workers", "present", "present_or_copy", "pcopy", "present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout", "present_or_create", "pcreate", "seq", "self", "vector", "vector_length", "wait", "worker". (OACC_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK) (OACC_ENTER_DATA_CLAUSE_MASK, OACC_EXIT_DATA_CLAUSE_MASK) (OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK) (OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros. (c_parser_omp_variable_list): Handle OMP_CLAUSE__CACHE_. (c_parser_oacc_wait_list, c_parser_oacc_data_clause) (c_parser_oacc_data_clause_deviceptr) (c_parser_omp_clause_num_gangs, c_parser_omp_clause_num_workers) (c_parser_oacc_clause_async, c_parser_oacc_clause_wait) (c_parser_omp_clause_vector_length, c_parser_oacc_all_clauses) (c_parser_oacc_cache, c_parser_oacc_data, c_parser_oacc_kernels) (c_parser_oacc_enter_exit_data, c_parser_oacc_loop) (c_parser_oacc_parallel, c_parser_oacc_update) (c_parser_oacc_wait): New functions. * c-tree.h (c_finish_oacc_parallel, c_finish_oacc_kernels) (c_finish_oacc_data): New prototypes. * c-typeck.c: Include "gomp-constants.h". (handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (c_finish_oacc_parallel, c_finish_oacc_kernels) (c_finish_oacc_data): New functions. (c_finish_omp_clauses): Handle OMP_CLAUSE__CACHE_, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, and OMP_CLAUSE_MAP's GOMP_MAP_FORCE_DEVICEPTR. gcc/cp/ * parser.c: Include "gomp-constants.h". (cp_parser_omp_clause_map): Use enum gomp_map_kind instead of enum omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (cp_parser_omp_construct, cp_parser_pragma): Handle PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_LOOP, PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT. (cp_parser_omp_clause_name): Handle "async", "copy", "copyout", "create", "delete", "deviceptr", "host", "num_gangs", "num_workers", "present", "present_or_copy", "pcopy", "present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout", "present_or_create", "pcreate", "vector_length", "wait". (OACC_DATA_CLAUSE_MASK, OACC_ENTER_DATA_CLAUSE_MASK) (OACC_EXIT_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK) (OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK) (OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros. (cp_parser_omp_var_list_no_open): Handle OMP_CLAUSE__CACHE_. (cp_parser_oacc_data_clause, cp_parser_oacc_data_clause_deviceptr) (cp_parser_oacc_clause_vector_length, cp_parser_oacc_wait_list) (cp_parser_oacc_clause_wait, cp_parser_omp_clause_num_gangs) (cp_parser_omp_clause_num_workers, cp_parser_oacc_clause_async) (cp_parser_oacc_all_clauses, cp_parser_oacc_cache) (cp_parser_oacc_data, cp_parser_oacc_enter_exit_data) (cp_parser_oacc_kernels, cp_parser_oacc_loop) (cp_parser_oacc_parallel, cp_parser_oacc_update) (cp_parser_oacc_wait): New functions. * cp-tree.h (finish_oacc_data, finish_oacc_kernels) (finish_oacc_parallel): New prototypes. * semantics.c: Include "gomp-constants.h". (handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (finish_omp_clauses): Handle OMP_CLAUSE_ASYNC, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_WAIT, OMP_CLAUSE__CACHE_. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (finish_oacc_data, finish_oacc_kernels, finish_oacc_parallel): New functions. gcc/fortran/ * lang.opt (fopenacc): New option. * cpp.c (cpp_define_builtins): Conditionally define _OPENACC. * dump-parse-tree.c (show_omp_node): Split part of it into... (show_omp_clauses): ... this new function. (show_omp_node, show_code_node): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (show_namespace): Update for OpenACC. * f95-lang.c (DEF_FUNCTION_TYPE_VAR_2, DEF_FUNCTION_TYPE_VAR_8) (DEF_FUNCTION_TYPE_VAR_12, DEF_GOACC_BUILTIN) (DEF_GOACC_BUILTIN_COMPILER): New macros. * types.def (BT_FN_VOID_INT_INT_VAR) (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR) (BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR): New function types. * gfortran.h (gfc_statement): Add ST_OACC_PARALLEL_LOOP, ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL, ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_DATA, ST_OACC_END_DATA, ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA, ST_OACC_LOOP, ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_KERNELS_LOOP, ST_OACC_END_KERNELS_LOOP, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA, ST_OACC_ROUTINE. (struct gfc_expr_list): New data type. (gfc_get_expr_list): New macro. (gfc_omp_map_op): Add OMP_MAP_FORCE_ALLOC, OMP_MAP_FORCE_DEALLOC, OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM, OMP_MAP_FORCE_TOFROM, OMP_MAP_FORCE_PRESENT, OMP_MAP_FORCE_DEVICEPTR. (OMP_LIST_FIRST, OMP_LIST_DEVICE_RESIDENT, OMP_LIST_USE_DEVICE) (OMP_LIST_CACHE): New enumerators. (struct gfc_omp_clauses): Add async_expr, gang_expr, worker_expr, vector_expr, num_gangs_expr, num_workers_expr, vector_length_expr, wait_list, tile_list, async, gang, worker, vector, seq, independent, wait, par_auto, gang_static, and loc members. (struct gfc_namespace): Add oacc_declare_clauses member. (gfc_exec_op): Add EXEC_OACC_KERNELS_LOOP, EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (gfc_free_expr_list, gfc_resolve_oacc_directive) (gfc_resolve_oacc_declare, gfc_resolve_oacc_parallel_loop_blocks) (gfc_resolve_oacc_blocks): New prototypes. * match.c (match_exit_cycle): Handle EXEC_OACC_LOOP and EXEC_OACC_PARALLEL_LOOP. * match.h (gfc_match_oacc_cache, gfc_match_oacc_wait) (gfc_match_oacc_update, gfc_match_oacc_declare) (gfc_match_oacc_loop, gfc_match_oacc_host_data) (gfc_match_oacc_data, gfc_match_oacc_kernels) (gfc_match_oacc_kernels_loop, gfc_match_oacc_parallel) (gfc_match_oacc_parallel_loop, gfc_match_oacc_enter_data) (gfc_match_oacc_exit_data, gfc_match_oacc_routine): New prototypes. * openmp.c: Include "diagnostic.h" and "gomp-constants.h". (gfc_free_omp_clauses): Update for members added to struct gfc_omp_clauses. (gfc_match_omp_clauses): Change mask paramter to uint64_t. Add openacc parameter. (resolve_omp_clauses): Add openacc parameter. Update for OpenACC. (struct fortran_omp_context): Add is_openmp member. (gfc_resolve_omp_parallel_blocks): Initialize it. (gfc_resolve_do_iterator): Update for OpenACC. (gfc_resolve_omp_directive): Call resolve_omp_directive_inside_oacc_region. (OMP_CLAUSE_PRIVATE, OMP_CLAUSE_FIRSTPRIVATE) (OMP_CLAUSE_LASTPRIVATE, OMP_CLAUSE_COPYPRIVATE) (OMP_CLAUSE_SHARED, OMP_CLAUSE_COPYIN, OMP_CLAUSE_REDUCTION) (OMP_CLAUSE_IF, OMP_CLAUSE_NUM_THREADS, OMP_CLAUSE_SCHEDULE) (OMP_CLAUSE_DEFAULT, OMP_CLAUSE_ORDERED, OMP_CLAUSE_COLLAPSE) (OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE) (OMP_CLAUSE_ALIGNED, OMP_CLAUSE_DEPEND, OMP_CLAUSE_INBRANCH) (OMP_CLAUSE_LINEAR, OMP_CLAUSE_NOTINBRANCH, OMP_CLAUSE_PROC_BIND) (OMP_CLAUSE_SAFELEN, OMP_CLAUSE_SIMDLEN, OMP_CLAUSE_UNIFORM) (OMP_CLAUSE_DEVICE, OMP_CLAUSE_MAP, OMP_CLAUSE_TO) (OMP_CLAUSE_FROM, OMP_CLAUSE_NUM_TEAMS, OMP_CLAUSE_THREAD_LIMIT) (OMP_CLAUSE_DIST_SCHEDULE): Use uint64_t. (OMP_CLAUSE_ASYNC, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS) (OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_COPY, OMP_CLAUSE_COPYOUT) (OMP_CLAUSE_CREATE, OMP_CLAUSE_PRESENT) (OMP_CLAUSE_PRESENT_OR_COPY, OMP_CLAUSE_PRESENT_OR_COPYIN) (OMP_CLAUSE_PRESENT_OR_COPYOUT, OMP_CLAUSE_PRESENT_OR_CREATE) (OMP_CLAUSE_DEVICEPTR, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER) (OMP_CLAUSE_VECTOR, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT) (OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_DEVICE_RESIDENT) (OMP_CLAUSE_HOST_SELF, OMP_CLAUSE_OACC_DEVICE, OMP_CLAUSE_WAIT) (OMP_CLAUSE_DELETE, OMP_CLAUSE_AUTO, OMP_CLAUSE_TILE): New macros. (gfc_match_omp_clauses): Handle those. (OACC_PARALLEL_CLAUSES, OACC_KERNELS_CLAUSES, OACC_DATA_CLAUSES) (OACC_LOOP_CLAUSES, OACC_PARALLEL_LOOP_CLAUSES) (OACC_KERNELS_LOOP_CLAUSES, OACC_HOST_DATA_CLAUSES) (OACC_DECLARE_CLAUSES, OACC_UPDATE_CLAUSES) (OACC_ENTER_DATA_CLAUSES, OACC_EXIT_DATA_CLAUSES) (OACC_WAIT_CLAUSES): New macros. (gfc_free_expr_list, match_oacc_expr_list, match_oacc_clause_gang) (gfc_match_omp_map_clause, gfc_match_oacc_parallel_loop) (gfc_match_oacc_parallel, gfc_match_oacc_kernels_loop) (gfc_match_oacc_kernels, gfc_match_oacc_data) (gfc_match_oacc_host_data, gfc_match_oacc_loop) (gfc_match_oacc_declare, gfc_match_oacc_update) (gfc_match_oacc_enter_data, gfc_match_oacc_exit_data) (gfc_match_oacc_wait, gfc_match_oacc_cache) (gfc_match_oacc_routine, oacc_is_loop) (resolve_oacc_scalar_int_expr, resolve_oacc_positive_int_expr) (check_symbol_not_pointer, check_array_not_assumed) (resolve_oacc_data_clauses, resolve_oacc_deviceptr_clause) (oacc_compatible_clauses, oacc_is_parallel, oacc_is_kernels) (omp_code_to_statement, oacc_code_to_statement) (resolve_oacc_directive_inside_omp_region) (resolve_omp_directive_inside_oacc_region) (resolve_oacc_nested_loops, resolve_oacc_params_in_parallel) (resolve_oacc_loop_blocks, gfc_resolve_oacc_blocks) (resolve_oacc_loop, resolve_oacc_cache, gfc_resolve_oacc_declare) (gfc_resolve_oacc_directive): New functions. * parse.c (next_free): Update for OpenACC. Move some code into... (verify_token_free): ... this new function. (next_fixed): Update for OpenACC. Move some code into... (verify_token_fixed): ... this new function. (case_executable): Add ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_ENTER_DATA, and ST_OACC_EXIT_DATA. (case_exec_markers): Add ST_OACC_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA, ST_OACC_LOOP, ST_OACC_KERNELS_LOOP. (case_decl): Add ST_OACC_ROUTINE. (push_state, parse_critical_block, parse_progunit): Update for OpenACC. (gfc_ascii_statement): Handle ST_OACC_PARALLEL_LOOP, ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL, ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_KERNELS_LOOP, ST_OACC_END_KERNELS_LOOP, ST_OACC_DATA, ST_OACC_END_DATA, ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA, ST_OACC_LOOP, ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA, ST_OACC_ROUTINE. (verify_st_order, parse_spec): Handle ST_OACC_DECLARE. (parse_executable): Handle ST_OACC_PARALLEL_LOOP, ST_OACC_KERNELS_LOOP, ST_OACC_LOOP, ST_OACC_PARALLEL, ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA. (decode_oacc_directive, parse_oacc_structured_block) (parse_oacc_loop, is_oacc): New functions. * parse.h (struct gfc_state_data): Add oacc_declare_clauses member. (is_oacc): New prototype. * resolve.c (gfc_resolve_blocks, gfc_resolve_code): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (resolve_codes): Call gfc_resolve_oacc_declare. * scanner.c (openacc_flag, openacc_locus): New variables. (skip_free_comments): Update for OpenACC. Move some code into... (skip_omp_attribute): ... this new function. (skip_oacc_attribute): New function. (skip_fixed_comments, gfc_next_char_literal): Update for OpenACC. * st.c (gfc_free_statement): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. * trans-decl.c (gfc_generate_function_code): Update for OpenACC. * trans-openmp.c: Include "gomp-constants.h". (gfc_omp_finish_clause, gfc_trans_omp_clauses): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (gfc_trans_omp_clauses): Handle OMP_LIST_USE_DEVICE, OMP_LIST_DEVICE_RESIDENT, OMP_LIST_CACHE, and OMP_MAP_FORCE_ALLOC, OMP_MAP_FORCE_DEALLOC, OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM, OMP_MAP_FORCE_TOFROM, OMP_MAP_FORCE_PRESENT, OMP_MAP_FORCE_DEVICEPTR, and gfc_omp_clauses' async, seq, independent, wait_list, num_gangs_expr, num_workers_expr, vector_length_expr, vector, vector_expr, worker, worker_expr, gang, gang_expr members. (gfc_trans_omp_do): Handle EXEC_OACC_LOOP. (gfc_convert_expr_to_tree, gfc_trans_oacc_construct) (gfc_trans_oacc_executable_directive) (gfc_trans_oacc_wait_directive, gfc_trans_oacc_combined_directive) (gfc_trans_oacc_declare, gfc_trans_oacc_directive): New functions. * trans-stmt.c (gfc_trans_block_construct): Update for OpenACC. * trans-stmt.h (gfc_trans_oacc_directive, gfc_trans_oacc_declare): New prototypes. * trans.c (tranc_code): Handle EXEC_OACC_CACHE, EXEC_OACC_WAIT, EXEC_OACC_UPDATE, EXEC_OACC_LOOP, EXEC_OACC_HOST_DATA, EXEC_OACC_DATA, EXEC_OACC_KERNELS, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. * gfortran.texi: Update for OpenACC. * intrinsic.texi: Likewise. * invoke.texi: Likewise. gcc/lto/ * lto-lang.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): New macros. * lto.c: Include "gomp-constants.h". gcc/testsuite/ * lib/target-supports.exp (check_effective_target_fopenacc): New procedure. * g++.dg/goacc-gomp/goacc-gomp.exp: New file. * g++.dg/goacc/goacc.exp: Likewise. * gcc.dg/goacc-gomp/goacc-gomp.exp: Likewise. * gcc.dg/goacc/goacc.exp: Likewise. * gfortran.dg/goacc/goacc.exp: Likewise. * c-c++-common/cpp/openacc-define-1.c: New file. * c-c++-common/cpp/openacc-define-2.c: Likewise. * c-c++-common/cpp/openacc-define-3.c: Likewise. * c-c++-common/goacc-gomp/nesting-1.c: Likewise. * c-c++-common/goacc-gomp/nesting-fail-1.c: Likewise. * c-c++-common/goacc/acc_on_device-2-off.c: Likewise. * c-c++-common/goacc/acc_on_device-2.c: Likewise. * c-c++-common/goacc/asyncwait-1.c: Likewise. * c-c++-common/goacc/cache-1.c: Likewise. * c-c++-common/goacc/clauses-fail.c: Likewise. * c-c++-common/goacc/collapse-1.c: Likewise. * c-c++-common/goacc/data-1.c: Likewise. * c-c++-common/goacc/data-2.c: Likewise. * c-c++-common/goacc/data-clause-duplicate-1.c: Likewise. * c-c++-common/goacc/deviceptr-1.c: Likewise. * c-c++-common/goacc/deviceptr-2.c: Likewise. * c-c++-common/goacc/deviceptr-3.c: Likewise. * c-c++-common/goacc/if-clause-1.c: Likewise. * c-c++-common/goacc/if-clause-2.c: Likewise. * c-c++-common/goacc/kernels-1.c: Likewise. * c-c++-common/goacc/loop-1.c: Likewise. * c-c++-common/goacc/loop-private-1.c: Likewise. * c-c++-common/goacc/nesting-1.c: Likewise. * c-c++-common/goacc/nesting-data-1.c: Likewise. * c-c++-common/goacc/nesting-fail-1.c: Likewise. * c-c++-common/goacc/parallel-1.c: Likewise. * c-c++-common/goacc/pcopy.c: Likewise. * c-c++-common/goacc/pcopyin.c: Likewise. * c-c++-common/goacc/pcopyout.c: Likewise. * c-c++-common/goacc/pcreate.c: Likewise. * c-c++-common/goacc/pragma_context.c: Likewise. * c-c++-common/goacc/present-1.c: Likewise. * c-c++-common/goacc/reduction-1.c: Likewise. * c-c++-common/goacc/reduction-2.c: Likewise. * c-c++-common/goacc/reduction-3.c: Likewise. * c-c++-common/goacc/reduction-4.c: Likewise. * c-c++-common/goacc/sb-1.c: Likewise. * c-c++-common/goacc/sb-2.c: Likewise. * c-c++-common/goacc/sb-3.c: Likewise. * c-c++-common/goacc/update-1.c: Likewise. * gcc.dg/goacc/acc_on_device-1.c: Likewise. * gfortran.dg/goacc/acc_on_device-1.f95: Likewise. * gfortran.dg/goacc/acc_on_device-2-off.f95: Likewise. * gfortran.dg/goacc/acc_on_device-2.f95: Likewise. * gfortran.dg/goacc/assumed.f95: Likewise. * gfortran.dg/goacc/asyncwait-1.f95: Likewise. * gfortran.dg/goacc/asyncwait-2.f95: Likewise. * gfortran.dg/goacc/asyncwait-3.f95: Likewise. * gfortran.dg/goacc/asyncwait-4.f95: Likewise. * gfortran.dg/goacc/branch.f95: Likewise. * gfortran.dg/goacc/cache-1.f95: Likewise. * gfortran.dg/goacc/coarray.f95: Likewise. * gfortran.dg/goacc/continuation-free-form.f95: Likewise. * gfortran.dg/goacc/cray.f95: Likewise. * gfortran.dg/goacc/critical.f95: Likewise. * gfortran.dg/goacc/data-clauses.f95: Likewise. * gfortran.dg/goacc/data-tree.f95: Likewise. * gfortran.dg/goacc/declare-1.f95: Likewise. * gfortran.dg/goacc/enter-exit-data.f95: Likewise. * gfortran.dg/goacc/fixed-1.f: Likewise. * gfortran.dg/goacc/fixed-2.f: Likewise. * gfortran.dg/goacc/fixed-3.f: Likewise. * gfortran.dg/goacc/fixed-4.f: Likewise. * gfortran.dg/goacc/host_data-tree.f95: Likewise. * gfortran.dg/goacc/if.f95: Likewise. * gfortran.dg/goacc/kernels-tree.f95: Likewise. * gfortran.dg/goacc/list.f95: Likewise. * gfortran.dg/goacc/literal.f95: Likewise. * gfortran.dg/goacc/loop-1.f95: Likewise. * gfortran.dg/goacc/loop-2.f95: Likewise. * gfortran.dg/goacc/loop-3.f95: Likewise. * gfortran.dg/goacc/loop-tree-1.f90: Likewise. * gfortran.dg/goacc/omp.f95: Likewise. * gfortran.dg/goacc/parallel-kernels-clauses.f95: Likewise. * gfortran.dg/goacc/parallel-kernels-regions.f95: Likewise. * gfortran.dg/goacc/parallel-tree.f95: Likewise. * gfortran.dg/goacc/parameter.f95: Likewise. * gfortran.dg/goacc/private-1.f95: Likewise. * gfortran.dg/goacc/private-2.f95: Likewise. * gfortran.dg/goacc/private-3.f95: Likewise. * gfortran.dg/goacc/pure-elemental-procedures.f95: Likewise. * gfortran.dg/goacc/reduction-2.f95: Likewise. * gfortran.dg/goacc/reduction.f95: Likewise. * gfortran.dg/goacc/routine-1.f90: Likewise. * gfortran.dg/goacc/routine-2.f90: Likewise. * gfortran.dg/goacc/sentinel-free-form.f95: Likewise. * gfortran.dg/goacc/several-directives.f95: Likewise. * gfortran.dg/goacc/sie.f95: Likewise. * gfortran.dg/goacc/subarrays.f95: Likewise. * gfortran.dg/gomp/map-1.f90: Likewise. * gfortran.dg/openacc-define-1.f90: Likewise. * gfortran.dg/openacc-define-2.f90: Likewise. * gfortran.dg/openacc-define-3.f90: Likewise. * g++.dg/gomp/block-1.C: Update for changed compiler output. * g++.dg/gomp/block-2.C: Likewise. * g++.dg/gomp/block-3.C: Likewise. * g++.dg/gomp/block-5.C: Likewise. * g++.dg/gomp/target-1.C: Likewise. * g++.dg/gomp/target-2.C: Likewise. * g++.dg/gomp/taskgroup-1.C: Likewise. * g++.dg/gomp/teams-1.C: Likewise. * gcc.dg/cilk-plus/jump-openmp.c: Likewise. * gcc.dg/cilk-plus/jump.c: Likewise. * gcc.dg/gomp/block-1.c: Likewise. * gcc.dg/gomp/block-10.c: Likewise. * gcc.dg/gomp/block-2.c: Likewise. * gcc.dg/gomp/block-3.c: Likewise. * gcc.dg/gomp/block-4.c: Likewise. * gcc.dg/gomp/block-5.c: Likewise. * gcc.dg/gomp/block-6.c: Likewise. * gcc.dg/gomp/block-7.c: Likewise. * gcc.dg/gomp/block-8.c: Likewise. * gcc.dg/gomp/block-9.c: Likewise. * gcc.dg/gomp/target-1.c: Likewise. * gcc.dg/gomp/target-2.c: Likewise. * gcc.dg/gomp/taskgroup-1.c: Likewise. * gcc.dg/gomp/teams-1.c: Likewise. include/ * gomp-constants.h: New file. libgomp/ * Makefile.am (search_path): Add $(top_srcdir)/../include. (libgomp_la_SOURCES): Add splay-tree.c, libgomp-plugin.c, oacc-parallel.c, oacc-host.c, oacc-init.c, oacc-mem.c, oacc-async.c, oacc-plugin.c, oacc-cuda.c. [USE_FORTRAN] (libgomp_la_SOURCES): Add openacc.f90. Include $(top_srcdir)/plugin/Makefrag.am. (nodist_libsubinclude_HEADERS): Add openacc.h. [USE_FORTRAN] (nodist_finclude_HEADERS): Add openacc_lib.h, openacc.f90, openacc.mod, openacc_kinds.mod. (omp_lib.mod): Generalize into... (%.mod): ... this new rule. (openacc_kinds.mod, openacc.mod): New rules. * plugin/configfrag.ac: New file. * configure.ac: Move plugin/offloading support into it. Include it. Instantiate testsuite/libgomp-test-support.pt.exp. * plugin/Makefrag.am: New file. * testsuite/Makefile.am (OFFLOAD_TARGETS) (OFFLOAD_ADDITIONAL_OPTIONS, OFFLOAD_ADDITIONAL_LIB_PATHS): Don't export. (libgomp-test-support.exp): New rule. (all-local): Depend on it. * Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. * config.h.in: Likewise. * configure: Likewise. * configure.tgt: Harden shell syntax. * env.c: Include "oacc-int.h". (parse_acc_device_type): New function. (gomp_debug_var, goacc_device_type, goacc_device_num): New variables. (initialize_env): Initialize those. Call goacc_runtime_initialize. * error.c (gomp_vdebug, gomp_debug, gomp_vfatal): New functions. (gomp_fatal): Call gomp_vfatal. * libgomp.h: Include "libgomp-plugin.h" and <stdarg.h>. (gomp_debug_var, goacc_device_type, goacc_device_num, gomp_vdebug) (gomp_debug, gomp_verror, gomp_vfatal, gomp_init_targets_once) (splay_tree_node, splay_tree, splay_tree_key) (struct target_mem_desc, struct splay_tree_key_s) (struct gomp_memory_mapping, struct acc_dispatch_t) (struct gomp_device_descr, gomp_acc_insert_pointer) (gomp_acc_remove_pointer, target_mem_desc, gomp_copy_from_async) (gomp_unmap_vars, gomp_init_device, gomp_init_tables) (gomp_free_memmap, gomp_fini_device): New declarations. (gomp_vdebug, gomp_debug): New macros. Include "splay-tree.h". * libgomp.map (OACC_2.0): New symbol version. Use for acc_get_num_devices, acc_get_num_devices_h_, acc_set_device_type, acc_set_device_type_h_, acc_get_device_type, acc_get_device_type_h_, acc_set_device_num, acc_set_device_num_h_, acc_get_device_num, acc_get_device_num_h_, acc_async_test, acc_async_test_h_, acc_async_test_all, acc_async_test_all_h_, acc_wait, acc_wait_h_, acc_wait_async, acc_wait_async_h_, acc_wait_all, acc_wait_all_h_, acc_wait_all_async, acc_wait_all_async_h_, acc_init, acc_init_h_, acc_shutdown, acc_shutdown_h_, acc_on_device, acc_on_device_h_, acc_malloc, acc_free, acc_copyin, acc_copyin_32_h_, acc_copyin_64_h_, acc_copyin_array_h_, acc_present_or_copyin, acc_present_or_copyin_32_h_, acc_present_or_copyin_64_h_, acc_present_or_copyin_array_h_, acc_create, acc_create_32_h_, acc_create_64_h_, acc_create_array_h_, acc_present_or_create, acc_present_or_create_32_h_, acc_present_or_create_64_h_, acc_present_or_create_array_h_, acc_copyout, acc_copyout_32_h_, acc_copyout_64_h_, acc_copyout_array_h_, acc_delete, acc_delete_32_h_, acc_delete_64_h_, acc_delete_array_h_, acc_update_device, acc_update_device_32_h_, acc_update_device_64_h_, acc_update_device_array_h_, acc_update_self, acc_update_self_32_h_, acc_update_self_64_h_, acc_update_self_array_h_, acc_map_data, acc_unmap_data, acc_deviceptr, acc_hostptr, acc_is_present, acc_is_present_32_h_, acc_is_present_64_h_, acc_is_present_array_h_, acc_memcpy_to_device, acc_memcpy_from_device, acc_get_current_cuda_device, acc_get_current_cuda_context, acc_get_cuda_stream, acc_set_cuda_stream. (GOACC_2.0): New symbol version. Use for GOACC_data_end, GOACC_data_start, GOACC_enter_exit_data, GOACC_parallel, GOACC_update, GOACC_wait, GOACC_get_thread_num, GOACC_get_num_threads. (GOMP_PLUGIN_1.0): New symbol version. Use for GOMP_PLUGIN_malloc, GOMP_PLUGIN_malloc_cleared, GOMP_PLUGIN_realloc, GOMP_PLUGIN_debug, GOMP_PLUGIN_error, GOMP_PLUGIN_fatal, GOMP_PLUGIN_async_unmap_vars, GOMP_PLUGIN_acc_thread. * libgomp.texi: Update for OpenACC changes, and GOMP_DEBUG environment variable. * libgomp_g.h (GOACC_data_start, GOACC_data_end) (GOACC_enter_exit_data, GOACC_parallel, GOACC_update, GOACC_wait) (GOACC_get_num_threads, GOACC_get_thread_num): New declarations. * splay-tree.h (splay_tree_lookup, splay_tree_insert) (splay_tree_remove): New declarations. (rotate_left, rotate_right, splay_tree_splay, splay_tree_insert) (splay_tree_remove, splay_tree_lookup): Move into... * splay-tree.c: ... this new file. * target.c: Include "oacc-plugin.h", "oacc-int.h", <assert.h>. (splay_tree_node, splay_tree, splay_tree_key) (struct target_mem_desc, struct splay_tree_key_s) (struct gomp_device_descr): Don't declare. (num_devices_openmp): New variable. (gomp_get_num_devices ): Use it. (gomp_init_targets_once): New function. (gomp_get_num_devices ): Use it. (get_kind, gomp_copy_from_async, gomp_free_memmap) (gomp_fini_device, gomp_register_image_for_device): New functions. (gomp_map_vars): Add devaddrs parameter. (gomp_update): Add mm parameter. (gomp_init_device): Move most of it into... (gomp_init_tables): ... this new function. (gomp_register_images_for_device): Remove function. (splay_compare, gomp_map_vars, gomp_unmap_vars, gomp_init_device): Make them hidden instead of static. (gomp_map_vars_existing, gomp_map_vars, gomp_unmap_vars) (gomp_update, gomp_init_device, GOMP_target, GOMP_target_data) (GOMP_target_end_data, GOMP_target_update) (gomp_load_plugin_for_device, gomp_target_init): Update for OpenACC changes. * oacc-async.c: New file. * oacc-cuda.c: Likewise. * oacc-host.c: Likewise. * oacc-init.c: Likewise. * oacc-int.h: Likewise. * oacc-mem.c: Likewise. * oacc-parallel.c: Likewise. * oacc-plugin.c: Likewise. * oacc-plugin.h: Likewise. * oacc-ptx.h: Likewise. * openacc.f90: Likewise. * openacc.h: Likewise. * openacc_lib.h: Likewise. * plugin/plugin-host.c: Likewise. * plugin/plugin-nvptx.c: Likewise. * libgomp-plugin.c: Likewise. * libgomp-plugin.h: Likewise. * libgomp_target.h: Remove file after merging content into the former file. Update all users. * testsuite/lib/libgomp.exp: Load libgomp-test-support.exp. (offload_targets_s, offload_targets_s_openacc): New variables. (check_effective_target_openacc_nvidia_accel_present) (check_effective_target_openacc_nvidia_accel_selected): New procedures. (libgomp_init): Update for OpenACC changes. * testsuite/libgomp-test-support.exp.in: New file. * testsuite/libgomp.oacc-c++/c++.exp: Likewise. * testsuite/libgomp.oacc-c/c.exp: Likewise. * testsuite/libgomp.oacc-fortran/fortran.exp: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/asyncwait-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/cache-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/clauses-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/clauses-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-6.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-7.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-8.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/deviceptr-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/if-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/kernels-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/kernels-empty.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-10.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-11.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-12.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-13.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-14.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-15.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-16.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-17.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-18.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-19.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-20.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-21.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-22.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-23.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-24.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-25.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-26.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-27.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-28.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-29.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-30.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-31.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-32.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-33.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-34.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-35.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-36.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-37.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-38.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-39.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-40.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-41.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-42.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-43.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-44.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-45.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-46.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-47.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-48.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-49.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-50.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-51.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-52.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-53.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-54.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-55.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-56.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-57.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-58.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-59.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-6.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-60.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-61.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-62.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-63.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-64.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-65.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-66.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-67.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-68.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-69.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-7.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-70.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-71.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-72.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-73.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-74.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-75.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-76.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-77.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-78.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-79.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-80.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-81.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-82.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-83.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-84.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-85.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-86.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-87.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-88.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-89.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-9.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-90.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-91.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-92.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/nested-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/nested-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/offset-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/parallel-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/parallel-empty.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/pointer-align-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/present-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/present-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-initial-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/subr.h: Likewise. * testsuite/libgomp.oacc-c-c++-common/subr.ptx: Likewise. * testsuite/libgomp.oacc-c-c++-common/timer.h: Likewise. * testsuite/libgomp.oacc-c-c++-common/update-1-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/update-1.c: Likewise. * testsuite/libgomp.oacc-fortran/abort-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/abort-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-7.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-8.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-4-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-already-1.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-2.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-3.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-4.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-5.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-6.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-7.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-8.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-10.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-2.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-3.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-7.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-8.f90: Likewise. * testsuite/libgomp.oacc-fortran/map-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/openacc_version-1.f: Likewise. * testsuite/libgomp.oacc-fortran/openacc_version-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/pointer-align-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/pset-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/subarrays-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/subarrays-2.f90: Likewise. liboffloadmic/ * plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_get_name) (GOMP_OFFLOAD_get_caps, GOMP_OFFLOAD_fini_device): New functions. Co-Authored-By: Bernd Schmidt <bernds@codesourcery.com> Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com> Co-Authored-By: Dmitry Bocharnikov <dmitry.b@samsung.com> Co-Authored-By: Evgeny Gavrin <e.gavrin@samsung.com> Co-Authored-By: Ilmir Usmanov <i.usmanov@samsung.com> Co-Authored-By: Jakub Jelinek <jakub@redhat.com> Co-Authored-By: James Norris <jnorris@codesourcery.com> Co-Authored-By: Julian Brown <julian@codesourcery.com> Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> Co-Authored-By: Tom de Vries <tom@codesourcery.com> From-SVN: r219682
2015-01-15 21:11:12 +01:00
@node GOMP_DEBUG
@section @env{GOMP_DEBUG} -- Enable debugging output
@cindex Environment Variable
@table @asis
@item @emph{Description}:
Enable debugging output. The variable should be set to @code{0}
(disabled, also the default if not set), or @code{1} (enabled).
If enabled, some debugging output will be printed during execution.
This is currently not specified in more detail, and subject to change.
@end table
@node GOMP_STACKSIZE
@section @env{GOMP_STACKSIZE} -- Set default thread stack size
@cindex Environment Variable
@cindex Implementation specific setting
@table @asis
@item @emph{Description}:
Set the default thread stack size in kilobytes. This is different from
@code{pthread_attr_setstacksize} which gets the number of bytes as an
argument. If the stack size cannot be set due to system constraints, an
error is reported and the initial stack size is left unchanged. If undefined,
the stack size is system dependent.
@item @emph{See also}:
@ref{OMP_STACKSIZE}
@item @emph{Reference}:
@uref{http://gcc.gnu.org/ml/gcc-patches/2006-06/msg00493.html,
GCC Patches Mailinglist},
@uref{http://gcc.gnu.org/ml/gcc-patches/2006-06/msg00496.html,
GCC Patches Mailinglist}
@end table
target.c: New file. 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: Richard Henderson <rth@redhat.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> From-SVN: r203408
2013-10-11 11:26:50 +02:00
@node GOMP_SPINCOUNT
@section @env{GOMP_SPINCOUNT} -- Set the busy-wait spin count
@cindex Environment Variable
@cindex Implementation specific setting
@table @asis
@item @emph{Description}:
Determines how long a threads waits actively with consuming CPU power
before waiting passively without consuming CPU power. The value may be
target.c: New file. 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: Richard Henderson <rth@redhat.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> From-SVN: r203408
2013-10-11 11:26:50 +02:00
either @code{INFINITE}, @code{INFINITY} to always wait actively or an
integer which gives the number of spins of the busy-wait loop. The
target.c: New file. 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: Richard Henderson <rth@redhat.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> From-SVN: r203408
2013-10-11 11:26:50 +02:00
integer may optionally be followed by the following suffixes acting
as multiplication factors: @code{k} (kilo, thousand), @code{M} (mega,
million), @code{G} (giga, billion), or @code{T} (tera, trillion).
If undefined, 0 is used when @env{OMP_WAIT_POLICY} is @code{PASSIVE},
300,000 is used when @env{OMP_WAIT_POLICY} is undefined and
30 billion is used when @env{OMP_WAIT_POLICY} is @code{ACTIVE}.
If there are more OpenMP threads than available CPUs, 1000 and 100
spins are used for @env{OMP_WAIT_POLICY} being @code{ACTIVE} or
undefined, respectively; unless the @env{GOMP_SPINCOUNT} is lower
or @env{OMP_WAIT_POLICY} is @code{PASSIVE}.
@item @emph{See also}:
@ref{OMP_WAIT_POLICY}
@end table
@c ---------------------------------------------------------------------
@c The libgomp ABI
@c ---------------------------------------------------------------------
@node The libgomp ABI
@chapter The libgomp ABI
The following sections present notes on the external ABI as
presented by libgomp. Only maintainers should need them.
@menu
* Implementing MASTER construct::
* Implementing CRITICAL construct::
* Implementing ATOMIC construct::
* Implementing FLUSH construct::
* Implementing BARRIER construct::
* Implementing THREADPRIVATE construct::
* Implementing PRIVATE clause::
* Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses::
* Implementing REDUCTION clause::
* Implementing PARALLEL construct::
* Implementing FOR construct::
* Implementing ORDERED construct::
* Implementing SECTIONS construct::
* Implementing SINGLE construct::
@end menu
@node Implementing MASTER construct
@section Implementing MASTER construct
@smallexample
if (omp_get_thread_num () == 0)
block
@end smallexample
Alternately, we generate two copies of the parallel subfunction
and only include this in the version run by the master thread.
Surely this is not worthwhile though...
@node Implementing CRITICAL construct
@section Implementing CRITICAL construct
Without a specified name,
@smallexample
void GOMP_critical_start (void);
void GOMP_critical_end (void);
@end smallexample
so that we don't get COPY relocations from libgomp to the main
application.
With a specified name, use omp_set_lock and omp_unset_lock with
name being transformed into a variable declared like
@smallexample
omp_lock_t gomp_critical_user_<name> __attribute__((common))
@end smallexample
Ideally the ABI would specify that all zero is a valid unlocked
state, and so we wouldn't need to initialize this at
startup.
@node Implementing ATOMIC construct
@section Implementing ATOMIC construct
The target should implement the @code{__sync} builtins.
Failing that we could add
@smallexample
void GOMP_atomic_enter (void)
void GOMP_atomic_exit (void)
@end smallexample
which reuses the regular lock code, but with yet another lock
object private to the library.
@node Implementing FLUSH construct
@section Implementing FLUSH construct
Expands to the @code{__sync_synchronize} builtin.
@node Implementing BARRIER construct
@section Implementing BARRIER construct
@smallexample
void GOMP_barrier (void)
@end smallexample
@node Implementing THREADPRIVATE construct
@section Implementing THREADPRIVATE construct
In _most_ cases we can map this directly to @code{__thread}. Except
that OMP allows constructors for C++ objects. We can either
refuse to support this (how often is it used?) or we can
implement something akin to .ctors.
Even more ideally, this ctor feature is handled by extensions
to the main pthreads library. Failing that, we can have a set
of entry points to register ctor functions to be called.
@node Implementing PRIVATE clause
@section Implementing PRIVATE clause
In association with a PARALLEL, or within the lexical extent
of a PARALLEL block, the variable becomes a local variable in
the parallel subfunction.
In association with FOR or SECTIONS blocks, create a new
automatic variable within the current function. This preserves
the semantic of new variable creation.
@node Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses
@section Implementing FIRSTPRIVATE LASTPRIVATE COPYIN and COPYPRIVATE clauses
This seems simple enough for PARALLEL blocks. Create a private
struct for communicating between the parent and subfunction.
In the parent, copy in values for scalar and "small" structs;
copy in addresses for others TREE_ADDRESSABLE types. In the
subfunction, copy the value into the local variable.
It is not clear what to do with bare FOR or SECTION blocks.
The only thing I can figure is that we do something like:
@smallexample
#pragma omp for firstprivate(x) lastprivate(y)
for (int i = 0; i < n; ++i)
body;
@end smallexample
which becomes
@smallexample
@{
int x = x, y;
// for stuff
if (i == n)
y = y;
@}
@end smallexample
where the "x=x" and "y=y" assignments actually have different
uids for the two variables, i.e. not something you could write
directly in C. Presumably this only makes sense if the "outer"
x and y are global variables.
COPYPRIVATE would work the same way, except the structure
broadcast would have to happen via SINGLE machinery instead.
@node Implementing REDUCTION clause
@section Implementing REDUCTION clause
The private struct mentioned in the previous section should have
a pointer to an array of the type of the variable, indexed by the
thread's @var{team_id}. The thread stores its final value into the
array, and after the barrier, the master thread iterates over the
array to collect the values.
@node Implementing PARALLEL construct
@section Implementing PARALLEL construct
@smallexample
#pragma omp parallel
@{
body;
@}
@end smallexample
becomes
@smallexample
void subfunction (void *data)
@{
use data;
body;
@}
setup data;
GOMP_parallel_start (subfunction, &data, num_threads);
subfunction (&data);
GOMP_parallel_end ();
@end smallexample
@smallexample
void GOMP_parallel_start (void (*fn)(void *), void *data, unsigned num_threads)
@end smallexample
The @var{FN} argument is the subfunction to be run in parallel.
The @var{DATA} argument is a pointer to a structure used to
communicate data in and out of the subfunction, as discussed
above with respect to FIRSTPRIVATE et al.
The @var{NUM_THREADS} argument is 1 if an IF clause is present
and false, or the value of the NUM_THREADS clause, if
present, or 0.
The function needs to create the appropriate number of
threads and/or launch them from the dock. It needs to
create the team structure and assign team ids.
@smallexample
void GOMP_parallel_end (void)
@end smallexample
Tears down the team and returns us to the previous @code{omp_in_parallel()} state.
@node Implementing FOR construct
@section Implementing FOR construct
@smallexample
#pragma omp parallel for
for (i = lb; i <= ub; i++)
body;
@end smallexample
becomes
@smallexample
void subfunction (void *data)
@{
long _s0, _e0;
while (GOMP_loop_static_next (&_s0, &_e0))
@{
long _e1 = _e0, i;
for (i = _s0; i < _e1; i++)
body;
@}
GOMP_loop_end_nowait ();
@}
GOMP_parallel_loop_static (subfunction, NULL, 0, lb, ub+1, 1, 0);
subfunction (NULL);
GOMP_parallel_end ();
@end smallexample
@smallexample
#pragma omp for schedule(runtime)
for (i = 0; i < n; i++)
body;
@end smallexample
becomes
@smallexample
@{
long i, _s0, _e0;
if (GOMP_loop_runtime_start (0, n, 1, &_s0, &_e0))
do @{
long _e1 = _e0;
for (i = _s0, i < _e0; i++)
body;
@} while (GOMP_loop_runtime_next (&_s0, _&e0));
GOMP_loop_end ();
@}
@end smallexample
Note that while it looks like there is trickiness to propagating
a non-constant STEP, there isn't really. We're explicitly allowed
to evaluate it as many times as we want, and any variables involved
should automatically be handled as PRIVATE or SHARED like any other
variables. So the expression should remain evaluable in the
subfunction. We can also pull it into a local variable if we like,
but since its supposed to remain unchanged, we can also not if we like.
If we have SCHEDULE(STATIC), and no ORDERED, then we ought to be
able to get away with no work-sharing context at all, since we can
simply perform the arithmetic directly in each thread to divide up
the iterations. Which would mean that we wouldn't need to call any
of these routines.
There are separate routines for handling loops with an ORDERED
clause. Bookkeeping for that is non-trivial...
@node Implementing ORDERED construct
@section Implementing ORDERED construct
@smallexample
void GOMP_ordered_start (void)
void GOMP_ordered_end (void)
@end smallexample
@node Implementing SECTIONS construct
@section Implementing SECTIONS construct
A block as
@smallexample
#pragma omp sections
@{
#pragma omp section
stmt1;
#pragma omp section
stmt2;
#pragma omp section
stmt3;
@}
@end smallexample
becomes
@smallexample
for (i = GOMP_sections_start (3); i != 0; i = GOMP_sections_next ())
switch (i)
@{
case 1:
stmt1;
break;
case 2:
stmt2;
break;
case 3:
stmt3;
break;
@}
GOMP_barrier ();
@end smallexample
@node Implementing SINGLE construct
@section Implementing SINGLE construct
A block like
@smallexample
#pragma omp single
@{
body;
@}
@end smallexample
becomes
@smallexample
if (GOMP_single_start ())
body;
GOMP_barrier ();
@end smallexample
while
@smallexample
#pragma omp single copyprivate(x)
body;
@end smallexample
becomes
@smallexample
datap = GOMP_single_copy_start ();
if (datap == NULL)
@{
body;
data.x = x;
GOMP_single_copy_end (&data);
@}
else
x = datap->x;
GOMP_barrier ();
@end smallexample
@c ---------------------------------------------------------------------
@c Reporting Bugs
@c ---------------------------------------------------------------------
@node Reporting Bugs
@chapter Reporting Bugs
Bugs in the GNU Offloading and Multi Processing Runtime Library should
be reported via @uref{http://gcc.gnu.org/bugzilla/, Bugzilla}. Please add
Merge current set of OpenACC changes from gomp-4_0-branch. contrib/ * gcc_update (files_and_dependencies): Update rules for new libgomp/plugin/Makefrag.am and libgomp/plugin/configfrag.ac files. gcc/ * builtin-types.def (BT_FN_VOID_INT_INT_VAR) (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR) (BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR): New function types. * builtins.c: Include "gomp-constants.h". (expand_builtin_acc_on_device): New function. (expand_builtin, is_inexpensive_builtin): Handle BUILT_IN_ACC_ON_DEVICE. * builtins.def (DEF_GOACC_BUILTIN, DEF_GOACC_BUILTIN_COMPILER): New macros. * cgraph.c (cgraph_node::create): Consider flag_openacc next to flag_openmp. * config.gcc <nvptx-*> (tm_file): Add nvptx/offload.h. <*-intelmic-* | *-intelmicemul-*> (tm_file): Add i386/intelmic-offload.h. * gcc.c (LINK_COMMAND_SPEC, GOMP_SELF_SPECS): For -fopenacc, link to libgomp and its dependencies. * config/arc/arc.h (LINK_COMMAND_SPEC): Likewise. * config/darwin.h (LINK_COMMAND_SPEC_A): Likewise. * config/i386/mingw32.h (GOMP_SELF_SPECS): Likewise. * config/ia64/hpux.h (LIB_SPEC): Likewise. * config/pa/pa-hpux11.h (LIB_SPEC): Likewise. * config/pa/pa64-hpux.h (LIB_SPEC): Likewise. * doc/generic.texi: Update for OpenACC changes. * doc/gimple.texi: Likewise. * doc/invoke.texi: Likewise. * doc/sourcebuild.texi: Likewise. * gimple-pretty-print.c (dump_gimple_omp_for): Handle GF_OMP_FOR_KIND_OACC_LOOP. (dump_gimple_omp_target): Handle GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_DATA, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA. Dump more data. * gimple.c: Update comments for OpenACC changes. * gimple.def: Likewise. * gimple.h: Likewise. (enum gf_mask): Add GF_OMP_FOR_KIND_OACC_LOOP, GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_DATA, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA. (gimple_omp_for_cond, gimple_omp_for_set_cond): Sort in the appropriate place. (is_gimple_omp_oacc, is_gimple_omp_offloaded): New functions. * gimplify.c: Include "gomp-constants.h". Update comments for OpenACC changes. (is_gimple_stmt): Handle OACC_PARALLEL, OACC_KERNELS, OACC_DATA, OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP. (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle OMP_CLAUSE__CACHE_, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ. (gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (gimplify_oacc_cache): New function. (gimplify_omp_for): Handle OACC_LOOP. (gimplify_omp_workshare): Handle OACC_KERNELS, OACC_PARALLEL, OACC_DATA. (gimplify_omp_target_update): Handle OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE. (gimplify_expr): Handle OACC_LOOP, OACC_CACHE, OACC_HOST_DATA, OACC_DECLARE, OACC_KERNELS, OACC_PARALLEL, OACC_DATA, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE. (gimplify_body): Consider flag_openacc next to flag_openmp. * lto-streamer-out.c: Include "gomp-constants.h". * omp-builtins.def (BUILT_IN_ACC_GET_DEVICE_TYPE) (BUILT_IN_GOACC_DATA_START, BUILT_IN_GOACC_DATA_END) (BUILT_IN_GOACC_ENTER_EXIT_DATA, BUILT_IN_GOACC_PARALLEL) (BUILT_IN_GOACC_UPDATE, BUILT_IN_GOACC_WAIT) (BUILT_IN_GOACC_GET_THREAD_NUM, BUILT_IN_GOACC_GET_NUM_THREADS) (BUILT_IN_ACC_ON_DEVICE): New builtins. * omp-low.c: Include "gomp-constants.h". Update comments for OpenACC changes. (struct omp_context): Add reduction_map, gwv_below, gwv_this members. (extract_omp_for_data, use_pointer_for_field, install_var_field) (new_omp_context, delete_omp_context, scan_sharing_clauses) (create_omp_child_function, scan_omp_for, scan_omp_target) (check_omp_nesting_restrictions, lower_reduction_clauses) (build_omp_regions_1, diagnose_sb_0, make_gimple_omp_edges): Update for OpenACC changes. (scan_sharing_clauses): Handle OMP_CLAUSE_NUM_GANGS: OMP_CLAUSE_NUM_WORKERS: OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Handle GF_OMP_FOR_KIND_OACC_LOOP. (expand_omp_target, lower_omp_target): Handle GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS, GF_OMP_TARGET_KIND_OACC_UPDATE, GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA, GF_OMP_TARGET_KIND_OACC_DATA. (pass_expand_omp::execute, execute_lower_omp) (pass_diagnose_omp_blocks::gate): Consider flag_openacc next to flag_openmp. (offload_symbol_decl): New variable. (oacc_get_reduction_array_id, oacc_max_threads) (get_offload_symbol_decl, get_base_type, lookup_oacc_reduction) (maybe_lookup_oacc_reduction, enclosing_target_ctx) (oacc_loop_or_target_p, oacc_lower_reduction_var_helper) (oacc_gimple_assign, oacc_initialize_reduction_data) (oacc_finalize_reduction_data, oacc_process_reduction_data): New functions. (is_targetreg_ctx): Remove function. * tree-core.h (enum omp_clause_code): Add OMP_CLAUSE__CACHE_, OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_GANG, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH. * tree.c (omp_clause_code_name, walk_tree_1): Update accordingly. * tree.h (OMP_CLAUSE_GANG_EXPR, OMP_CLAUSE_GANG_STATIC_EXPR) (OMP_CLAUSE_ASYNC_EXPR, OMP_CLAUSE_WAIT_EXPR) (OMP_CLAUSE_VECTOR_EXPR, OMP_CLAUSE_WORKER_EXPR) (OMP_CLAUSE_NUM_GANGS_EXPR, OMP_CLAUSE_NUM_WORKERS_EXPR) (OMP_CLAUSE_VECTOR_LENGTH_EXPR): New macros. * tree-core.h: Update comments for OpenACC changes. (enum omp_clause_map_kind): Remove. (struct tree_omp_clause): Change type of map_kind member from enum omp_clause_map_kind to unsigned char. * tree-inline.c: Update comments for OpenACC changes. * tree-nested.c: Likewise. Include "gomp-constants.h". (convert_nonlocal_reference_stmt, convert_local_reference_stmt) (convert_tramp_reference_stmt, convert_gimple_call): Update for OpenACC changes. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. * tree-pretty-print.c: Include "gomp-constants.h". (dump_omp_clause): Handle OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_GANG, OMP_CLAUSE_ASYNC, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_WAIT, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_INDEPENDENT. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (dump_generic_node): Handle OACC_PARALLEL, OACC_KERNELS, OACC_DATA, OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE, OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP. * tree-streamer-in.c: Include "gomp-constants.h". (unpack_ts_omp_clause_value_fields) Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. * tree-streamer-out.c: Include "gomp-constants.h". (pack_ts_omp_clause_value_fields): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. * tree.def (OACC_PARALLEL, OACC_KERNELS, OACC_DATA) (OACC_HOST_DATA, OACC_LOOP, OACC_CACHE, OACC_DECLARE) (OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE): New tree codes. * tree.c (omp_clause_num_ops): Update accordingly. * tree.h (OMP_BODY, OMP_CLAUSES, OMP_LOOP_CHECK, OMP_CLAUSE_SIZE): Likewise. (OACC_PARALLEL_BODY, OACC_PARALLEL_CLAUSES, OACC_KERNELS_BODY) (OACC_KERNELS_CLAUSES, OACC_DATA_BODY, OACC_DATA_CLAUSES) (OACC_HOST_DATA_BODY, OACC_HOST_DATA_CLAUSES, OACC_CACHE_CLAUSES) (OACC_DECLARE_CLAUSES, OACC_ENTER_DATA_CLAUSES) (OACC_EXIT_DATA_CLAUSES, OACC_UPDATE_CLAUSES) (OACC_KERNELS_COMBINED, OACC_PARALLEL_COMBINED): New macros. * tree.h (OMP_CLAUSE_MAP_KIND): Cast it to enum gomp_map_kind. (OMP_CLAUSE_SET_MAP_KIND): New macro. * varpool.c (varpool_node::get_create): Consider flag_openacc next to flag_openmp. * config/i386/intelmic-offload.h: New file. * config/nvptx/offload.h: Likewise. gcc/ada/ * gcc-interface/utils.c (DEF_FUNCTION_TYPE_VAR_8) (DEF_FUNCTION_TYPE_VAR_12): New macros. gcc/c-family/ * c.opt (fopenacc): New option. * c-cppbuiltin.c (c_cpp_builtins): Conditionally define _OPENACC. * c-common.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): New macros. * c-common.h (c_finish_oacc_wait): New prototype. * c-omp.c: Include "omp-low.h" and "gomp-constants.h". (c_finish_oacc_wait): New function. * c-pragma.c (oacc_pragmas): New variable. (c_pp_lookup_pragma, init_pragma): Handle it. * c-pragma.h (enum pragma_kind): Add PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT. (enum pragma_omp_clause): Add PRAGMA_OACC_CLAUSE_ASYNC, PRAGMA_OACC_CLAUSE_AUTO, PRAGMA_OACC_CLAUSE_COLLAPSE, PRAGMA_OACC_CLAUSE_COPY, PRAGMA_OACC_CLAUSE_COPYIN, PRAGMA_OACC_CLAUSE_COPYOUT, PRAGMA_OACC_CLAUSE_CREATE, PRAGMA_OACC_CLAUSE_DELETE, PRAGMA_OACC_CLAUSE_DEVICE, PRAGMA_OACC_CLAUSE_DEVICEPTR, PRAGMA_OACC_CLAUSE_FIRSTPRIVATE, PRAGMA_OACC_CLAUSE_GANG, PRAGMA_OACC_CLAUSE_HOST, PRAGMA_OACC_CLAUSE_IF, PRAGMA_OACC_CLAUSE_NUM_GANGS, PRAGMA_OACC_CLAUSE_NUM_WORKERS, PRAGMA_OACC_CLAUSE_PRESENT, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPY, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYIN, PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYOUT, PRAGMA_OACC_CLAUSE_PRESENT_OR_CREATE, PRAGMA_OACC_CLAUSE_PRIVATE, PRAGMA_OACC_CLAUSE_REDUCTION, PRAGMA_OACC_CLAUSE_SELF, PRAGMA_OACC_CLAUSE_SEQ, PRAGMA_OACC_CLAUSE_VECTOR, PRAGMA_OACC_CLAUSE_VECTOR_LENGTH, PRAGMA_OACC_CLAUSE_WAIT, PRAGMA_OACC_CLAUSE_WORKER. gcc/c/ * c-parser.c: Include "gomp-constants.h". (c_parser_omp_clause_map): Use enum gomp_map_kind instead of enum omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (c_parser_pragma): Handle PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_UPDATE. (c_parser_omp_construct): Handle PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_WAIT. (c_parser_omp_clause_name): Handle "auto", "async", "copy", "copyout", "create", "delete", "deviceptr", "gang", "host", "num_gangs", "num_workers", "present", "present_or_copy", "pcopy", "present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout", "present_or_create", "pcreate", "seq", "self", "vector", "vector_length", "wait", "worker". (OACC_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK) (OACC_ENTER_DATA_CLAUSE_MASK, OACC_EXIT_DATA_CLAUSE_MASK) (OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK) (OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros. (c_parser_omp_variable_list): Handle OMP_CLAUSE__CACHE_. (c_parser_oacc_wait_list, c_parser_oacc_data_clause) (c_parser_oacc_data_clause_deviceptr) (c_parser_omp_clause_num_gangs, c_parser_omp_clause_num_workers) (c_parser_oacc_clause_async, c_parser_oacc_clause_wait) (c_parser_omp_clause_vector_length, c_parser_oacc_all_clauses) (c_parser_oacc_cache, c_parser_oacc_data, c_parser_oacc_kernels) (c_parser_oacc_enter_exit_data, c_parser_oacc_loop) (c_parser_oacc_parallel, c_parser_oacc_update) (c_parser_oacc_wait): New functions. * c-tree.h (c_finish_oacc_parallel, c_finish_oacc_kernels) (c_finish_oacc_data): New prototypes. * c-typeck.c: Include "gomp-constants.h". (handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (c_finish_oacc_parallel, c_finish_oacc_kernels) (c_finish_oacc_data): New functions. (c_finish_omp_clauses): Handle OMP_CLAUSE__CACHE_, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, and OMP_CLAUSE_MAP's GOMP_MAP_FORCE_DEVICEPTR. gcc/cp/ * parser.c: Include "gomp-constants.h". (cp_parser_omp_clause_map): Use enum gomp_map_kind instead of enum omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (cp_parser_omp_construct, cp_parser_pragma): Handle PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_PARALLEL, PRAGMA_OACC_LOOP, PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT. (cp_parser_omp_clause_name): Handle "async", "copy", "copyout", "create", "delete", "deviceptr", "host", "num_gangs", "num_workers", "present", "present_or_copy", "pcopy", "present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout", "present_or_create", "pcreate", "vector_length", "wait". (OACC_DATA_CLAUSE_MASK, OACC_ENTER_DATA_CLAUSE_MASK) (OACC_EXIT_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK) (OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK) (OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros. (cp_parser_omp_var_list_no_open): Handle OMP_CLAUSE__CACHE_. (cp_parser_oacc_data_clause, cp_parser_oacc_data_clause_deviceptr) (cp_parser_oacc_clause_vector_length, cp_parser_oacc_wait_list) (cp_parser_oacc_clause_wait, cp_parser_omp_clause_num_gangs) (cp_parser_omp_clause_num_workers, cp_parser_oacc_clause_async) (cp_parser_oacc_all_clauses, cp_parser_oacc_cache) (cp_parser_oacc_data, cp_parser_oacc_enter_exit_data) (cp_parser_oacc_kernels, cp_parser_oacc_loop) (cp_parser_oacc_parallel, cp_parser_oacc_update) (cp_parser_oacc_wait): New functions. * cp-tree.h (finish_oacc_data, finish_oacc_kernels) (finish_oacc_parallel): New prototypes. * semantics.c: Include "gomp-constants.h". (handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (finish_omp_clauses): Handle OMP_CLAUSE_ASYNC, OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_WAIT, OMP_CLAUSE__CACHE_. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. (finish_oacc_data, finish_oacc_kernels, finish_oacc_parallel): New functions. gcc/fortran/ * lang.opt (fopenacc): New option. * cpp.c (cpp_define_builtins): Conditionally define _OPENACC. * dump-parse-tree.c (show_omp_node): Split part of it into... (show_omp_clauses): ... this new function. (show_omp_node, show_code_node): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (show_namespace): Update for OpenACC. * f95-lang.c (DEF_FUNCTION_TYPE_VAR_2, DEF_FUNCTION_TYPE_VAR_8) (DEF_FUNCTION_TYPE_VAR_12, DEF_GOACC_BUILTIN) (DEF_GOACC_BUILTIN_COMPILER): New macros. * types.def (BT_FN_VOID_INT_INT_VAR) (BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR) (BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR): New function types. * gfortran.h (gfc_statement): Add ST_OACC_PARALLEL_LOOP, ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL, ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_DATA, ST_OACC_END_DATA, ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA, ST_OACC_LOOP, ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_KERNELS_LOOP, ST_OACC_END_KERNELS_LOOP, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA, ST_OACC_ROUTINE. (struct gfc_expr_list): New data type. (gfc_get_expr_list): New macro. (gfc_omp_map_op): Add OMP_MAP_FORCE_ALLOC, OMP_MAP_FORCE_DEALLOC, OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM, OMP_MAP_FORCE_TOFROM, OMP_MAP_FORCE_PRESENT, OMP_MAP_FORCE_DEVICEPTR. (OMP_LIST_FIRST, OMP_LIST_DEVICE_RESIDENT, OMP_LIST_USE_DEVICE) (OMP_LIST_CACHE): New enumerators. (struct gfc_omp_clauses): Add async_expr, gang_expr, worker_expr, vector_expr, num_gangs_expr, num_workers_expr, vector_length_expr, wait_list, tile_list, async, gang, worker, vector, seq, independent, wait, par_auto, gang_static, and loc members. (struct gfc_namespace): Add oacc_declare_clauses member. (gfc_exec_op): Add EXEC_OACC_KERNELS_LOOP, EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (gfc_free_expr_list, gfc_resolve_oacc_directive) (gfc_resolve_oacc_declare, gfc_resolve_oacc_parallel_loop_blocks) (gfc_resolve_oacc_blocks): New prototypes. * match.c (match_exit_cycle): Handle EXEC_OACC_LOOP and EXEC_OACC_PARALLEL_LOOP. * match.h (gfc_match_oacc_cache, gfc_match_oacc_wait) (gfc_match_oacc_update, gfc_match_oacc_declare) (gfc_match_oacc_loop, gfc_match_oacc_host_data) (gfc_match_oacc_data, gfc_match_oacc_kernels) (gfc_match_oacc_kernels_loop, gfc_match_oacc_parallel) (gfc_match_oacc_parallel_loop, gfc_match_oacc_enter_data) (gfc_match_oacc_exit_data, gfc_match_oacc_routine): New prototypes. * openmp.c: Include "diagnostic.h" and "gomp-constants.h". (gfc_free_omp_clauses): Update for members added to struct gfc_omp_clauses. (gfc_match_omp_clauses): Change mask paramter to uint64_t. Add openacc parameter. (resolve_omp_clauses): Add openacc parameter. Update for OpenACC. (struct fortran_omp_context): Add is_openmp member. (gfc_resolve_omp_parallel_blocks): Initialize it. (gfc_resolve_do_iterator): Update for OpenACC. (gfc_resolve_omp_directive): Call resolve_omp_directive_inside_oacc_region. (OMP_CLAUSE_PRIVATE, OMP_CLAUSE_FIRSTPRIVATE) (OMP_CLAUSE_LASTPRIVATE, OMP_CLAUSE_COPYPRIVATE) (OMP_CLAUSE_SHARED, OMP_CLAUSE_COPYIN, OMP_CLAUSE_REDUCTION) (OMP_CLAUSE_IF, OMP_CLAUSE_NUM_THREADS, OMP_CLAUSE_SCHEDULE) (OMP_CLAUSE_DEFAULT, OMP_CLAUSE_ORDERED, OMP_CLAUSE_COLLAPSE) (OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE) (OMP_CLAUSE_ALIGNED, OMP_CLAUSE_DEPEND, OMP_CLAUSE_INBRANCH) (OMP_CLAUSE_LINEAR, OMP_CLAUSE_NOTINBRANCH, OMP_CLAUSE_PROC_BIND) (OMP_CLAUSE_SAFELEN, OMP_CLAUSE_SIMDLEN, OMP_CLAUSE_UNIFORM) (OMP_CLAUSE_DEVICE, OMP_CLAUSE_MAP, OMP_CLAUSE_TO) (OMP_CLAUSE_FROM, OMP_CLAUSE_NUM_TEAMS, OMP_CLAUSE_THREAD_LIMIT) (OMP_CLAUSE_DIST_SCHEDULE): Use uint64_t. (OMP_CLAUSE_ASYNC, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS) (OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_COPY, OMP_CLAUSE_COPYOUT) (OMP_CLAUSE_CREATE, OMP_CLAUSE_PRESENT) (OMP_CLAUSE_PRESENT_OR_COPY, OMP_CLAUSE_PRESENT_OR_COPYIN) (OMP_CLAUSE_PRESENT_OR_COPYOUT, OMP_CLAUSE_PRESENT_OR_CREATE) (OMP_CLAUSE_DEVICEPTR, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER) (OMP_CLAUSE_VECTOR, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT) (OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_DEVICE_RESIDENT) (OMP_CLAUSE_HOST_SELF, OMP_CLAUSE_OACC_DEVICE, OMP_CLAUSE_WAIT) (OMP_CLAUSE_DELETE, OMP_CLAUSE_AUTO, OMP_CLAUSE_TILE): New macros. (gfc_match_omp_clauses): Handle those. (OACC_PARALLEL_CLAUSES, OACC_KERNELS_CLAUSES, OACC_DATA_CLAUSES) (OACC_LOOP_CLAUSES, OACC_PARALLEL_LOOP_CLAUSES) (OACC_KERNELS_LOOP_CLAUSES, OACC_HOST_DATA_CLAUSES) (OACC_DECLARE_CLAUSES, OACC_UPDATE_CLAUSES) (OACC_ENTER_DATA_CLAUSES, OACC_EXIT_DATA_CLAUSES) (OACC_WAIT_CLAUSES): New macros. (gfc_free_expr_list, match_oacc_expr_list, match_oacc_clause_gang) (gfc_match_omp_map_clause, gfc_match_oacc_parallel_loop) (gfc_match_oacc_parallel, gfc_match_oacc_kernels_loop) (gfc_match_oacc_kernels, gfc_match_oacc_data) (gfc_match_oacc_host_data, gfc_match_oacc_loop) (gfc_match_oacc_declare, gfc_match_oacc_update) (gfc_match_oacc_enter_data, gfc_match_oacc_exit_data) (gfc_match_oacc_wait, gfc_match_oacc_cache) (gfc_match_oacc_routine, oacc_is_loop) (resolve_oacc_scalar_int_expr, resolve_oacc_positive_int_expr) (check_symbol_not_pointer, check_array_not_assumed) (resolve_oacc_data_clauses, resolve_oacc_deviceptr_clause) (oacc_compatible_clauses, oacc_is_parallel, oacc_is_kernels) (omp_code_to_statement, oacc_code_to_statement) (resolve_oacc_directive_inside_omp_region) (resolve_omp_directive_inside_oacc_region) (resolve_oacc_nested_loops, resolve_oacc_params_in_parallel) (resolve_oacc_loop_blocks, gfc_resolve_oacc_blocks) (resolve_oacc_loop, resolve_oacc_cache, gfc_resolve_oacc_declare) (gfc_resolve_oacc_directive): New functions. * parse.c (next_free): Update for OpenACC. Move some code into... (verify_token_free): ... this new function. (next_fixed): Update for OpenACC. Move some code into... (verify_token_fixed): ... this new function. (case_executable): Add ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_ENTER_DATA, and ST_OACC_EXIT_DATA. (case_exec_markers): Add ST_OACC_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA, ST_OACC_LOOP, ST_OACC_KERNELS_LOOP. (case_decl): Add ST_OACC_ROUTINE. (push_state, parse_critical_block, parse_progunit): Update for OpenACC. (gfc_ascii_statement): Handle ST_OACC_PARALLEL_LOOP, ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL, ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_KERNELS_LOOP, ST_OACC_END_KERNELS_LOOP, ST_OACC_DATA, ST_OACC_END_DATA, ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA, ST_OACC_LOOP, ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE, ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA, ST_OACC_ROUTINE. (verify_st_order, parse_spec): Handle ST_OACC_DECLARE. (parse_executable): Handle ST_OACC_PARALLEL_LOOP, ST_OACC_KERNELS_LOOP, ST_OACC_LOOP, ST_OACC_PARALLEL, ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA. (decode_oacc_directive, parse_oacc_structured_block) (parse_oacc_loop, is_oacc): New functions. * parse.h (struct gfc_state_data): Add oacc_declare_clauses member. (is_oacc): New prototype. * resolve.c (gfc_resolve_blocks, gfc_resolve_code): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. (resolve_codes): Call gfc_resolve_oacc_declare. * scanner.c (openacc_flag, openacc_locus): New variables. (skip_free_comments): Update for OpenACC. Move some code into... (skip_omp_attribute): ... this new function. (skip_oacc_attribute): New function. (skip_fixed_comments, gfc_next_char_literal): Update for OpenACC. * st.c (gfc_free_statement): Handle EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. * trans-decl.c (gfc_generate_function_code): Update for OpenACC. * trans-openmp.c: Include "gomp-constants.h". (gfc_omp_finish_clause, gfc_trans_omp_clauses): Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND. (gfc_trans_omp_clauses): Handle OMP_LIST_USE_DEVICE, OMP_LIST_DEVICE_RESIDENT, OMP_LIST_CACHE, and OMP_MAP_FORCE_ALLOC, OMP_MAP_FORCE_DEALLOC, OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM, OMP_MAP_FORCE_TOFROM, OMP_MAP_FORCE_PRESENT, OMP_MAP_FORCE_DEVICEPTR, and gfc_omp_clauses' async, seq, independent, wait_list, num_gangs_expr, num_workers_expr, vector_length_expr, vector, vector_expr, worker, worker_expr, gang, gang_expr members. (gfc_trans_omp_do): Handle EXEC_OACC_LOOP. (gfc_convert_expr_to_tree, gfc_trans_oacc_construct) (gfc_trans_oacc_executable_directive) (gfc_trans_oacc_wait_directive, gfc_trans_oacc_combined_directive) (gfc_trans_oacc_declare, gfc_trans_oacc_directive): New functions. * trans-stmt.c (gfc_trans_block_construct): Update for OpenACC. * trans-stmt.h (gfc_trans_oacc_directive, gfc_trans_oacc_declare): New prototypes. * trans.c (tranc_code): Handle EXEC_OACC_CACHE, EXEC_OACC_WAIT, EXEC_OACC_UPDATE, EXEC_OACC_LOOP, EXEC_OACC_HOST_DATA, EXEC_OACC_DATA, EXEC_OACC_KERNELS, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA. * gfortran.texi: Update for OpenACC. * intrinsic.texi: Likewise. * invoke.texi: Likewise. gcc/lto/ * lto-lang.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12): New macros. * lto.c: Include "gomp-constants.h". gcc/testsuite/ * lib/target-supports.exp (check_effective_target_fopenacc): New procedure. * g++.dg/goacc-gomp/goacc-gomp.exp: New file. * g++.dg/goacc/goacc.exp: Likewise. * gcc.dg/goacc-gomp/goacc-gomp.exp: Likewise. * gcc.dg/goacc/goacc.exp: Likewise. * gfortran.dg/goacc/goacc.exp: Likewise. * c-c++-common/cpp/openacc-define-1.c: New file. * c-c++-common/cpp/openacc-define-2.c: Likewise. * c-c++-common/cpp/openacc-define-3.c: Likewise. * c-c++-common/goacc-gomp/nesting-1.c: Likewise. * c-c++-common/goacc-gomp/nesting-fail-1.c: Likewise. * c-c++-common/goacc/acc_on_device-2-off.c: Likewise. * c-c++-common/goacc/acc_on_device-2.c: Likewise. * c-c++-common/goacc/asyncwait-1.c: Likewise. * c-c++-common/goacc/cache-1.c: Likewise. * c-c++-common/goacc/clauses-fail.c: Likewise. * c-c++-common/goacc/collapse-1.c: Likewise. * c-c++-common/goacc/data-1.c: Likewise. * c-c++-common/goacc/data-2.c: Likewise. * c-c++-common/goacc/data-clause-duplicate-1.c: Likewise. * c-c++-common/goacc/deviceptr-1.c: Likewise. * c-c++-common/goacc/deviceptr-2.c: Likewise. * c-c++-common/goacc/deviceptr-3.c: Likewise. * c-c++-common/goacc/if-clause-1.c: Likewise. * c-c++-common/goacc/if-clause-2.c: Likewise. * c-c++-common/goacc/kernels-1.c: Likewise. * c-c++-common/goacc/loop-1.c: Likewise. * c-c++-common/goacc/loop-private-1.c: Likewise. * c-c++-common/goacc/nesting-1.c: Likewise. * c-c++-common/goacc/nesting-data-1.c: Likewise. * c-c++-common/goacc/nesting-fail-1.c: Likewise. * c-c++-common/goacc/parallel-1.c: Likewise. * c-c++-common/goacc/pcopy.c: Likewise. * c-c++-common/goacc/pcopyin.c: Likewise. * c-c++-common/goacc/pcopyout.c: Likewise. * c-c++-common/goacc/pcreate.c: Likewise. * c-c++-common/goacc/pragma_context.c: Likewise. * c-c++-common/goacc/present-1.c: Likewise. * c-c++-common/goacc/reduction-1.c: Likewise. * c-c++-common/goacc/reduction-2.c: Likewise. * c-c++-common/goacc/reduction-3.c: Likewise. * c-c++-common/goacc/reduction-4.c: Likewise. * c-c++-common/goacc/sb-1.c: Likewise. * c-c++-common/goacc/sb-2.c: Likewise. * c-c++-common/goacc/sb-3.c: Likewise. * c-c++-common/goacc/update-1.c: Likewise. * gcc.dg/goacc/acc_on_device-1.c: Likewise. * gfortran.dg/goacc/acc_on_device-1.f95: Likewise. * gfortran.dg/goacc/acc_on_device-2-off.f95: Likewise. * gfortran.dg/goacc/acc_on_device-2.f95: Likewise. * gfortran.dg/goacc/assumed.f95: Likewise. * gfortran.dg/goacc/asyncwait-1.f95: Likewise. * gfortran.dg/goacc/asyncwait-2.f95: Likewise. * gfortran.dg/goacc/asyncwait-3.f95: Likewise. * gfortran.dg/goacc/asyncwait-4.f95: Likewise. * gfortran.dg/goacc/branch.f95: Likewise. * gfortran.dg/goacc/cache-1.f95: Likewise. * gfortran.dg/goacc/coarray.f95: Likewise. * gfortran.dg/goacc/continuation-free-form.f95: Likewise. * gfortran.dg/goacc/cray.f95: Likewise. * gfortran.dg/goacc/critical.f95: Likewise. * gfortran.dg/goacc/data-clauses.f95: Likewise. * gfortran.dg/goacc/data-tree.f95: Likewise. * gfortran.dg/goacc/declare-1.f95: Likewise. * gfortran.dg/goacc/enter-exit-data.f95: Likewise. * gfortran.dg/goacc/fixed-1.f: Likewise. * gfortran.dg/goacc/fixed-2.f: Likewise. * gfortran.dg/goacc/fixed-3.f: Likewise. * gfortran.dg/goacc/fixed-4.f: Likewise. * gfortran.dg/goacc/host_data-tree.f95: Likewise. * gfortran.dg/goacc/if.f95: Likewise. * gfortran.dg/goacc/kernels-tree.f95: Likewise. * gfortran.dg/goacc/list.f95: Likewise. * gfortran.dg/goacc/literal.f95: Likewise. * gfortran.dg/goacc/loop-1.f95: Likewise. * gfortran.dg/goacc/loop-2.f95: Likewise. * gfortran.dg/goacc/loop-3.f95: Likewise. * gfortran.dg/goacc/loop-tree-1.f90: Likewise. * gfortran.dg/goacc/omp.f95: Likewise. * gfortran.dg/goacc/parallel-kernels-clauses.f95: Likewise. * gfortran.dg/goacc/parallel-kernels-regions.f95: Likewise. * gfortran.dg/goacc/parallel-tree.f95: Likewise. * gfortran.dg/goacc/parameter.f95: Likewise. * gfortran.dg/goacc/private-1.f95: Likewise. * gfortran.dg/goacc/private-2.f95: Likewise. * gfortran.dg/goacc/private-3.f95: Likewise. * gfortran.dg/goacc/pure-elemental-procedures.f95: Likewise. * gfortran.dg/goacc/reduction-2.f95: Likewise. * gfortran.dg/goacc/reduction.f95: Likewise. * gfortran.dg/goacc/routine-1.f90: Likewise. * gfortran.dg/goacc/routine-2.f90: Likewise. * gfortran.dg/goacc/sentinel-free-form.f95: Likewise. * gfortran.dg/goacc/several-directives.f95: Likewise. * gfortran.dg/goacc/sie.f95: Likewise. * gfortran.dg/goacc/subarrays.f95: Likewise. * gfortran.dg/gomp/map-1.f90: Likewise. * gfortran.dg/openacc-define-1.f90: Likewise. * gfortran.dg/openacc-define-2.f90: Likewise. * gfortran.dg/openacc-define-3.f90: Likewise. * g++.dg/gomp/block-1.C: Update for changed compiler output. * g++.dg/gomp/block-2.C: Likewise. * g++.dg/gomp/block-3.C: Likewise. * g++.dg/gomp/block-5.C: Likewise. * g++.dg/gomp/target-1.C: Likewise. * g++.dg/gomp/target-2.C: Likewise. * g++.dg/gomp/taskgroup-1.C: Likewise. * g++.dg/gomp/teams-1.C: Likewise. * gcc.dg/cilk-plus/jump-openmp.c: Likewise. * gcc.dg/cilk-plus/jump.c: Likewise. * gcc.dg/gomp/block-1.c: Likewise. * gcc.dg/gomp/block-10.c: Likewise. * gcc.dg/gomp/block-2.c: Likewise. * gcc.dg/gomp/block-3.c: Likewise. * gcc.dg/gomp/block-4.c: Likewise. * gcc.dg/gomp/block-5.c: Likewise. * gcc.dg/gomp/block-6.c: Likewise. * gcc.dg/gomp/block-7.c: Likewise. * gcc.dg/gomp/block-8.c: Likewise. * gcc.dg/gomp/block-9.c: Likewise. * gcc.dg/gomp/target-1.c: Likewise. * gcc.dg/gomp/target-2.c: Likewise. * gcc.dg/gomp/taskgroup-1.c: Likewise. * gcc.dg/gomp/teams-1.c: Likewise. include/ * gomp-constants.h: New file. libgomp/ * Makefile.am (search_path): Add $(top_srcdir)/../include. (libgomp_la_SOURCES): Add splay-tree.c, libgomp-plugin.c, oacc-parallel.c, oacc-host.c, oacc-init.c, oacc-mem.c, oacc-async.c, oacc-plugin.c, oacc-cuda.c. [USE_FORTRAN] (libgomp_la_SOURCES): Add openacc.f90. Include $(top_srcdir)/plugin/Makefrag.am. (nodist_libsubinclude_HEADERS): Add openacc.h. [USE_FORTRAN] (nodist_finclude_HEADERS): Add openacc_lib.h, openacc.f90, openacc.mod, openacc_kinds.mod. (omp_lib.mod): Generalize into... (%.mod): ... this new rule. (openacc_kinds.mod, openacc.mod): New rules. * plugin/configfrag.ac: New file. * configure.ac: Move plugin/offloading support into it. Include it. Instantiate testsuite/libgomp-test-support.pt.exp. * plugin/Makefrag.am: New file. * testsuite/Makefile.am (OFFLOAD_TARGETS) (OFFLOAD_ADDITIONAL_OPTIONS, OFFLOAD_ADDITIONAL_LIB_PATHS): Don't export. (libgomp-test-support.exp): New rule. (all-local): Depend on it. * Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. * config.h.in: Likewise. * configure: Likewise. * configure.tgt: Harden shell syntax. * env.c: Include "oacc-int.h". (parse_acc_device_type): New function. (gomp_debug_var, goacc_device_type, goacc_device_num): New variables. (initialize_env): Initialize those. Call goacc_runtime_initialize. * error.c (gomp_vdebug, gomp_debug, gomp_vfatal): New functions. (gomp_fatal): Call gomp_vfatal. * libgomp.h: Include "libgomp-plugin.h" and <stdarg.h>. (gomp_debug_var, goacc_device_type, goacc_device_num, gomp_vdebug) (gomp_debug, gomp_verror, gomp_vfatal, gomp_init_targets_once) (splay_tree_node, splay_tree, splay_tree_key) (struct target_mem_desc, struct splay_tree_key_s) (struct gomp_memory_mapping, struct acc_dispatch_t) (struct gomp_device_descr, gomp_acc_insert_pointer) (gomp_acc_remove_pointer, target_mem_desc, gomp_copy_from_async) (gomp_unmap_vars, gomp_init_device, gomp_init_tables) (gomp_free_memmap, gomp_fini_device): New declarations. (gomp_vdebug, gomp_debug): New macros. Include "splay-tree.h". * libgomp.map (OACC_2.0): New symbol version. Use for acc_get_num_devices, acc_get_num_devices_h_, acc_set_device_type, acc_set_device_type_h_, acc_get_device_type, acc_get_device_type_h_, acc_set_device_num, acc_set_device_num_h_, acc_get_device_num, acc_get_device_num_h_, acc_async_test, acc_async_test_h_, acc_async_test_all, acc_async_test_all_h_, acc_wait, acc_wait_h_, acc_wait_async, acc_wait_async_h_, acc_wait_all, acc_wait_all_h_, acc_wait_all_async, acc_wait_all_async_h_, acc_init, acc_init_h_, acc_shutdown, acc_shutdown_h_, acc_on_device, acc_on_device_h_, acc_malloc, acc_free, acc_copyin, acc_copyin_32_h_, acc_copyin_64_h_, acc_copyin_array_h_, acc_present_or_copyin, acc_present_or_copyin_32_h_, acc_present_or_copyin_64_h_, acc_present_or_copyin_array_h_, acc_create, acc_create_32_h_, acc_create_64_h_, acc_create_array_h_, acc_present_or_create, acc_present_or_create_32_h_, acc_present_or_create_64_h_, acc_present_or_create_array_h_, acc_copyout, acc_copyout_32_h_, acc_copyout_64_h_, acc_copyout_array_h_, acc_delete, acc_delete_32_h_, acc_delete_64_h_, acc_delete_array_h_, acc_update_device, acc_update_device_32_h_, acc_update_device_64_h_, acc_update_device_array_h_, acc_update_self, acc_update_self_32_h_, acc_update_self_64_h_, acc_update_self_array_h_, acc_map_data, acc_unmap_data, acc_deviceptr, acc_hostptr, acc_is_present, acc_is_present_32_h_, acc_is_present_64_h_, acc_is_present_array_h_, acc_memcpy_to_device, acc_memcpy_from_device, acc_get_current_cuda_device, acc_get_current_cuda_context, acc_get_cuda_stream, acc_set_cuda_stream. (GOACC_2.0): New symbol version. Use for GOACC_data_end, GOACC_data_start, GOACC_enter_exit_data, GOACC_parallel, GOACC_update, GOACC_wait, GOACC_get_thread_num, GOACC_get_num_threads. (GOMP_PLUGIN_1.0): New symbol version. Use for GOMP_PLUGIN_malloc, GOMP_PLUGIN_malloc_cleared, GOMP_PLUGIN_realloc, GOMP_PLUGIN_debug, GOMP_PLUGIN_error, GOMP_PLUGIN_fatal, GOMP_PLUGIN_async_unmap_vars, GOMP_PLUGIN_acc_thread. * libgomp.texi: Update for OpenACC changes, and GOMP_DEBUG environment variable. * libgomp_g.h (GOACC_data_start, GOACC_data_end) (GOACC_enter_exit_data, GOACC_parallel, GOACC_update, GOACC_wait) (GOACC_get_num_threads, GOACC_get_thread_num): New declarations. * splay-tree.h (splay_tree_lookup, splay_tree_insert) (splay_tree_remove): New declarations. (rotate_left, rotate_right, splay_tree_splay, splay_tree_insert) (splay_tree_remove, splay_tree_lookup): Move into... * splay-tree.c: ... this new file. * target.c: Include "oacc-plugin.h", "oacc-int.h", <assert.h>. (splay_tree_node, splay_tree, splay_tree_key) (struct target_mem_desc, struct splay_tree_key_s) (struct gomp_device_descr): Don't declare. (num_devices_openmp): New variable. (gomp_get_num_devices ): Use it. (gomp_init_targets_once): New function. (gomp_get_num_devices ): Use it. (get_kind, gomp_copy_from_async, gomp_free_memmap) (gomp_fini_device, gomp_register_image_for_device): New functions. (gomp_map_vars): Add devaddrs parameter. (gomp_update): Add mm parameter. (gomp_init_device): Move most of it into... (gomp_init_tables): ... this new function. (gomp_register_images_for_device): Remove function. (splay_compare, gomp_map_vars, gomp_unmap_vars, gomp_init_device): Make them hidden instead of static. (gomp_map_vars_existing, gomp_map_vars, gomp_unmap_vars) (gomp_update, gomp_init_device, GOMP_target, GOMP_target_data) (GOMP_target_end_data, GOMP_target_update) (gomp_load_plugin_for_device, gomp_target_init): Update for OpenACC changes. * oacc-async.c: New file. * oacc-cuda.c: Likewise. * oacc-host.c: Likewise. * oacc-init.c: Likewise. * oacc-int.h: Likewise. * oacc-mem.c: Likewise. * oacc-parallel.c: Likewise. * oacc-plugin.c: Likewise. * oacc-plugin.h: Likewise. * oacc-ptx.h: Likewise. * openacc.f90: Likewise. * openacc.h: Likewise. * openacc_lib.h: Likewise. * plugin/plugin-host.c: Likewise. * plugin/plugin-nvptx.c: Likewise. * libgomp-plugin.c: Likewise. * libgomp-plugin.h: Likewise. * libgomp_target.h: Remove file after merging content into the former file. Update all users. * testsuite/lib/libgomp.exp: Load libgomp-test-support.exp. (offload_targets_s, offload_targets_s_openacc): New variables. (check_effective_target_openacc_nvidia_accel_present) (check_effective_target_openacc_nvidia_accel_selected): New procedures. (libgomp_init): Update for OpenACC changes. * testsuite/libgomp-test-support.exp.in: New file. * testsuite/libgomp.oacc-c++/c++.exp: Likewise. * testsuite/libgomp.oacc-c/c.exp: Likewise. * testsuite/libgomp.oacc-fortran/fortran.exp: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/abort-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/asyncwait-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/cache-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/clauses-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/clauses-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/context-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-6.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-7.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-8.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/deviceptr-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/if-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/kernels-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/kernels-empty.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-10.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-11.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-12.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-13.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-14.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-15.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-16.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-17.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-18.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-19.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-20.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-21.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-22.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-23.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-24.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-25.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-26.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-27.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-28.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-29.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-30.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-31.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-32.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-33.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-34.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-35.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-36.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-37.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-38.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-39.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-40.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-41.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-42.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-43.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-44.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-45.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-46.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-47.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-48.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-49.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-50.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-51.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-52.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-53.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-54.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-55.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-56.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-57.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-58.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-59.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-6.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-60.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-61.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-62.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-63.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-64.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-65.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-66.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-67.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-68.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-69.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-7.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-70.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-71.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-72.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-73.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-74.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-75.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-76.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-77.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-78.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-79.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-80.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-81.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-82.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-83.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-84.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-85.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-86.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-87.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-88.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-89.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-9.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-90.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-91.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-92.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/nested-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/nested-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/offset-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/parallel-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/parallel-empty.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/pointer-align-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/present-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/present-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-initial-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/subr.h: Likewise. * testsuite/libgomp.oacc-c-c++-common/subr.ptx: Likewise. * testsuite/libgomp.oacc-c-c++-common/timer.h: Likewise. * testsuite/libgomp.oacc-c-c++-common/update-1-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/update-1.c: Likewise. * testsuite/libgomp.oacc-fortran/abort-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/abort-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise. * testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/asyncwait-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-7.f90: Likewise. * testsuite/libgomp.oacc-fortran/collapse-8.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-4-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-already-1.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-2.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-3.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-4.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-5.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-6.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-7.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-8.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-10.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-2.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-3.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-7.f90: Likewise. * testsuite/libgomp.oacc-fortran/lib-8.f90: Likewise. * testsuite/libgomp.oacc-fortran/map-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/openacc_version-1.f: Likewise. * testsuite/libgomp.oacc-fortran/openacc_version-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/pointer-align-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/pset-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-6.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/routine-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/subarrays-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/subarrays-2.f90: Likewise. liboffloadmic/ * plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_get_name) (GOMP_OFFLOAD_get_caps, GOMP_OFFLOAD_fini_device): New functions. Co-Authored-By: Bernd Schmidt <bernds@codesourcery.com> Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com> Co-Authored-By: Dmitry Bocharnikov <dmitry.b@samsung.com> Co-Authored-By: Evgeny Gavrin <e.gavrin@samsung.com> Co-Authored-By: Ilmir Usmanov <i.usmanov@samsung.com> Co-Authored-By: Jakub Jelinek <jakub@redhat.com> Co-Authored-By: James Norris <jnorris@codesourcery.com> Co-Authored-By: Julian Brown <julian@codesourcery.com> Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> Co-Authored-By: Tobias Burnus <burnus@net-b.de> Co-Authored-By: Tom de Vries <tom@codesourcery.com> From-SVN: r219682
2015-01-15 21:11:12 +01:00
"openacc", or "openmp", or both to the keywords field in the bug
report, as appropriate.
@c ---------------------------------------------------------------------
@c GNU General Public License
@c ---------------------------------------------------------------------
@include gpl_v3.texi
@c ---------------------------------------------------------------------
@c GNU Free Documentation License
@c ---------------------------------------------------------------------
@include fdl.texi
@c ---------------------------------------------------------------------
@c Funding Free Software
@c ---------------------------------------------------------------------
@include funding.texi
@c ---------------------------------------------------------------------
@c Index
@c ---------------------------------------------------------------------
@node Library Index
@unnumbered Library Index
@printindex cp
@bye