]> git.ipfire.org Git - thirdparty/gcc.git/commit - libgomp/env.c
OpenMP 5.1: Add proc-bind 'primary' support
authorTobias Burnus <tobias@codesourcery.com>
Thu, 12 Aug 2021 13:48:28 +0000 (15:48 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Thu, 12 Aug 2021 13:49:49 +0000 (15:49 +0200)
commit432de08498142d2266c0fb05f2c555a7f1e10ddd
treeeb534cfc1379a9d59255a6c31f38519aaba927b4
parent2d7967a10c2f3b4652f77a1a2119ba03b3472266
OpenMP 5.1: Add proc-bind 'primary' support

In OpenMP 5.1 "master thread" was changed to "primary thread" and
the proc_bind clause and the OMP_PROC_BIND environment variable
now take 'primary' as argument as alias for 'master', while the
latter is deprecated.
This commit accepts 'primary' and adds the named constant
omp_proc_bind_primary and changes 'master thread' in the
documentation; however, given that not even OpenMP 5.0 is
fully supported, omp_display_env and the dumps currently
still output 'master' and there is no deprecation warning
when using the 'master' in the proc_bind clause.

gcc/c/ChangeLog:

* c-parser.c (c_parser_omp_clause_proc_bind): Accept
'primary' as alias for 'master'.

gcc/cp/ChangeLog:

* parser.c (cp_parser_omp_clause_proc_bind): Accept
'primary' as alias for 'master'.

gcc/fortran/ChangeLog:

* gfortran.h (gfc_omp_proc_bind_kind): Add OMP_PROC_BIND_PRIMARY.
* dump-parse-tree.c (show_omp_clauses): Add TODO comment to
change 'master' to 'primary' in proc_bind for OpenMP 5.1.
* intrinsic.texi (OMP_LIB): Mention OpenMP 5.1; add
omp_proc_bind_primary.
* openmp.c (gfc_match_omp_clauses): Accept
'primary' as alias for 'master'.
* trans-openmp.c (gfc_trans_omp_clauses): Handle
OMP_PROC_BIND_PRIMARY.

gcc/ChangeLog:

* tree-core.h (omp_clause_proc_bind_kind): Add
OMP_CLAUSE_PROC_BIND_PRIMARY.
* tree-pretty-print.c (dump_omp_clause): Add TODO comment to
change 'master' to 'primary' in proc_bind for OpenMP 5.1.

libgomp/ChangeLog:

* env.c (parse_bind_var): Accept 'primary' as alias for
'master'.
(omp_display_env): Add TODO comment to
change 'master' to 'primary' in proc_bind for OpenMP 5.1.
* libgomp.texi: Change 'master thread' to 'primary thread'
in line with OpenMP 5.1.
(omp_get_proc_bind): Add omp_proc_bind_primary and note that
omp_proc_bind_master is an alias of it.
(OMP_PROC_BIND): Mention 'PRIMARY'.
* omp.h.in (__GOMP_DEPRECATED_5_1): Define.
(omp_proc_bind_primary): Add.
(omp_proc_bind_master): Deprecate for OpenMP 5.1.
* omp_lib.f90.in (omp_proc_bind_primary): Add.
(omp_proc_bind_master): Deprecate for OpenMP 5.1.
* omp_lib.h.in (omp_proc_bind_primary): Add.
* testsuite/libgomp.c/affinity-1.c: Check that
'primary' works and is identical to 'master'.

gcc/testsuite/ChangeLog:

* c-c++-common/gomp/pr61486-2.c: Duplicate one proc_bind(master)
testcase and test proc_bind(primary) instead.
* gfortran.dg/gomp/affinity-1.f90: Likewise.
17 files changed:
gcc/c/c-parser.c
gcc/cp/parser.c
gcc/fortran/dump-parse-tree.c
gcc/fortran/gfortran.h
gcc/fortran/intrinsic.texi
gcc/fortran/openmp.c
gcc/fortran/trans-openmp.c
gcc/testsuite/c-c++-common/gomp/pr61486-2.c
gcc/testsuite/gfortran.dg/gomp/affinity-1.f90
gcc/tree-core.h
gcc/tree-pretty-print.c
libgomp/env.c
libgomp/libgomp.texi
libgomp/omp.h.in
libgomp/omp_lib.f90.in
libgomp/omp_lib.h.in
libgomp/testsuite/libgomp.c/affinity-1.c