1 /*===-- flang/runtime/complex-reduction.h ---------------------------*- C -*-===
3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 * ===-----------------------------------------------------------------------===
10 /* Wraps the C++-coded complex-valued SUM and PRODUCT reductions with
11 * C-coded wrapper functions returning _Complex values, to avoid problems
12 * with C++ build compilers that don't support C's _Complex.
15 #ifndef FORTRAN_RUNTIME_COMPLEX_REDUCTION_H_
16 #define FORTRAN_RUNTIME_COMPLEX_REDUCTION_H_
18 #include "flang/Runtime/entry-names.h"
21 struct CppDescriptor
; /* dummy type name for Fortran::runtime::Descriptor */
23 #if defined(_MSC_VER) && !(defined(__clang_major__) && __clang_major__ >= 12)
24 typedef _Fcomplex float_Complex_t
;
25 typedef _Dcomplex double_Complex_t
;
26 typedef _Lcomplex long_double_Complex_t
;
28 typedef float _Complex float_Complex_t
;
29 typedef double _Complex double_Complex_t
;
30 typedef long double _Complex long_double_Complex_t
;
33 #define REDUCTION_ARGS \
34 const struct CppDescriptor *x, const char *source, int line, int dim /*=0*/, \
35 const struct CppDescriptor *mask /*=NULL*/
36 #define REDUCTION_ARG_NAMES x, source, line, dim, mask
38 float_Complex_t
RTNAME(SumComplex2
)(REDUCTION_ARGS
);
39 float_Complex_t
RTNAME(SumComplex3
)(REDUCTION_ARGS
);
40 float_Complex_t
RTNAME(SumComplex4
)(REDUCTION_ARGS
);
41 double_Complex_t
RTNAME(SumComplex8
)(REDUCTION_ARGS
);
42 long_double_Complex_t
RTNAME(SumComplex10
)(REDUCTION_ARGS
);
43 long_double_Complex_t
RTNAME(SumComplex16
)(REDUCTION_ARGS
);
45 float_Complex_t
RTNAME(ProductComplex2
)(REDUCTION_ARGS
);
46 float_Complex_t
RTNAME(ProductComplex3
)(REDUCTION_ARGS
);
47 float_Complex_t
RTNAME(ProductComplex4
)(REDUCTION_ARGS
);
48 double_Complex_t
RTNAME(ProductComplex8
)(REDUCTION_ARGS
);
49 long_double_Complex_t
RTNAME(ProductComplex10
)(REDUCTION_ARGS
);
50 long_double_Complex_t
RTNAME(ProductComplex16
)(REDUCTION_ARGS
);
52 #define DOT_PRODUCT_ARGS \
53 const struct CppDescriptor *x, const struct CppDescriptor *y, \
54 const char *source, int line, int dim /*=0*/, \
55 const struct CppDescriptor *mask /*=NULL*/
56 #define DOT_PRODUCT_ARG_NAMES x, y, source, line, dim, mask
58 float_Complex_t
RTNAME(DotProductComplex2
)(DOT_PRODUCT_ARGS
);
59 float_Complex_t
RTNAME(DotProductComplex3
)(DOT_PRODUCT_ARGS
);
60 float_Complex_t
RTNAME(DotProductComplex4
)(DOT_PRODUCT_ARGS
);
61 double_Complex_t
RTNAME(DotProductComplex8
)(DOT_PRODUCT_ARGS
);
62 long_double_Complex_t
RTNAME(DotProductComplex10
)(DOT_PRODUCT_ARGS
);
63 long_double_Complex_t
RTNAME(DotProductComplex16
)(DOT_PRODUCT_ARGS
);
65 #endif // FORTRAN_RUNTIME_COMPLEX_REDUCTION_H_