blob: 3f2834d95000f0201db53d2ec8f2c4cdc59ea8a4 [file] [log] [blame]
Ben Murdoch61f157c2016-09-16 13:49:30 +01001/*===- __clang_math_forward_declares.h - Prototypes of __device__ math fns --===
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 * THE SOFTWARE.
20 *
21 *===-----------------------------------------------------------------------===
22 */
23#ifndef __CLANG__CUDA_MATH_FORWARD_DECLARES_H__
24#define __CLANG__CUDA_MATH_FORWARD_DECLARES_H__
25#ifndef __CUDA__
26#error "This file is for CUDA compilation only."
27#endif
28
29// This file forward-declares of some math functions we (or the CUDA headers)
30// will define later. We need to do this, and do it before cmath is included,
31// because the standard library may have constexpr math functions. In the
32// absence of a prior __device__ decl, those constexpr functions may become
33// implicitly host+device. host+device functions can't be overloaded, so that
34// would preclude the use of our own __device__ overloads for these functions.
35
36#pragma push_macro("__DEVICE__")
37#define __DEVICE__ \
38 static __inline__ __attribute__((always_inline)) __attribute__((device))
39
40__DEVICE__ double abs(double);
41__DEVICE__ float abs(float);
42__DEVICE__ int abs(int);
43__DEVICE__ long abs(long);
44__DEVICE__ long long abs(long long);
45__DEVICE__ double acos(double);
46__DEVICE__ float acos(float);
47__DEVICE__ double acosh(double);
48__DEVICE__ float acosh(float);
49__DEVICE__ double asin(double);
50__DEVICE__ float asin(float);
51__DEVICE__ double asinh(double);
52__DEVICE__ float asinh(float);
53__DEVICE__ double atan2(double, double);
54__DEVICE__ float atan2(float, float);
55__DEVICE__ double atan(double);
56__DEVICE__ float atan(float);
57__DEVICE__ double atanh(double);
58__DEVICE__ float atanh(float);
59__DEVICE__ double cbrt(double);
60__DEVICE__ float cbrt(float);
61__DEVICE__ double ceil(double);
62__DEVICE__ float ceil(float);
63__DEVICE__ double copysign(double, double);
64__DEVICE__ float copysign(float, float);
65__DEVICE__ double cos(double);
66__DEVICE__ float cos(float);
67__DEVICE__ double cosh(double);
68__DEVICE__ float cosh(float);
69__DEVICE__ double erfc(double);
70__DEVICE__ float erfc(float);
71__DEVICE__ double erf(double);
72__DEVICE__ float erf(float);
73__DEVICE__ double exp2(double);
74__DEVICE__ float exp2(float);
75__DEVICE__ double exp(double);
76__DEVICE__ float exp(float);
77__DEVICE__ double expm1(double);
78__DEVICE__ float expm1(float);
79__DEVICE__ double fabs(double);
80__DEVICE__ float fabs(float);
81__DEVICE__ double fdim(double, double);
82__DEVICE__ float fdim(float, float);
83__DEVICE__ double floor(double);
84__DEVICE__ float floor(float);
85__DEVICE__ double fma(double, double, double);
86__DEVICE__ float fma(float, float, float);
87__DEVICE__ double fmax(double, double);
88__DEVICE__ float fmax(float, float);
89__DEVICE__ double fmin(double, double);
90__DEVICE__ float fmin(float, float);
91__DEVICE__ double fmod(double, double);
92__DEVICE__ float fmod(float, float);
93__DEVICE__ int fpclassify(double);
94__DEVICE__ int fpclassify(float);
95__DEVICE__ double frexp(double, int *);
96__DEVICE__ float frexp(float, int *);
97__DEVICE__ double hypot(double, double);
98__DEVICE__ float hypot(float, float);
99__DEVICE__ int ilogb(double);
100__DEVICE__ int ilogb(float);
101__DEVICE__ bool isfinite(double);
102__DEVICE__ bool isfinite(float);
103__DEVICE__ bool isgreater(double, double);
104__DEVICE__ bool isgreaterequal(double, double);
105__DEVICE__ bool isgreaterequal(float, float);
106__DEVICE__ bool isgreater(float, float);
107__DEVICE__ bool isinf(double);
108__DEVICE__ bool isinf(float);
109__DEVICE__ bool isless(double, double);
110__DEVICE__ bool islessequal(double, double);
111__DEVICE__ bool islessequal(float, float);
112__DEVICE__ bool isless(float, float);
113__DEVICE__ bool islessgreater(double, double);
114__DEVICE__ bool islessgreater(float, float);
115__DEVICE__ bool isnan(double);
116__DEVICE__ bool isnan(float);
117__DEVICE__ bool isnormal(double);
118__DEVICE__ bool isnormal(float);
119__DEVICE__ bool isunordered(double, double);
120__DEVICE__ bool isunordered(float, float);
121__DEVICE__ long labs(long);
122__DEVICE__ double ldexp(double, int);
123__DEVICE__ float ldexp(float, int);
124__DEVICE__ double lgamma(double);
125__DEVICE__ float lgamma(float);
126__DEVICE__ long long llabs(long long);
127__DEVICE__ long long llrint(double);
128__DEVICE__ long long llrint(float);
129__DEVICE__ double log10(double);
130__DEVICE__ float log10(float);
131__DEVICE__ double log1p(double);
132__DEVICE__ float log1p(float);
133__DEVICE__ double log2(double);
134__DEVICE__ float log2(float);
135__DEVICE__ double logb(double);
136__DEVICE__ float logb(float);
137__DEVICE__ double log(double);
138__DEVICE__ float log(float);
139__DEVICE__ long lrint(double);
140__DEVICE__ long lrint(float);
141__DEVICE__ long lround(double);
142__DEVICE__ long lround(float);
143__DEVICE__ double modf(double, double *);
144__DEVICE__ float modf(float, float *);
145__DEVICE__ double nan(const char *);
146__DEVICE__ float nanf(const char *);
147__DEVICE__ double nearbyint(double);
148__DEVICE__ float nearbyint(float);
149__DEVICE__ double nextafter(double, double);
150__DEVICE__ float nextafter(float, float);
151__DEVICE__ double nexttoward(double, double);
152__DEVICE__ float nexttoward(float, float);
153__DEVICE__ double pow(double, double);
154__DEVICE__ double pow(double, int);
155__DEVICE__ float pow(float, float);
156__DEVICE__ float pow(float, int);
157__DEVICE__ double remainder(double, double);
158__DEVICE__ float remainder(float, float);
159__DEVICE__ double remquo(double, double, int *);
160__DEVICE__ float remquo(float, float, int *);
161__DEVICE__ double rint(double);
162__DEVICE__ float rint(float);
163__DEVICE__ double round(double);
164__DEVICE__ float round(float);
165__DEVICE__ double scalbln(double, long);
166__DEVICE__ float scalbln(float, long);
167__DEVICE__ double scalbn(double, int);
168__DEVICE__ float scalbn(float, int);
169__DEVICE__ bool signbit(double);
170__DEVICE__ bool signbit(float);
171__DEVICE__ double sin(double);
172__DEVICE__ float sin(float);
173__DEVICE__ double sinh(double);
174__DEVICE__ float sinh(float);
175__DEVICE__ double sqrt(double);
176__DEVICE__ float sqrt(float);
177__DEVICE__ double tan(double);
178__DEVICE__ float tan(float);
179__DEVICE__ double tanh(double);
180__DEVICE__ float tanh(float);
181__DEVICE__ double tgamma(double);
182__DEVICE__ float tgamma(float);
183__DEVICE__ double trunc(double);
184__DEVICE__ float trunc(float);
185
186namespace std {
187using ::abs;
188using ::acos;
189using ::acosh;
190using ::asin;
191using ::asinh;
192using ::atan;
193using ::atan2;
194using ::atanh;
195using ::cbrt;
196using ::ceil;
197using ::copysign;
198using ::cos;
199using ::cosh;
200using ::erf;
201using ::erfc;
202using ::exp;
203using ::exp2;
204using ::expm1;
205using ::fabs;
206using ::fdim;
207using ::floor;
208using ::fma;
209using ::fmax;
210using ::fmin;
211using ::fmod;
212using ::fpclassify;
213using ::frexp;
214using ::hypot;
215using ::ilogb;
216using ::isfinite;
217using ::isgreater;
218using ::isgreaterequal;
219using ::isinf;
220using ::isless;
221using ::islessequal;
222using ::islessgreater;
223using ::isnan;
224using ::isnormal;
225using ::isunordered;
226using ::labs;
227using ::ldexp;
228using ::lgamma;
229using ::llabs;
230using ::llrint;
231using ::log;
232using ::log10;
233using ::log1p;
234using ::log2;
235using ::logb;
236using ::lrint;
237using ::lround;
238using ::modf;
239using ::nan;
240using ::nanf;
241using ::nearbyint;
242using ::nextafter;
243using ::nexttoward;
244using ::pow;
245using ::remainder;
246using ::remquo;
247using ::rint;
248using ::round;
249using ::scalbln;
250using ::scalbn;
251using ::signbit;
252using ::sin;
253using ::sinh;
254using ::sqrt;
255using ::tan;
256using ::tanh;
257using ::tgamma;
258using ::trunc;
259} // namespace std
260
261#pragma pop_macro("__DEVICE__")
262
263#endif