FLANG
reduction.h
1//===-- include/flang/Runtime/reduction.h -----------------------*- C++ -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9// Defines the API for the reduction transformational intrinsic functions.
10
11#ifndef FORTRAN_RUNTIME_REDUCTION_H_
12#define FORTRAN_RUNTIME_REDUCTION_H_
13
14#include "flang/Common/float128.h"
15#include "flang/Common/uint128.h"
16#include "flang/Runtime/cpp-type.h"
17#include "flang/Runtime/entry-names.h"
18#include <cstdint>
19
20namespace Fortran::runtime {
21
22class Descriptor;
23
24extern "C" {
25
26// Reductions that are known to return scalars have per-type entry
27// points. These cover the cases that either have no DIM=
28// argument or have an argument rank of 1. Pass 0 for no DIM=
29// or the value of the DIM= argument so that it may be checked.
30// The data type in the descriptor is checked against the expected
31// return type.
32//
33// Reductions that return arrays are the remaining cases in which
34// the argument rank is greater than one and there is a DIM=
35// argument present. These cases establish and allocate their
36// results in a caller-supplied descriptor, which is assumed to
37// be large enough.
38//
39// Complex-valued SUM and PRODUCT reductions and complex-valued
40// DOT_PRODUCT have their API entry points defined in complex-reduction.h;
41// these here are C wrappers around C++ implementations so as to keep
42// usage of C's _Complex types out of C++ code.
43
44// SUM()
45
46std::int8_t RTDECL(SumInteger1)(const Descriptor &, const char *source,
47 int line, int dim = 0, const Descriptor *mask = nullptr);
48std::int16_t RTDECL(SumInteger2)(const Descriptor &, const char *source,
49 int line, int dim = 0, const Descriptor *mask = nullptr);
50std::int32_t RTDECL(SumInteger4)(const Descriptor &, const char *source,
51 int line, int dim = 0, const Descriptor *mask = nullptr);
52std::int64_t RTDECL(SumInteger8)(const Descriptor &, const char *source,
53 int line, int dim = 0, const Descriptor *mask = nullptr);
54#ifdef __SIZEOF_INT128__
55common::int128_t RTDECL(SumInteger16)(const Descriptor &, const char *source,
56 int line, int dim = 0, const Descriptor *mask = nullptr);
57#endif
58std::uint8_t RTDECL(SumUnsigned1)(const Descriptor &, const char *source,
59 int line, int dim = 0, const Descriptor *mask = nullptr);
60std::uint16_t RTDECL(SumUnsigned2)(const Descriptor &, const char *source,
61 int line, int dim = 0, const Descriptor *mask = nullptr);
62std::uint32_t RTDECL(SumUnsigned4)(const Descriptor &, const char *source,
63 int line, int dim = 0, const Descriptor *mask = nullptr);
64std::uint64_t RTDECL(SumUnsigned8)(const Descriptor &, const char *source,
65 int line, int dim = 0, const Descriptor *mask = nullptr);
66#ifdef __SIZEOF_INT128__
67common::uint128_t RTDECL(SumUnsigned16)(const Descriptor &, const char *source,
68 int line, int dim = 0, const Descriptor *mask = nullptr);
69#endif
70
71// REAL/COMPLEX(2 & 3) return 32-bit float results for the caller to downconvert
72float RTDECL(SumReal2)(const Descriptor &, const char *source, int line,
73 int dim = 0, const Descriptor *mask = nullptr);
74float RTDECL(SumReal3)(const Descriptor &, const char *source, int line,
75 int dim = 0, const Descriptor *mask = nullptr);
76float RTDECL(SumReal4)(const Descriptor &, const char *source, int line,
77 int dim = 0, const Descriptor *mask = nullptr);
78double RTDECL(SumReal8)(const Descriptor &, const char *source, int line,
79 int dim = 0, const Descriptor *mask = nullptr);
80#if HAS_FLOAT80
81CppTypeFor<TypeCategory::Real, 10> RTDECL(SumReal10)(const Descriptor &,
82 const char *source, int line, int dim = 0,
83 const Descriptor *mask = nullptr);
84#endif
85#if HAS_LDBL128 || HAS_FLOAT128
86CppFloat128Type RTDECL(SumReal16)(const Descriptor &, const char *source,
87 int line, int dim = 0, const Descriptor *mask = nullptr);
88#endif
89
90void RTDECL(CppSumComplex2)(CppTypeFor<TypeCategory::Complex, 4> &,
91 const Descriptor &, const char *source, int line, int dim = 0,
92 const Descriptor *mask = nullptr);
93void RTDECL(CppSumComplex3)(CppTypeFor<TypeCategory::Complex, 4> &,
94 const Descriptor &, const char *source, int line, int dim = 0,
95 const Descriptor *mask = nullptr);
96void RTDECL(CppSumComplex4)(CppTypeFor<TypeCategory::Complex, 4> &,
97 const Descriptor &, const char *source, int line, int dim = 0,
98 const Descriptor *mask = nullptr);
99void RTDECL(CppSumComplex8)(CppTypeFor<TypeCategory::Complex, 8> &,
100 const Descriptor &, const char *source, int line, int dim = 0,
101 const Descriptor *mask = nullptr);
102#if HAS_FLOAT80
103void RTDECL(CppSumComplex10)(CppTypeFor<TypeCategory::Complex, 10> &,
104 const Descriptor &, const char *source, int line, int dim = 0,
105 const Descriptor *mask = nullptr);
106#endif
107#if HAS_LDBL128 || HAS_FLOAT128
108void RTDECL(CppSumComplex16)(CppTypeFor<TypeCategory::Complex, 16> &,
109 const Descriptor &, const char *source, int line, int dim = 0,
110 const Descriptor *mask = nullptr);
111#endif
112
113void RTDECL(SumDim)(Descriptor &result, const Descriptor &array, int dim,
114 const char *source, int line, const Descriptor *mask = nullptr);
115
116// PRODUCT()
117
118std::int8_t RTDECL(ProductInteger1)(const Descriptor &, const char *source,
119 int line, int dim = 0, const Descriptor *mask = nullptr);
120std::int16_t RTDECL(ProductInteger2)(const Descriptor &, const char *source,
121 int line, int dim = 0, const Descriptor *mask = nullptr);
122std::int32_t RTDECL(ProductInteger4)(const Descriptor &, const char *source,
123 int line, int dim = 0, const Descriptor *mask = nullptr);
124std::int64_t RTDECL(ProductInteger8)(const Descriptor &, const char *source,
125 int line, int dim = 0, const Descriptor *mask = nullptr);
126#ifdef __SIZEOF_INT128__
127common::int128_t RTDECL(ProductInteger16)(const Descriptor &,
128 const char *source, int line, int dim = 0,
129 const Descriptor *mask = nullptr);
130#endif
131std::uint8_t RTDECL(ProductUnsigned1)(const Descriptor &, const char *source,
132 int line, int dim = 0, const Descriptor *mask = nullptr);
133std::uint16_t RTDECL(ProductUnsigned2)(const Descriptor &, const char *source,
134 int line, int dim = 0, const Descriptor *mask = nullptr);
135std::uint32_t RTDECL(ProductUnsigned4)(const Descriptor &, const char *source,
136 int line, int dim = 0, const Descriptor *mask = nullptr);
137std::uint64_t RTDECL(ProductUnsigned8)(const Descriptor &, const char *source,
138 int line, int dim = 0, const Descriptor *mask = nullptr);
139#ifdef __SIZEOF_INT128__
140common::uint128_t RTDECL(ProductUnsigned16)(const Descriptor &,
141 const char *source, int line, int dim = 0,
142 const Descriptor *mask = nullptr);
143#endif
144
145// REAL/COMPLEX(2 & 3) return 32-bit float results for the caller to downconvert
146float RTDECL(ProductReal2)(const Descriptor &, const char *source, int line,
147 int dim = 0, const Descriptor *mask = nullptr);
148float RTDECL(ProductReal3)(const Descriptor &, const char *source, int line,
149 int dim = 0, const Descriptor *mask = nullptr);
150float RTDECL(ProductReal4)(const Descriptor &, const char *source, int line,
151 int dim = 0, const Descriptor *mask = nullptr);
152double RTDECL(ProductReal8)(const Descriptor &, const char *source, int line,
153 int dim = 0, const Descriptor *mask = nullptr);
154#if HAS_FLOAT80
155CppTypeFor<TypeCategory::Real, 10> RTDECL(ProductReal10)(const Descriptor &,
156 const char *source, int line, int dim = 0,
157 const Descriptor *mask = nullptr);
158#endif
159#if HAS_LDBL128 || HAS_FLOAT128
160CppFloat128Type RTDECL(ProductReal16)(const Descriptor &, const char *source,
161 int line, int dim = 0, const Descriptor *mask = nullptr);
162#endif
163
164void RTDECL(CppProductComplex2)(CppTypeFor<TypeCategory::Complex, 4> &,
165 const Descriptor &, const char *source, int line, int dim = 0,
166 const Descriptor *mask = nullptr);
167void RTDECL(CppProductComplex3)(CppTypeFor<TypeCategory::Complex, 4> &,
168 const Descriptor &, const char *source, int line, int dim = 0,
169 const Descriptor *mask = nullptr);
170void RTDECL(CppProductComplex4)(CppTypeFor<TypeCategory::Complex, 4> &,
171 const Descriptor &, const char *source, int line, int dim = 0,
172 const Descriptor *mask = nullptr);
173void RTDECL(CppProductComplex8)(CppTypeFor<TypeCategory::Complex, 8> &,
174 const Descriptor &, const char *source, int line, int dim = 0,
175 const Descriptor *mask = nullptr);
176#if HAS_FLOAT80
177void RTDECL(CppProductComplex10)(CppTypeFor<TypeCategory::Complex, 10> &,
178 const Descriptor &, const char *source, int line, int dim = 0,
179 const Descriptor *mask = nullptr);
180#endif
181#if HAS_LDBL128 || HAS_FLOAT128
182void RTDECL(CppProductComplex16)(CppTypeFor<TypeCategory::Complex, 16> &,
183 const Descriptor &, const char *source, int line, int dim = 0,
184 const Descriptor *mask = nullptr);
185#endif
186
187void RTDECL(ProductDim)(Descriptor &result, const Descriptor &array, int dim,
188 const char *source, int line, const Descriptor *mask = nullptr);
189
190// IALL, IANY, IPARITY
191std::int8_t RTDECL(IAll1)(const Descriptor &, const char *source, int line,
192 int dim = 0, const Descriptor *mask = nullptr);
193std::int16_t RTDECL(IAll2)(const Descriptor &, const char *source, int line,
194 int dim = 0, const Descriptor *mask = nullptr);
195std::int32_t RTDECL(IAll4)(const Descriptor &, const char *source, int line,
196 int dim = 0, const Descriptor *mask = nullptr);
197std::int64_t RTDECL(IAll8)(const Descriptor &, const char *source, int line,
198 int dim = 0, const Descriptor *mask = nullptr);
199#ifdef __SIZEOF_INT128__
200common::int128_t RTDECL(IAll16)(const Descriptor &, const char *source,
201 int line, int dim = 0, const Descriptor *mask = nullptr);
202#endif
203void RTDECL(IAllDim)(Descriptor &result, const Descriptor &array, int dim,
204 const char *source, int line, const Descriptor *mask = nullptr);
205
206std::int8_t RTDECL(IAny1)(const Descriptor &, const char *source, int line,
207 int dim = 0, const Descriptor *mask = nullptr);
208std::int16_t RTDECL(IAny2)(const Descriptor &, const char *source, int line,
209 int dim = 0, const Descriptor *mask = nullptr);
210std::int32_t RTDECL(IAny4)(const Descriptor &, const char *source, int line,
211 int dim = 0, const Descriptor *mask = nullptr);
212std::int64_t RTDECL(IAny8)(const Descriptor &, const char *source, int line,
213 int dim = 0, const Descriptor *mask = nullptr);
214#ifdef __SIZEOF_INT128__
215common::int128_t RTDECL(IAny16)(const Descriptor &, const char *source,
216 int line, int dim = 0, const Descriptor *mask = nullptr);
217#endif
218void RTDECL(IAnyDim)(Descriptor &result, const Descriptor &array, int dim,
219 const char *source, int line, const Descriptor *mask = nullptr);
220
221std::int8_t RTDECL(IParity1)(const Descriptor &, const char *source, int line,
222 int dim = 0, const Descriptor *mask = nullptr);
223std::int16_t RTDECL(IParity2)(const Descriptor &, const char *source, int line,
224 int dim = 0, const Descriptor *mask = nullptr);
225std::int32_t RTDECL(IParity4)(const Descriptor &, const char *source, int line,
226 int dim = 0, const Descriptor *mask = nullptr);
227std::int64_t RTDECL(IParity8)(const Descriptor &, const char *source, int line,
228 int dim = 0, const Descriptor *mask = nullptr);
229#ifdef __SIZEOF_INT128__
230common::int128_t RTDECL(IParity16)(const Descriptor &, const char *source,
231 int line, int dim = 0, const Descriptor *mask = nullptr);
232#endif
233void RTDECL(IParityDim)(Descriptor &result, const Descriptor &array, int dim,
234 const char *source, int line, const Descriptor *mask = nullptr);
235
236// FINDLOC, MAXLOC, & MINLOC
237// These return allocated arrays in the supplied descriptor.
238// The default value for KIND= should be the default INTEGER in effect at
239// compilation time.
240void RTDECL(Findloc)(Descriptor &, const Descriptor &x,
241 const Descriptor &target, int kind, const char *source, int line,
242 const Descriptor *mask = nullptr, bool back = false);
243void RTDECL(FindlocDim)(Descriptor &, const Descriptor &x,
244 const Descriptor &target, int kind, int dim, const char *source, int line,
245 const Descriptor *mask = nullptr, bool back = false);
246void RTDECL(MaxlocCharacter)(Descriptor &, const Descriptor &, int kind,
247 const char *source, int line, const Descriptor *mask = nullptr,
248 bool back = false);
249void RTDECL(MaxlocInteger1)(Descriptor &, const Descriptor &, int kind,
250 const char *source, int line, const Descriptor *mask = nullptr,
251 bool back = false);
252void RTDECL(MaxlocInteger2)(Descriptor &, const Descriptor &, int kind,
253 const char *source, int line, const Descriptor *mask = nullptr,
254 bool back = false);
255void RTDECL(MaxlocInteger4)(Descriptor &, const Descriptor &, int kind,
256 const char *source, int line, const Descriptor *mask = nullptr,
257 bool back = false);
258void RTDECL(MaxlocInteger8)(Descriptor &, const Descriptor &, int kind,
259 const char *source, int line, const Descriptor *mask = nullptr,
260 bool back = false);
261void RTDECL(MaxlocInteger16)(Descriptor &, const Descriptor &, int kind,
262 const char *source, int line, const Descriptor *mask = nullptr,
263 bool back = false);
264void RTDECL(MaxlocUnsigned1)(Descriptor &, const Descriptor &, int kind,
265 const char *source, int line, const Descriptor *mask = nullptr,
266 bool back = false);
267void RTDECL(MaxlocUnsigned2)(Descriptor &, const Descriptor &, int kind,
268 const char *source, int line, const Descriptor *mask = nullptr,
269 bool back = false);
270void RTDECL(MaxlocUnsigned4)(Descriptor &, const Descriptor &, int kind,
271 const char *source, int line, const Descriptor *mask = nullptr,
272 bool back = false);
273void RTDECL(MaxlocUnsigned8)(Descriptor &, const Descriptor &, int kind,
274 const char *source, int line, const Descriptor *mask = nullptr,
275 bool back = false);
276void RTDECL(MaxlocUnsigned16)(Descriptor &, const Descriptor &, int kind,
277 const char *source, int line, const Descriptor *mask = nullptr,
278 bool back = false);
279void RTDECL(MaxlocReal4)(Descriptor &, const Descriptor &, int kind,
280 const char *source, int line, const Descriptor *mask = nullptr,
281 bool back = false);
282void RTDECL(MaxlocReal8)(Descriptor &, const Descriptor &, int kind,
283 const char *source, int line, const Descriptor *mask = nullptr,
284 bool back = false);
285void RTDECL(MaxlocReal10)(Descriptor &, const Descriptor &, int kind,
286 const char *source, int line, const Descriptor *mask = nullptr,
287 bool back = false);
288void RTDECL(MaxlocReal16)(Descriptor &, const Descriptor &, int kind,
289 const char *source, int line, const Descriptor *mask = nullptr,
290 bool back = false);
291void RTDECL(MaxlocDim)(Descriptor &, const Descriptor &x, int kind, int dim,
292 const char *source, int line, const Descriptor *mask = nullptr,
293 bool back = false);
294void RTDECL(MinlocCharacter)(Descriptor &, const Descriptor &, int kind,
295 const char *source, int line, const Descriptor *mask = nullptr,
296 bool back = false);
297void RTDECL(MinlocInteger1)(Descriptor &, const Descriptor &, int kind,
298 const char *source, int line, const Descriptor *mask = nullptr,
299 bool back = false);
300void RTDECL(MinlocInteger2)(Descriptor &, const Descriptor &, int kind,
301 const char *source, int line, const Descriptor *mask = nullptr,
302 bool back = false);
303void RTDECL(MinlocInteger4)(Descriptor &, const Descriptor &, int kind,
304 const char *source, int line, const Descriptor *mask = nullptr,
305 bool back = false);
306void RTDECL(MinlocInteger8)(Descriptor &, const Descriptor &, int kind,
307 const char *source, int line, const Descriptor *mask = nullptr,
308 bool back = false);
309void RTDECL(MinlocInteger16)(Descriptor &, const Descriptor &, int kind,
310 const char *source, int line, const Descriptor *mask = nullptr,
311 bool back = false);
312void RTDECL(MinlocUnsigned1)(Descriptor &, const Descriptor &, int kind,
313 const char *source, int line, const Descriptor *mask = nullptr,
314 bool back = false);
315void RTDECL(MinlocUnsigned2)(Descriptor &, const Descriptor &, int kind,
316 const char *source, int line, const Descriptor *mask = nullptr,
317 bool back = false);
318void RTDECL(MinlocUnsigned4)(Descriptor &, const Descriptor &, int kind,
319 const char *source, int line, const Descriptor *mask = nullptr,
320 bool back = false);
321void RTDECL(MinlocUnsigned8)(Descriptor &, const Descriptor &, int kind,
322 const char *source, int line, const Descriptor *mask = nullptr,
323 bool back = false);
324void RTDECL(MinlocUnsigned16)(Descriptor &, const Descriptor &, int kind,
325 const char *source, int line, const Descriptor *mask = nullptr,
326 bool back = false);
327void RTDECL(MinlocReal4)(Descriptor &, const Descriptor &, int kind,
328 const char *source, int line, const Descriptor *mask = nullptr,
329 bool back = false);
330void RTDECL(MinlocReal8)(Descriptor &, const Descriptor &, int kind,
331 const char *source, int line, const Descriptor *mask = nullptr,
332 bool back = false);
333void RTDECL(MinlocReal10)(Descriptor &, const Descriptor &, int kind,
334 const char *source, int line, const Descriptor *mask = nullptr,
335 bool back = false);
336void RTDECL(MinlocReal16)(Descriptor &, const Descriptor &, int kind,
337 const char *source, int line, const Descriptor *mask = nullptr,
338 bool back = false);
339void RTDECL(MinlocDim)(Descriptor &, const Descriptor &x, int kind, int dim,
340 const char *source, int line, const Descriptor *mask = nullptr,
341 bool back = false);
342
343// MAXVAL and MINVAL
344std::int8_t RTDECL(MaxvalInteger1)(const Descriptor &, const char *source,
345 int line, int dim = 0, const Descriptor *mask = nullptr);
346std::int16_t RTDECL(MaxvalInteger2)(const Descriptor &, const char *source,
347 int line, int dim = 0, const Descriptor *mask = nullptr);
348std::int32_t RTDECL(MaxvalInteger4)(const Descriptor &, const char *source,
349 int line, int dim = 0, const Descriptor *mask = nullptr);
350std::int64_t RTDECL(MaxvalInteger8)(const Descriptor &, const char *source,
351 int line, int dim = 0, const Descriptor *mask = nullptr);
352#ifdef __SIZEOF_INT128__
353common::int128_t RTDECL(MaxvalInteger16)(const Descriptor &, const char *source,
354 int line, int dim = 0, const Descriptor *mask = nullptr);
355#endif
356std::uint8_t RTDECL(MaxvalUnsigned1)(const Descriptor &, const char *source,
357 int line, int dim = 0, const Descriptor *mask = nullptr);
358std::uint16_t RTDECL(MaxvalUnsigned2)(const Descriptor &, const char *source,
359 int line, int dim = 0, const Descriptor *mask = nullptr);
360std::uint32_t RTDECL(MaxvalUnsigned4)(const Descriptor &, const char *source,
361 int line, int dim = 0, const Descriptor *mask = nullptr);
362std::uint64_t RTDECL(MaxvalUnsigned8)(const Descriptor &, const char *source,
363 int line, int dim = 0, const Descriptor *mask = nullptr);
364#ifdef __SIZEOF_INT128__
365common::uint128_t RTDECL(MaxvalUnsigned16)(const Descriptor &,
366 const char *source, int line, int dim = 0,
367 const Descriptor *mask = nullptr);
368#endif
369float RTDECL(MaxvalReal2)(const Descriptor &, const char *source, int line,
370 int dim = 0, const Descriptor *mask = nullptr);
371float RTDECL(MaxvalReal3)(const Descriptor &, const char *source, int line,
372 int dim = 0, const Descriptor *mask = nullptr);
373float RTDECL(MaxvalReal4)(const Descriptor &, const char *source, int line,
374 int dim = 0, const Descriptor *mask = nullptr);
375double RTDECL(MaxvalReal8)(const Descriptor &, const char *source, int line,
376 int dim = 0, const Descriptor *mask = nullptr);
377#if HAS_FLOAT80
378CppTypeFor<TypeCategory::Real, 10> RTDECL(MaxvalReal10)(const Descriptor &,
379 const char *source, int line, int dim = 0,
380 const Descriptor *mask = nullptr);
381#endif
382#if HAS_LDBL128 || HAS_FLOAT128
383CppFloat128Type RTDECL(MaxvalReal16)(const Descriptor &, const char *source,
384 int line, int dim = 0, const Descriptor *mask = nullptr);
385#endif
386void RTDECL(MaxvalCharacter)(Descriptor &, const Descriptor &,
387 const char *source, int line, const Descriptor *mask = nullptr);
388
389std::int8_t RTDECL(MinvalInteger1)(const Descriptor &, const char *source,
390 int line, int dim = 0, const Descriptor *mask = nullptr);
391std::int16_t RTDECL(MinvalInteger2)(const Descriptor &, const char *source,
392 int line, int dim = 0, const Descriptor *mask = nullptr);
393std::int32_t RTDECL(MinvalInteger4)(const Descriptor &, const char *source,
394 int line, int dim = 0, const Descriptor *mask = nullptr);
395std::int64_t RTDECL(MinvalInteger8)(const Descriptor &, const char *source,
396 int line, int dim = 0, const Descriptor *mask = nullptr);
397#ifdef __SIZEOF_INT128__
398common::int128_t RTDECL(MinvalInteger16)(const Descriptor &, const char *source,
399 int line, int dim = 0, const Descriptor *mask = nullptr);
400#endif
401std::uint8_t RTDECL(MinvalUnsigned1)(const Descriptor &, const char *source,
402 int line, int dim = 0, const Descriptor *mask = nullptr);
403std::uint16_t RTDECL(MinvalUnsigned2)(const Descriptor &, const char *source,
404 int line, int dim = 0, const Descriptor *mask = nullptr);
405std::uint32_t RTDECL(MinvalUnsigned4)(const Descriptor &, const char *source,
406 int line, int dim = 0, const Descriptor *mask = nullptr);
407std::uint64_t RTDECL(MinvalUnsigned8)(const Descriptor &, const char *source,
408 int line, int dim = 0, const Descriptor *mask = nullptr);
409#ifdef __SIZEOF_INT128__
410common::uint128_t RTDECL(MinvalUnsigned16)(const Descriptor &,
411 const char *source, int line, int dim = 0,
412 const Descriptor *mask = nullptr);
413#endif
414float RTDECL(MinvalReal2)(const Descriptor &, const char *source, int line,
415 int dim = 0, const Descriptor *mask = nullptr);
416float RTDECL(MinvalReal3)(const Descriptor &, const char *source, int line,
417 int dim = 0, const Descriptor *mask = nullptr);
418float RTDECL(MinvalReal4)(const Descriptor &, const char *source, int line,
419 int dim = 0, const Descriptor *mask = nullptr);
420double RTDECL(MinvalReal8)(const Descriptor &, const char *source, int line,
421 int dim = 0, const Descriptor *mask = nullptr);
422#if HAS_FLOAT80
423CppTypeFor<TypeCategory::Real, 10> RTDECL(MinvalReal10)(const Descriptor &,
424 const char *source, int line, int dim = 0,
425 const Descriptor *mask = nullptr);
426#endif
427#if HAS_LDBL128 || HAS_FLOAT128
428CppFloat128Type RTDECL(MinvalReal16)(const Descriptor &, const char *source,
429 int line, int dim = 0, const Descriptor *mask = nullptr);
430#endif
431void RTDECL(MinvalCharacter)(Descriptor &, const Descriptor &,
432 const char *source, int line, const Descriptor *mask = nullptr);
433
434void RTDECL(MaxvalDim)(Descriptor &, const Descriptor &, int dim,
435 const char *source, int line, const Descriptor *mask = nullptr);
436void RTDECL(MinvalDim)(Descriptor &, const Descriptor &, int dim,
437 const char *source, int line, const Descriptor *mask = nullptr);
438
439// NORM2
440float RTDECL(Norm2_2)(
441 const Descriptor &, const char *source, int line, int dim = 0);
442float RTDECL(Norm2_3)(
443 const Descriptor &, const char *source, int line, int dim = 0);
444float RTDECL(Norm2_4)(
445 const Descriptor &, const char *source, int line, int dim = 0);
446double RTDECL(Norm2_8)(
447 const Descriptor &, const char *source, int line, int dim = 0);
448#if HAS_FLOAT80
449CppTypeFor<TypeCategory::Real, 10> RTDECL(Norm2_10)(
450 const Descriptor &, const char *source, int line, int dim = 0);
451#endif
452#if HAS_LDBL128 || HAS_FLOAT128
453CppFloat128Type RTDECL(Norm2_16)(
454 const Descriptor &, const char *source, int line, int dim = 0);
455void RTDECL(Norm2DimReal16)(
456 Descriptor &, const Descriptor &, int dim, const char *source, int line);
457#endif
458void RTDECL(Norm2Dim)(
459 Descriptor &, const Descriptor &, int dim, const char *source, int line);
460
461// ALL, ANY, COUNT, & PARITY logical reductions
462bool RTDECL(All)(const Descriptor &, const char *source, int line, int dim = 0);
463void RTDECL(AllDim)(Descriptor &result, const Descriptor &, int dim,
464 const char *source, int line);
465bool RTDECL(Any)(const Descriptor &, const char *source, int line, int dim = 0);
466void RTDECL(AnyDim)(Descriptor &result, const Descriptor &, int dim,
467 const char *source, int line);
468std::int64_t RTDECL(Count)(
469 const Descriptor &, const char *source, int line, int dim = 0);
470void RTDECL(CountDim)(Descriptor &result, const Descriptor &, int dim, int kind,
471 const char *source, int line);
472bool RTDECL(Parity)(
473 const Descriptor &, const char *source, int line, int dim = 0);
474void RTDECL(ParityDim)(Descriptor &result, const Descriptor &, int dim,
475 const char *source, int line);
476
477// DOT_PRODUCT
478std::int8_t RTDECL(DotProductInteger1)(const Descriptor &, const Descriptor &,
479 const char *source = nullptr, int line = 0);
480std::int16_t RTDECL(DotProductInteger2)(const Descriptor &, const Descriptor &,
481 const char *source = nullptr, int line = 0);
482std::int32_t RTDECL(DotProductInteger4)(const Descriptor &, const Descriptor &,
483 const char *source = nullptr, int line = 0);
484std::int64_t RTDECL(DotProductInteger8)(const Descriptor &, const Descriptor &,
485 const char *source = nullptr, int line = 0);
486#ifdef __SIZEOF_INT128__
487common::int128_t RTDECL(DotProductInteger16)(const Descriptor &,
488 const Descriptor &, const char *source = nullptr, int line = 0);
489#endif
490std::uint8_t RTDECL(DotProductUnsigned1)(const Descriptor &, const Descriptor &,
491 const char *source = nullptr, int line = 0);
492std::uint16_t RTDECL(DotProductUnsigned2)(const Descriptor &,
493 const Descriptor &, const char *source = nullptr, int line = 0);
494std::uint32_t RTDECL(DotProductUnsigned4)(const Descriptor &,
495 const Descriptor &, const char *source = nullptr, int line = 0);
496std::uint64_t RTDECL(DotProductUnsigned8)(const Descriptor &,
497 const Descriptor &, const char *source = nullptr, int line = 0);
498#ifdef __SIZEOF_INT128__
499common::uint128_t RTDECL(DotProductUnsigned16)(const Descriptor &,
500 const Descriptor &, const char *source = nullptr, int line = 0);
501#endif
502float RTDECL(DotProductReal2)(const Descriptor &, const Descriptor &,
503 const char *source = nullptr, int line = 0);
504float RTDECL(DotProductReal3)(const Descriptor &, const Descriptor &,
505 const char *source = nullptr, int line = 0);
506float RTDECL(DotProductReal4)(const Descriptor &, const Descriptor &,
507 const char *source = nullptr, int line = 0);
508double RTDECL(DotProductReal8)(const Descriptor &, const Descriptor &,
509 const char *source = nullptr, int line = 0);
510#if HAS_FLOAT80
511CppTypeFor<TypeCategory::Real, 10> RTDECL(DotProductReal10)(const Descriptor &,
512 const Descriptor &, const char *source = nullptr, int line = 0);
513#endif
514#if HAS_LDBL128 || HAS_FLOAT128
515CppFloat128Type RTDECL(DotProductReal16)(const Descriptor &, const Descriptor &,
516 const char *source = nullptr, int line = 0);
517#endif
518void RTDECL(CppDotProductComplex2)(CppTypeFor<TypeCategory::Complex, 4> &,
519 const Descriptor &, const Descriptor &, const char *source = nullptr,
520 int line = 0);
521void RTDECL(CppDotProductComplex3)(CppTypeFor<TypeCategory::Complex, 4> &,
522 const Descriptor &, const Descriptor &, const char *source = nullptr,
523 int line = 0);
524void RTDECL(CppDotProductComplex4)(CppTypeFor<TypeCategory::Complex, 4> &,
525 const Descriptor &, const Descriptor &, const char *source = nullptr,
526 int line = 0);
527void RTDECL(CppDotProductComplex8)(CppTypeFor<TypeCategory::Complex, 8> &,
528 const Descriptor &, const Descriptor &, const char *source = nullptr,
529 int line = 0);
530#if HAS_FLOAT80
531void RTDECL(CppDotProductComplex10)(CppTypeFor<TypeCategory::Complex, 10> &,
532 const Descriptor &, const Descriptor &, const char *source = nullptr,
533 int line = 0);
534#endif
535#if HAS_LDBL128 || HAS_FLOAT128
536void RTDECL(CppDotProductComplex16)(CppTypeFor<TypeCategory::Complex, 16> &,
537 const Descriptor &, const Descriptor &, const char *source = nullptr,
538 int line = 0);
539#endif
540bool RTDECL(DotProductLogical)(const Descriptor &, const Descriptor &,
541 const char *source = nullptr, int line = 0);
542
543} // extern "C"
544} // namespace Fortran::runtime
545#endif // FORTRAN_RUNTIME_REDUCTION_H_