[PATCH] D60220: [CUDA][Windows] Final fix for bug 38811 (Step 3 of 3)

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 3 11:27:51 PDT 2019


tra added inline comments.


================
Comment at: clang/lib/Headers/__clang_cuda_cmath.h:81-90
+__DEVICE__ bool isinf(long double __x) { return ::__isinfl(__x); }
 __DEVICE__ bool isfinite(float __x) { return ::__finitef(__x); }
 // For inscrutable reasons, __finite(), the double-precision version of
 // __finitef, does not exist when compiling for MacOS.  __isfinited is available
 // everywhere and is just as good.
 __DEVICE__ bool isfinite(double __x) { return ::__isfinited(__x); }
+__DEVICE__ bool isfinite(long double __x) { return ::__finitel(__x); }
----------------
CUDA [[ https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#long-double | does not support]]  long double on device side, so I would rather see a compilation error when someone attempts to use a long double, as opposed to providing inconsistent support for it. 

I wonder if we could just provide declarations for these functions. This should allow math_functions.hpp to compile, but would still prevent any use of `long double` on device side.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60220/new/

https://reviews.llvm.org/D60220





More information about the cfe-commits mailing list