9#ifndef __CLANG_CUDA_CMATH_H__
10#define __CLANG_CUDA_CMATH_H__
12#error "This file is for CUDA compilation only."
15#ifndef __OPENMP_NVPTX__
35#ifdef __OPENMP_NVPTX__
36#define __DEVICE__ static constexpr __attribute__((always_inline, nothrow))
38#define __DEVICE__ static __device__ __inline__ __attribute__((always_inline))
57 return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL,
61 return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL,
65 return ::frexpf(__arg, __exp);
70#if !defined(_MSC_VER) || defined(__OPENMP_NVPTX__)
78#if defined(__OPENMP_NVPTX__)
79#pragma omp begin declare variant match( \
80 implementation = {extension(disable_implicit_base)})
88#pragma omp begin declare variant match(implementation = {vendor(llvm)})
97#pragma omp end declare variant
111#if defined(__OPENMP_NVPTX__)
112#pragma omp end declare variant
118 return __builtin_isgreater(__x,
__y);
121 return __builtin_isgreater(__x,
__y);
124 return __builtin_isgreaterequal(__x,
__y);
127 return __builtin_isgreaterequal(__x,
__y);
130 return __builtin_isless(__x,
__y);
133 return __builtin_isless(__x,
__y);
136 return __builtin_islessequal(__x,
__y);
139 return __builtin_islessequal(__x,
__y);
142 return __builtin_islessgreater(__x,
__y);
145 return __builtin_islessgreater(__x,
__y);
150 return __builtin_isunordered(__x,
__y);
153 return __builtin_isunordered(__x,
__y);
156 return ::ldexpf(__arg, __exp);
162 return ::powf(__base, __exp);
165 return ::powif(__base, __iexp);
168 return ::powi(__base, __iexp);
181#ifdef __OPENMP_NVPTX__
183 return ::remquof(__n, __d, __q);
191#ifndef __OPENMP_NVPTX__
208template<
bool __B,
class __T =
void>
217#define __CUDA_CLANG_FN_INTEGER_OVERLOAD_1(__retty, __fn) \
218 template <typename __T> \
220 typename __clang_cuda_enable_if<std::numeric_limits<__T>::is_integer, \
223 return ::__fn((double)__x); \
231#define __CUDA_CLANG_FN_INTEGER_OVERLOAD_2(__retty, __fn) \
232 template <typename __T1, typename __T2> \
233 __DEVICE__ typename __clang_cuda_enable_if< \
234 std::numeric_limits<__T1>::is_specialized && \
235 std::numeric_limits<__T2>::is_specialized, \
237 __fn(__T1 __x, __T2 __y) { \
238 return __fn((double)__x, (double)__y); \
302#undef __CUDA_CLANG_FN_INTEGER_OVERLOAD_1
303#undef __CUDA_CLANG_FN_INTEGER_OVERLOAD_2
307template <
typename __T1,
typename __T2,
typename __T3>
309 std::numeric_limits<__T1>::is_specialized &&
310 std::numeric_limits<__T2>::is_specialized &&
311 std::numeric_limits<__T3>::is_specialized,
314 return std::fma((
double)__x, (
double)
__y, (
double)__z);
317template <
typename __T>
321 return std::frexp((
double)__x, __exp);
324template <
typename __T>
328 return std::ldexp((
double)__x, __exp);
331template <
typename __T1,
typename __T2>
333 std::numeric_limits<__T1>::is_specialized &&
334 std::numeric_limits<__T2>::is_specialized,
337 return std::remquo((
double)__x, (
double)
__y, __quo);
340template <
typename __T>
344 return std::scalbln((
double)__x, __exp);
347template <
typename __T>
351 return std::scalbn((
double)__x, __exp);
358#ifdef _LIBCPP_BEGIN_NAMESPACE_STD
359_LIBCPP_BEGIN_NAMESPACE_STD
362#ifdef _GLIBCXX_BEGIN_NAMESPACE_VERSION
363_GLIBCXX_BEGIN_NAMESPACE_VERSION
398using ::isgreaterequal;
401using ::islessgreater;
499#ifdef _LIBCPP_END_NAMESPACE_STD
500_LIBCPP_END_NAMESPACE_STD
502#ifdef _GLIBCXX_BEGIN_NAMESPACE_VERSION
503_GLIBCXX_END_NAMESPACE_VERSION
__DEVICE__ bool isunordered(float __x, float __y)
Test if arguments are unordered.
__DEVICE__ bool isgreater(float __x, float __y)
Returns the component-wise compare of x > y.
__DEVICE__ bool islessgreater(float __x, float __y)
Returns the component-wise compare of (x < y) || (x > y) .
__DEVICE__ bool isnan(float __x)
Test for a NaN.
__DEVICE__ int fpclassify(float __x)
__DEVICE__ bool isfinite(float __x)
Test for finite value.
__DEVICE__ bool signbit(float __x)
Test for sign bit.
__DEVICE__ bool isinf(float __x)
Test for infinity value (+ve or -ve) .
__DEVICE__ float modf(float __x, float *__iptr)
#define __CUDA_CLANG_FN_INTEGER_OVERLOAD_1(__retty, __fn)
__DEVICE__ bool islessequal(float __x, float __y)
Returns the component-wise compare of x <= y.
#define __CUDA_CLANG_FN_INTEGER_OVERLOAD_2(__retty, __fn)
__DEVICE__ long long abs(long long __n)
__DEVICE__ bool isless(float __x, float __y)
Returns the component-wise compare of x < y.
__DEVICE__ bool isnormal(float __x)
Test for a normal value.
__DEVICE__ bool isgreaterequal(float __x, float __y)
Returns the component-wise compare of x >= y.
static __inline__ uint32_t uint32_t __y
#define scalbln(__x, __y)
#define copysign(__x, __y)
#define remquo(__x, __y, __z)
#define nextafter(__x, __y)
#define remainder(__x, __y)
#define fma(__x, __y, __z)