diff options
author | Harald Anlauf <anlauf@gmx.de> | 2024-01-12 19:51:11 +0100 |
---|---|---|
committer | Harald Anlauf <anlauf@gmx.de> | 2024-01-13 14:47:24 +0100 |
commit | 9935667a69896865b848dfa690f94c9c693a48a3 (patch) | |
tree | e137e4230894767233886776cac3ec733b0f75b0 /gcc/fortran/parse.cc | |
parent | f8a5298c97c460d45e888b123fe1bbcdb49b8ad4 (diff) | |
download | gcc-9935667a69896865b848dfa690f94c9c693a48a3.zip gcc-9935667a69896865b848dfa690f94c9c693a48a3.tar.gz gcc-9935667a69896865b848dfa690f94c9c693a48a3.tar.bz2 |
Fortran: annotations for DO CONCURRENT loops [PR113305]
gcc/fortran/ChangeLog:
PR fortran/113305
* gfortran.h (gfc_loop_annot): New.
(gfc_iterator, gfc_forall_iterator): Use for annotation control.
* array.cc (gfc_copy_iterator): Adjust.
* gfortran.texi: Document annotations IVDEP, UNROLL n, VECTOR,
NOVECTOR as applied to DO CONCURRENT.
* parse.cc (parse_do_block): Parse annotations IVDEP, UNROLL n,
VECTOR, NOVECTOR as applied to DO CONCURRENT. Apply UNROLL only to
first loop control variable.
* trans-stmt.cc (iter_info): Use gfc_loop_annot.
(gfc_trans_simple_do): Adjust.
(gfc_trans_forall_loop): Annotate loops with IVDEP, UNROLL n,
VECTOR, NOVECTOR as needed for DO CONCURRENT.
(gfc_trans_forall_1): Handle loop annotations.
gcc/testsuite/ChangeLog:
PR fortran/113305
* gfortran.dg/do_concurrent_7.f90: New test.
Diffstat (limited to 'gcc/fortran/parse.cc')
-rw-r--r-- | gcc/fortran/parse.cc | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/gcc/fortran/parse.cc b/gcc/fortran/parse.cc index d8b38cf..98a04e7 100644 --- a/gcc/fortran/parse.cc +++ b/gcc/fortran/parse.cc @@ -5307,27 +5307,51 @@ parse_do_block (void) do_op = new_st.op; s.ext.end_do_label = new_st.label1; - if (new_st.ext.iterator != NULL) + if (do_op == EXEC_DO_CONCURRENT) + { + gfc_forall_iterator *fa; + for (fa = new_st.ext.forall_iterator; fa; fa = fa->next) + { + /* Apply unroll only to innermost loop (first control + variable). */ + if (directive_unroll != -1) + { + fa->annot.unroll = directive_unroll; + directive_unroll = -1; + } + if (directive_ivdep) + fa->annot.ivdep = directive_ivdep; + if (directive_vector) + fa->annot.vector = directive_vector; + if (directive_novector) + fa->annot.novector = directive_novector; + } + directive_ivdep = false; + directive_vector = false; + directive_novector = false; + stree = NULL; + } + else if (new_st.ext.iterator != NULL) { stree = new_st.ext.iterator->var->symtree; if (directive_unroll != -1) { - new_st.ext.iterator->unroll = directive_unroll; + new_st.ext.iterator->annot.unroll = directive_unroll; directive_unroll = -1; } if (directive_ivdep) { - new_st.ext.iterator->ivdep = directive_ivdep; + new_st.ext.iterator->annot.ivdep = directive_ivdep; directive_ivdep = false; } if (directive_vector) { - new_st.ext.iterator->vector = directive_vector; + new_st.ext.iterator->annot.vector = directive_vector; directive_vector = false; } if (directive_novector) { - new_st.ext.iterator->novector = directive_novector; + new_st.ext.iterator->annot.novector = directive_novector; directive_novector = false; } } |