[PATCH] D25403: [CUDA] Mark __libcpp_{isnan, isinf, isfinite} as constexpr.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 9 09:19:41 PDT 2016


jlebar created this revision.
jlebar added a reviewer: hfinkel.
jlebar added a subscriber: cfe-commits.

This makes these functions available on host and device, which is
necessary to compile <complex> for the device.


https://reviews.llvm.org/D25403

Files:
  libcxx/include/cmath


Index: libcxx/include/cmath
===================================================================
--- libcxx/include/cmath
+++ libcxx/include/cmath
@@ -560,7 +560,7 @@
 
 template <class _A1>
 _LIBCPP_ALWAYS_INLINE
-typename enable_if<is_floating_point<_A1>::value, bool>::type
+_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
 __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
 {
 #if __has_builtin(__builtin_isnan)
@@ -572,15 +572,15 @@
 
 template <class _A1>
 _LIBCPP_ALWAYS_INLINE
-typename enable_if<!is_floating_point<_A1>::value, bool>::type
+_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
 __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
 {
     return isnan(__lcpp_x);
 }
 
 template <class _A1>
 _LIBCPP_ALWAYS_INLINE
-typename enable_if<is_floating_point<_A1>::value, bool>::type
+_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
 __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
 {
 #if __has_builtin(__builtin_isinf)
@@ -592,15 +592,15 @@
 
 template <class _A1>
 _LIBCPP_ALWAYS_INLINE
-typename enable_if<!is_floating_point<_A1>::value, bool>::type
+_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
 __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
 {
     return isinf(__lcpp_x);
 }
 
 template <class _A1>
 _LIBCPP_ALWAYS_INLINE
-typename enable_if<is_floating_point<_A1>::value, bool>::type
+_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
 __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
 {
 #if __has_builtin(__builtin_isfinite)
@@ -612,7 +612,7 @@
 
 template <class _A1>
 _LIBCPP_ALWAYS_INLINE
-typename enable_if<!is_floating_point<_A1>::value, bool>::type
+_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
 __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
 {
     return isfinite(__lcpp_x);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25403.74074.patch
Type: text/x-patch
Size: 1853 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161009/b8900d8f/attachment.bin>


More information about the cfe-commits mailing list