diff options
author | burnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-09-25 06:07:15 +0000 |
---|---|---|
committer | burnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-09-25 06:07:15 +0000 |
commit | 52306a180a2a0b9058112e9d54b76def8f8be75b (patch) | |
tree | ea6982429800a36515244a6e806f388dff9ccc3b /gcc/fortran/trans-intrinsic.c | |
parent | 611c73ea0132f1ed756139d270f5b828686372a9 (diff) | |
download | gcc-52306a180a2a0b9058112e9d54b76def8f8be75b.tar.gz |
2014-09-25 Tobias Burnus <burnus@net-b.de>
gcc/fortran
* check.c (check_co_collective): Renamed from
* check_co_minmaxsum,
handle co_reduce.
(gfc_check_co_minmax, gfc_check_co_sum): Update call.
(gfc_check_co_broadcast, gfc_check_co_reduce): New.
* gfortran.h (gfc_isym_id): Add GFC_ISYM_CO_BROADCAST and
GFC_ISYM_CO_REDUCE.
* intrinsic.c (add_subroutines): Add co_reduce and co_broadcast.
* intrinsic.h (gfc_check_co_broadcast, gfc_check_co_reduce): Add
proto types.
* intrinsic.texi (CO_BROADCAST): Add.
* trans.h (gfor_fndecl_co_broadcast): New.
* trans-decl.c (gfor_fndecl_co_broadcast): Ditto.
(gfc_build_builtin_function_decls): Add decl for it,
* trans-intrinsic.c (conv_co_collective): Renamed from
conv_co_minmaxsum. Handle co_reduce.
(gfc_conv_intrinsic_subroutine): Handle co_reduce.
gcc/testsuite/
* gfortran.dg/coarray/collectives_3.f90: New.
* gfortran.dg/coarray_collectives_9.f90: New.
* gfortran.dg/coarray_collectives_10.f90: New.
* gfortran.dg/coarray_collectives_11.f90: New.
* gfortran.dg/coarray_collectives_12.f90: New.
libgfortran/
* caf/libcaf.h (_gfortran_caf_co_broadcast): New prototype.
* caf/single.c (_gfortran_caf_co_broadcast): New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215579 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-intrinsic.c')
-rw-r--r-- | gcc/fortran/trans-intrinsic.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 55079463b7d..0a3315d9cfa 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -8173,7 +8173,7 @@ gfc_walk_intrinsic_function (gfc_ss * ss, gfc_expr * expr, static tree -conv_co_minmaxsum (gfc_code *code) +conv_co_collective (gfc_code *code) { gfc_se argse; stmtblock_t block, post_block; @@ -8263,16 +8263,26 @@ conv_co_minmaxsum (gfc_code *code) } /* Generate the function call. */ - if (code->resolved_isym->id == GFC_ISYM_CO_MAX) - fndecl = gfor_fndecl_co_max; - else if (code->resolved_isym->id == GFC_ISYM_CO_MIN) - fndecl = gfor_fndecl_co_min; - else if (code->resolved_isym->id == GFC_ISYM_CO_SUM) - fndecl = gfor_fndecl_co_sum; - else - gcc_unreachable (); + switch (code->resolved_isym->id) + { + case GFC_ISYM_CO_BROADCAST: + fndecl = gfor_fndecl_co_broadcast; + break; + case GFC_ISYM_CO_MAX: + fndecl = gfor_fndecl_co_max; + break; + case GFC_ISYM_CO_MIN: + fndecl = gfor_fndecl_co_min; + break; + case GFC_ISYM_CO_SUM: + fndecl = gfor_fndecl_co_sum; + break; + default: + gcc_unreachable (); + } - if (code->resolved_isym->id == GFC_ISYM_CO_SUM) + if (code->resolved_isym->id == GFC_ISYM_CO_SUM + || code->resolved_isym->id == GFC_ISYM_CO_BROADCAST) fndecl = build_call_expr_loc (input_location, fndecl, 5, array, image_index, stat, errmsg, errmsg_len); else @@ -8281,7 +8291,6 @@ conv_co_minmaxsum (gfc_code *code) gfc_add_expr_to_block (&block, fndecl); gfc_add_block_to_block (&block, &post_block); - /* Add CALL to CO_SUM/MIN/MAX: array descriptor, vector descriptor, stat, errmsg, strlen, errmsglen */ return gfc_finish_block (&block); } @@ -8992,10 +9001,14 @@ gfc_conv_intrinsic_subroutine (gfc_code *code) res = conv_caf_send (code); break; + case GFC_ISYM_CO_REDUCE: + gcc_unreachable (); + break; + case GFC_ISYM_CO_BROADCAST: case GFC_ISYM_CO_MIN: case GFC_ISYM_CO_MAX: case GFC_ISYM_CO_SUM: - res = conv_co_minmaxsum (code); + res = conv_co_collective (code); break; case GFC_ISYM_SYSTEM_CLOCK: |