@@ -263,13 +263,19 @@ bool caf_owns_mpi = false;
263263
264264/* Foo function pointers for coreduce.
265265 The handles when arguments are passed by reference. */
266+ int (* int8_t_by_reference )(void * , void * );
267+ int (* int16_t_by_reference )(void * , void * );
266268int (* int32_t_by_reference )(void * , void * );
269+ int (* int64_t_by_reference )(void * , void * );
267270float (* float_by_reference )(void * , void * );
268271double (* double_by_reference )(void * , void * );
269272/* Strings are always passed by reference. */
270273void (* char_by_reference )(void * , int , void * , void * , int , int );
271274/* The handles when arguments are passed by value. */
275+ int8_t (* int8_t_by_value )(int8_t , int8_t );
276+ int16_t (* int16_t_by_value )(int16_t , int16_t );
272277int (* int32_t_by_value )(int32_t , int32_t );
278+ int64_t (* int64_t_by_value )(int64_t , int64_t );
273279float (* float_by_value )(float , float );
274280double (* double_by_value )(double , double );
275281
@@ -6635,7 +6641,10 @@ name##_by_value_adapter (void *invec, void *inoutvec, int *len, \
66356641 } \
66366642}
66376643
6644+ GEN_COREDUCE (redux_int8 , int8_t )
6645+ GEN_COREDUCE (redux_int16 , int16_t )
66386646GEN_COREDUCE (redux_int32 , int32_t )
6647+ GEN_COREDUCE (redux_int64 , int64_t )
66396648GEN_COREDUCE (redux_real32 , float )
66406649GEN_COREDUCE (redux_real64 , double )
66416650
@@ -6979,8 +6988,20 @@ PREFIX (co_reduce) (gfc_descriptor_t *a, void *(*opr) (void *, void *), int opr_
69796988 * arguments to be passed by value. */
69806989 if ((opr_flags & GFC_CAF_ARG_VALUE ) > 0 )
69816990 {
6982- int32_t_by_value = (typeof (VALUE_FUNC (int32_t )))opr ;
6983- MPI_Op_create (redux_int32_by_value_adapter , 1 , & op );
6991+ #define ifTypeGen (type ) if (GFC_DESCRIPTOR_SIZE(a) == sizeof (type ## _t)) \
6992+ { \
6993+ type ## _t_by_value = (typeof (VALUE_FUNC(type ## _t)))opr; \
6994+ MPI_Op_create(redux_ ## type ## _by_value_adapter, 1, &op); \
6995+ }
6996+
6997+ ifTypeGen (int8 )
6998+ else ifTypeGen (int16 )
6999+ else ifTypeGen (int32 )
7000+ else ifTypeGen (int64 )
7001+ else
7002+ {
7003+ caf_runtime_error ("CO_REDUCE unsupported integer datatype" );
7004+ }
69847005 }
69857006 else
69867007 {
0 commit comments