23 #ifndef __CLANG_CUDA_CMATH_H__ 24 #define __CLANG_CUDA_CMATH_H__ 26 #error "This file is for CUDA compilation only." 47 #define __DEVICE__ static __device__ __inline__ __attribute__((always_inline)) 65 return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL,
69 return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL,
91 return __builtin_isgreater(__x, __y);
94 return __builtin_isgreater(__x, __y);
97 return __builtin_isgreaterequal(__x, __y);
100 return __builtin_isgreaterequal(__x, __y);
103 return __builtin_isless(__x, __y);
106 return __builtin_isless(__x, __y);
109 return __builtin_islessequal(__x, __y);
112 return __builtin_islessequal(__x, __y);
115 return __builtin_islessgreater(__x, __y);
118 return __builtin_islessgreater(__x, __y);
123 return __builtin_isunordered(__x, __y);
126 return __builtin_isunordered(__x, __y);
170 template<
bool __B,
class __T =
void>
179 #define __CUDA_CLANG_FN_INTEGER_OVERLOAD_1(__retty, __fn) \ 180 template <typename __T> \ 182 typename __clang_cuda_enable_if<std::numeric_limits<__T>::is_integer, \ 185 return ::__fn((double)__x); \ 193 #define __CUDA_CLANG_FN_INTEGER_OVERLOAD_2(__retty, __fn) \ 194 template <typename __T1, typename __T2> \ 195 __DEVICE__ typename __clang_cuda_enable_if< \ 196 std::numeric_limits<__T1>::is_specialized && \ 197 std::numeric_limits<__T2>::is_specialized, \ 199 __fn(__T1 __x, __T2 __y) { \ 200 return __fn((double)__x, (double)__y); \ 264 #undef __CUDA_CLANG_FN_INTEGER_OVERLOAD_1 265 #undef __CUDA_CLANG_FN_INTEGER_OVERLOAD_2 269 template <
typename __T1,
typename __T2,
typename __T3>
271 std::numeric_limits<__T1>::is_specialized &&
272 std::numeric_limits<__T2>::is_specialized &&
273 std::numeric_limits<__T3>::is_specialized,
276 return std::fma((
double)__x, (
double)__y, (
double)__z);
279 template <
typename __T>
286 template <
typename __T>
293 template <
typename __T1,
typename __T2>
295 std::numeric_limits<__T1>::is_specialized &&
296 std::numeric_limits<__T2>::is_specialized,
299 return std::remquo((
double)__x, (
double)__y, __quo);
302 template <
typename __T>
309 template <
typename __T>
320 #ifdef _LIBCPP_BEGIN_NAMESPACE_STD 321 _LIBCPP_BEGIN_NAMESPACE_STD
324 #ifdef _GLIBCXX_BEGIN_NAMESPACE_VERSION 325 _GLIBCXX_BEGIN_NAMESPACE_VERSION
461 #ifdef _LIBCPP_END_NAMESPACE_STD 462 _LIBCPP_END_NAMESPACE_STD
464 #ifdef _GLIBCXX_BEGIN_NAMESPACE_VERSION 465 _GLIBCXX_END_NAMESPACE_VERSION
__DEVICE__ float tanf(float __a)
static __inline unsigned char unsigned int unsigned int __y
__DEVICE__ int __isfinited(double __a)
__DEVICE__ __clang_cuda_enable_if< std::numeric_limits< __T1 >::is_specialized &&std::numeric_limits< __T2 >::is_specialized, double >::type remquo(__T1 __x, __T2 __y, int *__quo)
__DEVICE__ float fmodf(float __a, float __b)
__DEVICE__ bool signbit(float __x)
Test for sign bit.
__DEVICE__ float sinh(float __x)
Compute hyperbolic sine.
__DEVICE__ float acoshf(float __a)
__DEVICE__ float coshf(float __a)
__DEVICE__ long labs(long __a)
__DEVICE__ float atan2(float __x, float __y)
Arc tangent of y / x.
__DEVICE__ long long abs(long long __n)
__DEVICE__ float nextafterf(float __a, float __b)
__DEVICE__ float floor(float __x)
Round to integral value using the round to -ve infinity rounding mode.
__DEVICE__ float sqrt(float __x)
Compute square root.
__DEVICE__ int ilogbf(float __a)
__DEVICE__ float frexpf(float __a, int *__b)
__DEVICE__ float modf(float __x, float *__iptr)
Decompose a floating-point number.
__DEVICE__ float asin(float __x)
Arc sine function.
__DEVICE__ float ceilf(float __a)
__DEVICE__ float ceil(float __x)
Round to integral value using the round to positive infinity rounding mode.
__DEVICE__ bool isinf(float __x)
Test for infinity value (+ve or -ve) .
#define __CUDA_CLANG_FN_INTEGER_OVERLOAD_1(__retty, __fn)
#define __CUDA_CLANG_FN_INTEGER_OVERLOAD_2(__retty, __fn)
__DEVICE__ int __isinff(float __a)
__DEVICE__ float acos(float __x)
Arc cosine function.
__DEVICE__ float powif(float __a, int __b)
__DEVICE__ float log(float __x)
Compute natural logarithm.
__DEVICE__ float log2f(float __a)
__DEVICE__ float remquof(float __a, float __b, int *__c)
__DEVICE__ float expm1f(float __a)
__DEVICE__ float asinhf(float __a)
__DEVICE__ int fpclassify(float __x)
__DEVICE__ float sin(float __x)
Compute sine.
__DEVICE__ double powi(double __a, int __b)
#define remainder(__x, __y)
__DEVICE__ float fminf(float __a, float __b)
__DEVICE__ bool isfinite(float __x)
Test for finite value.
__DEVICE__ float sinhf(float __a)
__DEVICE__ float fmod(float __x, float __y)
Modulus.
__DEVICE__ float tan(float __x)
Compute tangent.
__DEVICE__ float acosf(float __a)
__DEVICE__ float fmaxf(float __a, float __b)
__DEVICE__ float nearbyintf(float __a)
__DEVICE__ float atanf(float __a)
__DEVICE__ float logf(float __a)
__DEVICE__ bool islessequal(float __x, float __y)
Returns the component-wise compare of x <= y.
__DEVICE__ float fmaf(float __a, float __b, float __c)
__DEVICE__ float atanhf(float __a)
__DEVICE__ float roundf(float __a)
__DEVICE__ float ldexp(float __arg, int __exp)
Multiply x by 2 to the power n.
#define copysign(__x, __y)
__DEVICE__ float fabs(float __x)
Compute absolute value of a floating-point number.
__DEVICE__ float ldexpf(float __a, int __b)
__DEVICE__ bool isunordered(float __x, float __y)
Test if arguments are unordered.
__DEVICE__ float frexp(float __arg, int *__exp)
Extract mantissa and exponent from x.
__DEVICE__ long lroundf(float __a)
__DEVICE__ float erff(float __a)
__DEVICE__ float tanhf(float __a)
__DEVICE__ float exp2f(float __a)
__DEVICE__ float fabsf(float __a)
__DEVICE__ float atan2f(float __a, float __b)
__DEVICE__ int __isinf(double __a)
__DEVICE__ float cbrtf(float __a)
static __inline unsigned char unsigned int __x
__DEVICE__ __clang_cuda_enable_if< std::numeric_limits< __T >::is_integer, double >::type scalbln(__T __x, long __exp)
__DEVICE__ long long llabs(long long __a)
__DEVICE__ float expf(float __a)
__DEVICE__ float powf(float __a, float __b)
__DEVICE__ float tgammaf(float __a)
__DEVICE__ float remainderf(float __a, float __b)
__DEVICE__ bool isgreaterequal(float __x, float __y)
Returns the component-wise compare of x >= y.
__DEVICE__ float truncf(float __a)
__DEVICE__ float asinf(float __a)
__DEVICE__ float erfcf(float __a)
__DEVICE__ float scalbnf(float __a, int __b)
__DEVICE__ float sinf(float __a)
__DEVICE__ float cos(float __x)
Compute cosine.
__DEVICE__ float log10(float __x)
Compute a base 10 logarithm.
__DEVICE__ float fdimf(float __a, float __b)
__DEVICE__ int __signbitd(double __a)
__DEVICE__ long long llrintf(float __a)
__DEVICE__ bool isnan(float __x)
Test for a NaN.
__DEVICE__ long lrintf(float __a)
__DEVICE__ bool isgreater(float __x, float __y)
Returns the component-wise compare of x > y.
__DEVICE__ float atan(float __x)
Arc tangent function.
__DEVICE__ long long llroundf(float __a)
__DEVICE__ bool islessgreater(float __x, float __y)
Returns the component-wise compare of (x < y) || (x > y) .
__DEVICE__ __clang_cuda_enable_if< std::numeric_limits< __T >::is_integer, double >::type scalbn(__T __x, int __exp)
__DEVICE__ float scalblnf(float __a, long __b)
__DEVICE__ float cosf(float __a)
__DEVICE__ int __signbitf(float __a)
#define nextafter(__x, __y)
__DEVICE__ float logbf(float __a)
__DEVICE__ float cosh(float __x)
Compute hyperbolic cosine.
__DEVICE__ float pow(float __base, float __exp)
Compute x to the power y.
__DEVICE__ float hypotf(float __a, float __b)
__DEVICE__ float sqrtf(float __a)
__DEVICE__ __clang_cuda_enable_if< std::numeric_limits< __T1 >::is_specialized &&std::numeric_limits< __T2 >::is_specialized &&std::numeric_limits< __T3 >::is_specialized, double >::type fma(__T1 __x, __T2 __y, __T3 __z)
__DEVICE__ float log10f(float __a)
__DEVICE__ bool isless(float __x, float __y)
Returns the component-wise compare of x < y.
__DEVICE__ float lgammaf(float __a)
__DEVICE__ float tanh(float __x)
Compute hyperbolic tangent.
__DEVICE__ float floorf(float __f)
__DEVICE__ int __isnan(double __a)
__DEVICE__ float modff(float __a, float *__b)
__DEVICE__ float log1pf(float __a)
__DEVICE__ float exp(float __x)
Compute the base e exponential function of x.
__DEVICE__ bool isnormal(float __x)
Test for a normal value.
__DEVICE__ int __isnanf(float __a)
__DEVICE__ int __finitef(float __a)
__DEVICE__ float copysignf(float __a, float __b)
__DEVICE__ float rintf(float __a)