[Patch] C, C++, Fortran, OpenMP: Add support for 'flush seq_cst' construct

Jakub Jelinek jakub@redhat.com
Tue Sep 7 08:08:50 GMT 2021


On Mon, Sep 06, 2021 at 06:08:14PM +0200, Marcel Vollweiler wrote:
> C, C++, Fortran, OpenMP: Add support for 'flush seq_cst' construct.
> 
> This patch adds support for the 'seq_cst' memory order clause on the 'flush'
> directive which was introduced in OpenMP 5.1.
> 
> gcc/c-family/ChangeLog:
> 
> 	* c-omp.c (c_finish_omp_flush): Handle MEMMODEL_SEQ_CST.
> 
> gcc/c/ChangeLog:
> 
> 	* c-parser.c (c_parser_omp_flush): Parse 'seq_cst' clause on 'flush' 
> 	directive.
> 
> gcc/cp/ChangeLog:
> 
> 	* parser.c (cp_parser_omp_flush): Parse 'seq_cst' clause on 'flush'
> 	directive.
> 	* semantics.c (finish_omp_flush): Handle MEMMODEL_SEQ_CST.
> 
> gcc/fortran/ChangeLog:
> 
> 	* openmp.c (gfc_match_omp_flush): Parse 'seq_cst' clause on 'flush'
>         directive.
> 	* trans-openmp.c (gfc_trans_omp_flush): Handle OMP_MEMORDER_SEQ_CST.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* c-c++-common/gomp/flush-1.c: Add test case for 'seq_cst'.
> 	* c-c++-common/gomp/flush-2.c: Add test case for 'seq_cst'.
> 	* g++.dg/gomp/attrs-1.C:  Adapt test to handle all flush clauses.
> 	* gfortran.dg/gomp/flush-1.f90:  Add test case for 'seq_cst'.
> 	* gfortran.dg/gomp/flush-2.f90:  Add test case for 'seq_cst'.

Just single space after :, not two.

> --- a/gcc/testsuite/g++.dg/gomp/attrs-1.C
> +++ b/gcc/testsuite/g++.dg/gomp/attrs-1.C
> @@ -528,6 +528,12 @@ bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s,
>    ;
>    [[omp::directive (flush acq_rel)]]
>    ;
> +  [[omp::directive (flush acquire)]]
> +  ;
> +  [[omp::directive (flush release)]]
> +  ;
> +  [[omp::directive (flush seq_cst)]]
> +  ;
>    [[omp::directive (flush (p, f))]]
>    ;
>    [[omp::directive (simd

When changing attrs-1.C, please also add corresponding change to attrs-2.C
too, with commas after the directive name (i.e. flush, acquire etc.).

Ok for trunk with those nits fixed, thanks.

	Jakub



More information about the Fortran mailing list