FLANG
transformational.h
1//===-- include/flang/Runtime/transformational.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 type-independent transformational intrinsic functions
10// that rearrange data in arrays: CSHIFT, EOSHIFT, PACK, RESHAPE, SPREAD,
11// TRANSPOSE, and UNPACK.
12// These are naive allocating implementations; optimized forms that manipulate
13// pointer descriptors or that supply functional views of arrays remain to
14// be defined and may instead be part of lowering (see docs/ArrayComposition.md)
15// for details).
16
17#ifndef FORTRAN_RUNTIME_TRANSFORMATIONAL_H_
18#define FORTRAN_RUNTIME_TRANSFORMATIONAL_H_
19
20#include "flang/Common/float128.h"
21#include "flang/Runtime/cpp-type.h"
22#include "flang/Runtime/entry-names.h"
23#include <cinttypes>
24
25namespace Fortran::runtime {
26
27class Descriptor;
28
29extern "C" {
30
31void RTDECL(Reshape)(Descriptor &result, const Descriptor &source,
32 const Descriptor &shape, const Descriptor *pad = nullptr,
33 const Descriptor *order = nullptr, const char *sourceFile = nullptr,
34 int line = 0);
35
36void RTDECL(BesselJn_2)(Descriptor &result, int32_t n1, int32_t n2, float x,
37 float bn2, float bn2_1, const char *sourceFile = nullptr, int line = 0);
38
39void RTDECL(BesselJn_3)(Descriptor &result, int32_t n1, int32_t n2, float x,
40 float bn2, float bn2_1, const char *sourceFile = nullptr, int line = 0);
41
42void RTDECL(BesselJn_4)(Descriptor &result, int32_t n1, int32_t n2, float x,
43 float bn2, float bn2_1, const char *sourceFile = nullptr, int line = 0);
44
45void RTDECL(BesselJn_8)(Descriptor &result, int32_t n1, int32_t n2, double x,
46 double bn2, double bn2_1, const char *sourceFile = nullptr, int line = 0);
47
48#if HAS_FLOAT80
49void RTDECL(BesselJn_10)(Descriptor &result, int32_t n1, int32_t n2,
50 CppTypeFor<TypeCategory::Real, 10> x,
51 CppTypeFor<TypeCategory::Real, 10> bn2,
52 CppTypeFor<TypeCategory::Real, 10> bn2_1, const char *sourceFile = nullptr,
53 int line = 0);
54#endif
55
56#if HAS_LDBL128 || HAS_FLOAT128
57void RTDECL(BesselJn_16)(Descriptor &result, int32_t n1, int32_t n2,
58 CppFloat128Type x, CppFloat128Type bn2, CppFloat128Type bn2_1,
59 const char *sourceFile = nullptr, int line = 0);
60#endif
61
62void RTDECL(BesselJnX0_2)(Descriptor &result, int32_t n1, int32_t n2,
63 const char *sourceFile = nullptr, int line = 0);
64
65void RTDECL(BesselJnX0_3)(Descriptor &result, int32_t n1, int32_t n2,
66 const char *sourceFile = nullptr, int line = 0);
67
68void RTDECL(BesselJnX0_4)(Descriptor &result, int32_t n1, int32_t n2,
69 const char *sourceFile = nullptr, int line = 0);
70
71void RTDECL(BesselJnX0_8)(Descriptor &result, int32_t n1, int32_t n2,
72 const char *sourceFile = nullptr, int line = 0);
73
74#if HAS_FLOAT80
75void RTDECL(BesselJnX0_10)(Descriptor &result, int32_t n1, int32_t n2,
76 const char *sourceFile = nullptr, int line = 0);
77#endif
78
79#if HAS_LDBL128 || HAS_FLOAT128
80void RTDECL(BesselJnX0_16)(Descriptor &result, int32_t n1, int32_t n2,
81 const char *sourceFile = nullptr, int line = 0);
82#endif
83
84void RTDECL(BesselYn_2)(Descriptor &result, int32_t n1, int32_t n2, float x,
85 float bn1, float bn1_1, const char *sourceFile = nullptr, int line = 0);
86
87void RTDECL(BesselYn_3)(Descriptor &result, int32_t n1, int32_t n2, float x,
88 float bn1, float bn1_1, const char *sourceFile = nullptr, int line = 0);
89
90void RTDECL(BesselYn_4)(Descriptor &result, int32_t n1, int32_t n2, float x,
91 float bn1, float bn1_1, const char *sourceFile = nullptr, int line = 0);
92
93void RTDECL(BesselYn_8)(Descriptor &result, int32_t n1, int32_t n2, double x,
94 double bn1, double bn1_1, const char *sourceFile = nullptr, int line = 0);
95
96#if HAS_FLOAT80
97void RTDECL(BesselYn_10)(Descriptor &result, int32_t n1, int32_t n2,
98 CppTypeFor<TypeCategory::Real, 10> x,
99 CppTypeFor<TypeCategory::Real, 10> bn1,
100 CppTypeFor<TypeCategory::Real, 10> bn1_1, const char *sourceFile = nullptr,
101 int line = 0);
102#endif
103
104#if HAS_LDBL128 || HAS_FLOAT128
105void RTDECL(BesselYn_16)(Descriptor &result, int32_t n1, int32_t n2,
106 CppFloat128Type x, CppFloat128Type bn1, CppFloat128Type bn1_1,
107 const char *sourceFile = nullptr, int line = 0);
108#endif
109
110void RTDECL(BesselYnX0_2)(Descriptor &result, int32_t n1, int32_t n2,
111 const char *sourceFile = nullptr, int line = 0);
112
113void RTDECL(BesselYnX0_3)(Descriptor &result, int32_t n1, int32_t n2,
114 const char *sourceFile = nullptr, int line = 0);
115
116void RTDECL(BesselYnX0_4)(Descriptor &result, int32_t n1, int32_t n2,
117 const char *sourceFile = nullptr, int line = 0);
118
119void RTDECL(BesselYnX0_8)(Descriptor &result, int32_t n1, int32_t n2,
120 const char *sourceFile = nullptr, int line = 0);
121
122#if HAS_FLOAT80
123void RTDECL(BesselYnX0_10)(Descriptor &result, int32_t n1, int32_t n2,
124 const char *sourceFile = nullptr, int line = 0);
125#endif
126
127#if HAS_LDBL128 || HAS_FLOAT128
128void RTDECL(BesselYnX0_16)(Descriptor &result, int32_t n1, int32_t n2,
129 const char *sourceFile = nullptr, int line = 0);
130#endif
131
132void RTDECL(Cshift)(Descriptor &result, const Descriptor &source,
133 const Descriptor &shift, int dim = 1, const char *sourceFile = nullptr,
134 int line = 0);
135void RTDECL(CshiftVector)(Descriptor &result, const Descriptor &source,
136 std::int64_t shift, const char *sourceFile = nullptr, int line = 0);
137
138void RTDECL(Eoshift)(Descriptor &result, const Descriptor &source,
139 const Descriptor &shift, const Descriptor *boundary = nullptr, int dim = 1,
140 const char *sourceFile = nullptr, int line = 0);
141void RTDECL(EoshiftVector)(Descriptor &result, const Descriptor &source,
142 std::int64_t shift, const Descriptor *boundary = nullptr,
143 const char *sourceFile = nullptr, int line = 0);
144
145void RTDECL(Pack)(Descriptor &result, const Descriptor &source,
146 const Descriptor &mask, const Descriptor *vector = nullptr,
147 const char *sourceFile = nullptr, int line = 0);
148
149void RTDECL(Spread)(Descriptor &result, const Descriptor &source, int dim,
150 std::int64_t ncopies, const char *sourceFile = nullptr, int line = 0);
151
152void RTDECL(Transpose)(Descriptor &result, const Descriptor &matrix,
153 const char *sourceFile = nullptr, int line = 0);
154
155void RTDECL(Unpack)(Descriptor &result, const Descriptor &vector,
156 const Descriptor &mask, const Descriptor &field,
157 const char *sourceFile = nullptr, int line = 0);
158
159} // extern "C"
160} // namespace Fortran::runtime
161#endif // FORTRAN_RUNTIME_TRANSFORMATIONAL_H_