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 25 namespace Fortran::runtime { 26 27 class Descriptor; 28 29 extern "C" { 30 31 void 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 36 void 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 39 void 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 42 void 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 45 void 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 49 void 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 57 void 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 62 void RTDECL(BesselJnX0_2)(Descriptor &result, int32_t n1, int32_t n2, 63 const char *sourceFile = nullptr, int line = 0); 64 65 void RTDECL(BesselJnX0_3)(Descriptor &result, int32_t n1, int32_t n2, 66 const char *sourceFile = nullptr, int line = 0); 67 68 void RTDECL(BesselJnX0_4)(Descriptor &result, int32_t n1, int32_t n2, 69 const char *sourceFile = nullptr, int line = 0); 70 71 void RTDECL(BesselJnX0_8)(Descriptor &result, int32_t n1, int32_t n2, 72 const char *sourceFile = nullptr, int line = 0); 73 74 #if HAS_FLOAT80 75 void 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 80 void RTDECL(BesselJnX0_16)(Descriptor &result, int32_t n1, int32_t n2, 81 const char *sourceFile = nullptr, int line = 0); 82 #endif 83 84 void 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 87 void 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 90 void 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 93 void 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 97 void 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 105 void 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 110 void RTDECL(BesselYnX0_2)(Descriptor &result, int32_t n1, int32_t n2, 111 const char *sourceFile = nullptr, int line = 0); 112 113 void RTDECL(BesselYnX0_3)(Descriptor &result, int32_t n1, int32_t n2, 114 const char *sourceFile = nullptr, int line = 0); 115 116 void RTDECL(BesselYnX0_4)(Descriptor &result, int32_t n1, int32_t n2, 117 const char *sourceFile = nullptr, int line = 0); 118 119 void RTDECL(BesselYnX0_8)(Descriptor &result, int32_t n1, int32_t n2, 120 const char *sourceFile = nullptr, int line = 0); 121 122 #if HAS_FLOAT80 123 void 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 128 void RTDECL(BesselYnX0_16)(Descriptor &result, int32_t n1, int32_t n2, 129 const char *sourceFile = nullptr, int line = 0); 130 #endif 131 132 void RTDECL(Cshift)(Descriptor &result, const Descriptor &source, 133 const Descriptor &shift, int dim = 1, const char *sourceFile = nullptr, 134 int line = 0); 135 void RTDECL(CshiftVector)(Descriptor &result, const Descriptor &source, 136 std::int64_t shift, const char *sourceFile = nullptr, int line = 0); 137 138 void 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); 141 void 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 145 void RTDECL(Pack)(Descriptor &result, const Descriptor &source, 146 const Descriptor &mask, const Descriptor *vector = nullptr, 147 const char *sourceFile = nullptr, int line = 0); 148 149 void RTDECL(Spread)(Descriptor &result, const Descriptor &source, int dim, 150 std::int64_t ncopies, const char *sourceFile = nullptr, int line = 0); 151 152 void RTDECL(Transpose)(Descriptor &result, const Descriptor &matrix, 153 const char *sourceFile = nullptr, int line = 0); 154 155 void 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_ 162