@@ -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
@@ -6686,7 +6692,10 @@ name##_by_value_adapter (void *invec, void *inoutvec, int *len, \
66866692 } \
66876693}
66886694
6695+ GEN_COREDUCE (redux_int8 , int8_t )
6696+ GEN_COREDUCE (redux_int16 , int16_t )
66896697GEN_COREDUCE (redux_int32 , int32_t )
6698+ GEN_COREDUCE (redux_int64 , int64_t )
66906699GEN_COREDUCE (redux_real32 , float )
66916700GEN_COREDUCE (redux_real64 , double )
66926701
@@ -7030,8 +7039,20 @@ PREFIX (co_reduce) (gfc_descriptor_t *a, void *(*opr) (void *, void *), int opr_
70307039 * arguments to be passed by value. */
70317040 if ((opr_flags & GFC_CAF_ARG_VALUE ) > 0 )
70327041 {
7033- int32_t_by_value = (typeof (VALUE_FUNC (int32_t )))opr ;
7034- MPI_Op_create (redux_int32_by_value_adapter , 1 , & op );
7042+ #define ifTypeGen (type ) if (GFC_DESCRIPTOR_SIZE(a) == sizeof (type ## _t)) \
7043+ { \
7044+ type ## _t_by_value = (typeof (VALUE_FUNC(type ## _t)))opr; \
7045+ MPI_Op_create(redux_ ## type ## _by_value_adapter, 1, &op); \
7046+ }
7047+
7048+ ifTypeGen (int8 )
7049+ else ifTypeGen (int16 )
7050+ else ifTypeGen (int32 )
7051+ else ifTypeGen (int64 )
7052+ else
7053+ {
7054+ caf_runtime_error ("CO_REDUCE unsupported integer datatype" );
7055+ }
70357056 }
70367057 else
70377058 {
0 commit comments