Index: clang/lib/Headers/__clang_cuda_cmath.h =================================================================== --- clang/lib/Headers/__clang_cuda_cmath.h +++ clang/lib/Headers/__clang_cuda_cmath.h @@ -131,15 +131,6 @@ __DEVICE__ float log(float __x) { return ::logf(__x); } __DEVICE__ float log10(float __x) { return ::log10f(__x); } __DEVICE__ float modf(float __x, float *__iptr) { return ::modff(__x, __iptr); } -__DEVICE__ float nexttoward(float __from, double __to) { - return __builtin_nexttowardf(__from, __to); -} -__DEVICE__ double nexttoward(double __from, double __to) { - return __builtin_nexttoward(__from, __to); -} -__DEVICE__ float nexttowardf(float __from, double __to) { - return __builtin_nexttowardf(__from, __to); -} __DEVICE__ float pow(float __base, float __exp) { return ::powf(__base, __exp); } @@ -157,6 +148,10 @@ __DEVICE__ float tan(float __x) { return ::tanf(__x); } __DEVICE__ float tanh(float __x) { return ::tanhf(__x); } +// Notably missing above are nexttoward and nextafter. We omit them because +// libdevice doesn't provide an implementation, and we don't want to be in the +// business of implementing tricky libm functions in this header. + // Now we've defined everything we promised we'd define in // __clang_cuda_math_forward_declares.h. We need to do two additional things to // fix up our math functions. @@ -252,7 +247,6 @@ __CUDA_CLANG_FN_INTEGER_OVERLOAD_1(long, lrint) __CUDA_CLANG_FN_INTEGER_OVERLOAD_1(long, lround) __CUDA_CLANG_FN_INTEGER_OVERLOAD_1(double, nearbyint); -__CUDA_CLANG_FN_INTEGER_OVERLOAD_2(double, nextafter); __CUDA_CLANG_FN_INTEGER_OVERLOAD_2(double, pow); __CUDA_CLANG_FN_INTEGER_OVERLOAD_2(double, remainder); __CUDA_CLANG_FN_INTEGER_OVERLOAD_1(double, rint); @@ -295,13 +289,6 @@ return std::ldexp((double)__x, __exp); } -template -__DEVICE__ typename __clang_cuda_enable_if::is_integer, - double>::type -nexttoward(__T __from, double __to) { - return std::nexttoward((double)__from, __to); -} - template __DEVICE__ typename __clang_cuda_enable_if< std::numeric_limits<__T1>::is_specialized && @@ -387,8 +374,6 @@ using ::lrint; using ::lround; using ::nearbyint; -using ::nextafter; -using ::nexttoward; using ::pow; using ::remainder; using ::remquo; @@ -455,9 +440,6 @@ using ::lroundf; using ::modff; using ::nearbyintf; -using ::nextafterf; -using ::nexttowardf; -using ::nexttowardf; using ::powf; using ::remainderf; using ::remquof; Index: clang/lib/Headers/__clang_cuda_math_forward_declares.h =================================================================== --- clang/lib/Headers/__clang_cuda_math_forward_declares.h +++ clang/lib/Headers/__clang_cuda_math_forward_declares.h @@ -147,11 +147,6 @@ __DEVICE__ float nanf(const char *); __DEVICE__ double nearbyint(double); __DEVICE__ float nearbyint(float); -__DEVICE__ double nextafter(double, double); -__DEVICE__ float nextafter(float, float); -__DEVICE__ double nexttoward(double, double); -__DEVICE__ float nexttoward(float, double); -__DEVICE__ float nexttowardf(float, double); __DEVICE__ double pow(double, double); __DEVICE__ double pow(double, int); __DEVICE__ float pow(float, float); @@ -185,6 +180,10 @@ __DEVICE__ double trunc(double); __DEVICE__ float trunc(float); +// Notably missing above are nexttoward and nextafter, which we don't define on +// the device side, because libdevice doesn't give us an implementation, and we +// don't want to be in the business of writing one ourselves. + // We need to define these overloads in exactly the namespace our standard // library uses (including the right inline namespace), otherwise they won't be // picked up by other functions in the standard library (e.g. functions in @@ -254,8 +253,6 @@ using ::nan; using ::nanf; using ::nearbyint; -using ::nextafter; -using ::nexttoward; using ::pow; using ::remainder; using ::remquo;