diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2022-12-09 21:45:37 +0100 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2022-12-09 21:45:37 +0100 |
commit | b2e1c49b4a4592f9e96ae9ece8af7d0e6527b194 (patch) | |
tree | 2ff8c340654035539084af7e525b77be0a350023 /libgomp | |
parent | 71b31d13757ae0f544651c29b113ccf120573760 (diff) | |
download | gcc-b2e1c49b4a4592f9e96ae9ece8af7d0e6527b194.zip gcc-b2e1c49b4a4592f9e96ae9ece8af7d0e6527b194.tar.gz gcc-b2e1c49b4a4592f9e96ae9ece8af7d0e6527b194.tar.bz2 |
Fortran/OpenMP: align/allocator modifiers to the allocate clause
gcc/fortran/ChangeLog:
* dump-parse-tree.cc (show_omp_namelist): Improve OMP_LIST_ALLOCATE
output.
* gfortran.h (struct gfc_omp_namelist): Add 'align' to 'u'.
(gfc_free_omp_namelist): Add bool arg.
* match.cc (gfc_free_omp_namelist): Likewise; free 'u.align'.
* openmp.cc (gfc_free_omp_clauses, gfc_match_omp_clause_reduction,
gfc_match_omp_flush): Update call.
(gfc_match_omp_clauses): Match 'align/allocate modifers in
'allocate' clause.
(resolve_omp_clauses): Resolve align.
* st.cc (gfc_free_statement): Update call
* trans-openmp.cc (gfc_trans_omp_clauses): Handle 'align'.
libgomp/ChangeLog:
* libgomp.texi (5.1 Impl. Status): Split allocate clause/directive
item about 'align'; mark clause as 'Y' and directive as 'N'.
* testsuite/libgomp.fortran/allocate-2.f90: New test.
* testsuite/libgomp.fortran/allocate-3.f90: New test.
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/libgomp.texi | 4 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.fortran/allocate-2.f90 | 25 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.fortran/allocate-3.f90 | 28 |
3 files changed, 55 insertions, 2 deletions
diff --git a/libgomp/libgomp.texi b/libgomp/libgomp.texi index e8798a0..b6c1ed7 100644 --- a/libgomp/libgomp.texi +++ b/libgomp/libgomp.texi @@ -296,8 +296,8 @@ The OpenMP 4.5 specification is fully supported. @item Loop transformation constructs @tab N @tab @item @code{strict} modifier in the @code{grainsize} and @code{num_tasks} clauses of the @code{taskloop} construct @tab Y @tab -@item @code{align} clause/modifier in @code{allocate} directive/clause - and @code{allocator} directive @tab P @tab C/C++ on clause only +@item @code{align} clause in @code{allocate} directive @tab N @tab +@item @code{align} modifier in @code{allocate} clause @tab Y @tab @item @code{thread_limit} clause to @code{target} construct @tab Y @tab @item @code{has_device_addr} clause to @code{target} construct @tab Y @tab @item Iterators in @code{target update} motion clauses and @code{map} diff --git a/libgomp/testsuite/libgomp.fortran/allocate-2.f90 b/libgomp/testsuite/libgomp.fortran/allocate-2.f90 new file mode 100644 index 0000000..347656a --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/allocate-2.f90 @@ -0,0 +1,25 @@ +! { dg-do compile } +! { dg-additional-options "-fdump-tree-original" } + +use omp_lib +implicit none +integer :: q, x,y,z + +!$omp parallel & +!$omp& allocate(omp_low_lat_mem_alloc : x) & +!$omp& allocate(omp_cgroup_mem_alloc : y) & +!$omp& allocate(omp_pteam_mem_alloc : z) & +!$omp& firstprivate(q, x,y,z) +!$omp end parallel + +!$omp parallel & +!$omp& allocate(align ( 64 ), allocator(omp_default_mem_alloc) : x) & +!$omp& allocate(allocator(omp_large_cap_mem_alloc) : y) & +!$omp& allocate(allocator ( omp_high_bw_mem_alloc ) , align ( 32 ) : z) & +!$omp& allocate(align (16 ): q) & +!$omp& firstprivate(q, x,y,z) +!$omp end parallel +end + +! { dg-final { scan-tree-dump-times "#pragma omp parallel firstprivate\\(q\\) firstprivate\\(x\\) firstprivate\\(y\\) firstprivate\\(z\\) allocate\\(allocator\\(5\\):x\\) allocate\\(allocator\\(6\\):y\\) allocate\\(allocator\\(7\\):z\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "#pragma omp parallel firstprivate\\(q\\) firstprivate\\(x\\) firstprivate\\(y\\) firstprivate\\(z\\) allocate\\(allocator\\(1\\),align\\(64\\):x\\) allocate\\(allocator\\(2\\):y\\) allocate\\(allocator\\(4\\),align\\(32\\):z\\) allocate\\(align\\(16\\):q\\)" 1 "original" } } diff --git a/libgomp/testsuite/libgomp.fortran/allocate-3.f90 b/libgomp/testsuite/libgomp.fortran/allocate-3.f90 new file mode 100644 index 0000000..a398191 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/allocate-3.f90 @@ -0,0 +1,28 @@ +! { dg-do compile } +! { dg-additional-options "-fdump-tree-original" } + +use omp_lib +implicit none +integer :: q, x,y,z + +!$omp parallel allocate(align ( 64 ) x) ! { dg-error "37:Expected ':' at" } +!$omp parallel allocate(align ( 64 ), x) ! { dg-error "37:Expected ':' at" } +!$omp parallel allocate(allocator ( omp_high_bw_mem_alloc ) x) ! { dg-error "60:Expected ':' at" } +!$omp parallel allocate(allocator ( omp_high_bw_mem_alloc ) , x) ! { dg-error "60:Expected ':' at" } + +!$omp parallel allocate( omp_high_bw_mem_alloc, align(12) : x) ! { dg-error "26:Expected variable list at" } +!$omp parallel allocate( align(12), omp_high_bw_mem_alloc : x) ! { dg-error "35:Expected ':' at" } + +!$omp parallel allocate( omp_high_bw_mem_alloc x) ! { dg-error "26:Expected variable list at" } + +!$omp parallel allocate( omp_high_bw_mem_alloc , x) firstprivate(x) ! { dg-error "'omp_high_bw_mem_alloc' specified in 'allocate' clause at \\(1\\) but not in an explicit privatization clause" } +! { dg-error "Object 'omp_high_bw_mem_alloc' is not a variable" "" { target *-*-* } .-1 } +!$omp end parallel + +!$omp parallel allocate( omp_high_bw_mem_alloc , x) firstprivate(x, omp_high_bw_mem_alloc) +! { dg-error "Object 'omp_high_bw_mem_alloc' is not a variable" "" { target *-*-* } .-1 } +!$omp end parallel + +!$omp parallel allocate( align(q) : x) firstprivate(x) ! { dg-error "31:ALIGN modifier requires a scalar positive constant integer alignment expression at" } +!$omp end parallel +end |