]> gcc.gnu.org Git - gcc.git/commit
OpenMP: Array shaping operator and strided "target update" for C
authorJulian Brown <julian@codesourcery.com>
Fri, 3 May 2024 09:26:08 +0000 (11:26 +0200)
committerPaul-Antoine Arras <parras@baylibre.com>
Thu, 27 Jun 2024 15:58:13 +0000 (17:58 +0200)
commit16968aa143637e56a3834b8615b18d0a915498de
tree131b26bf402182877ededa6d9f0f68a79dd41bfc
parent3d5bcb1a84868a66955e57ee958f11e990fce718
OpenMP: Array shaping operator and strided "target update" for C

Following the similar support for C++, here is the C implementation for
the OpenMP 5.0 array-shaping operator, and for strided and rectangular
updates for "target update".

Much of the implementation is shared with the C++ support added by the
previous patch.  Some details of parsing necessarily differ for C,
but the general ideas are the same.

This version of the patch has been rebased and contains a couple of
minor fixes relative to versions posted previously.

2023-09-05  Julian Brown  <julian@codesourcery.com>

gcc/c/
* c-parser.cc (c_parser_braced_init): Disallow array-shaping operator
in braced init.
(c_parser_conditional_expression): Disallow array-shaping operator in
conditional expression.
(c_parser_cast_expression): Add array-shaping operator support.
(c_parser_postfix_expression): Disallow array-shaping operator in
statement expressions.
(c_parser_postfix_expression_after_primary): Add OpenMP array section
stride support.
(c_parser_expr_list): Disallow array-shaping operator in expression
lists.
(c_array_type_nelts_top, c_array_type_nelts_total): New functions.
(c_parser_omp_variable_list): Support array-shaping operator.
(c_parser_omp_target_update): Recognize GOMP_MAP_TO_GRID and
GOMP_MAP_FROM_GRID map kinds as well as OMP_CLAUSE_TO/OMP_CLAUSE_FROM.
* c-tree.h (c_omp_array_shaping_op_p, c_omp_has_array_shape_p): New
extern declarations.
(create_omp_arrayshape_type): Add prototype.
* c-typeck.cc (c_omp_array_shaping_op_p, c_omp_has_array_shape_p): New
globals.
(build_omp_array_section): Permit integral types, not just integer
constants, when creating array types for array sections.
(create_omp_arrayshape_type): New function.
(handle_omp_array_sections_1): Add DISCONTIGUOUS parameter.  Add
strided/rectangular array section support.
(omp_array_section_low_bound): New function.
(handle_omp_array_sections): Add DISCONTIGUOUS parameter.  Add
strided/rectangular array section support.
(c_finish_omp_clauses): Update calls to handle_omp_array_sections.
Handle discontiguous updates.

gcc/testsuite/
* gcc.dg/gomp/bad-array-shaping-c-1.c: New test.
* gcc.dg/gomp/bad-array-shaping-c-2.c: New test.
* gcc.dg/gomp/bad-array-shaping-c-3.c: New test.
* gcc.dg/gomp/bad-array-shaping-c-4.c: New test.
* gcc.dg/gomp/bad-array-shaping-c-5.c: New test.
* gcc.dg/gomp/bad-array-shaping-c-6.c: New test.
* gcc.dg/gomp/bad-array-shaping-c-7.c: New test.

libgomp/
* testsuite/libgomp.c/array-shaping-1.c: New test.
* testsuite/libgomp.c/array-shaping-2.c: New test.
* testsuite/libgomp.c/array-shaping-3.c: New test.
* testsuite/libgomp.c/array-shaping-4.c: New test.
* testsuite/libgomp.c/array-shaping-5.c: New test.
* testsuite/libgomp.c/array-shaping-6.c: New test.
43 files changed:
gcc/ChangeLog.omp
gcc/c/ChangeLog.omp
gcc/c/c-parser.cc
gcc/c/c-tree.h
gcc/c/c-typeck.cc
gcc/fortran/ChangeLog.omp
gcc/fortran/trans-openmp.cc
gcc/gimplify.cc
gcc/omp-low.cc
gcc/testsuite/ChangeLog.omp
gcc/testsuite/gcc.dg/gomp/bad-array-shaping-c-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/gomp/bad-array-shaping-c-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/gomp/bad-array-shaping-c-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/gomp/bad-array-shaping-c-4.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/gomp/bad-array-shaping-c-5.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/gomp/bad-array-shaping-c-6.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/gomp/bad-array-shaping-c-7.c [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/noncontig-updates-1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/noncontig-updates-2.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/noncontig-updates-3.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/noncontig-updates-4.f90 [new file with mode: 0644]
libgomp/ChangeLog.omp
libgomp/libgomp.h
libgomp/target.c
libgomp/testsuite/libgomp.c/array-shaping-1.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/array-shaping-2.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/array-shaping-3.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/array-shaping-4.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/array-shaping-5.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/array-shaping-6.c [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/noncontig-updates-1.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/noncontig-updates-10.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/noncontig-updates-11.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/noncontig-updates-12.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/noncontig-updates-13.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/noncontig-updates-2.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/noncontig-updates-3.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/noncontig-updates-4.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/noncontig-updates-5.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/noncontig-updates-6.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/noncontig-updates-7.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/noncontig-updates-8.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/noncontig-updates-9.f90 [new file with mode: 0644]
This page took 0.089764 seconds and 6 git commands to generate.