[libcxx-commits] [libcxx] 767eadd - [libcxx] use __builtin_isnan in std::isnan.

Ilya Tokar via libcxx-commits libcxx-commits at lists.llvm.org
Fri Nov 15 09:31:49 PST 2019


Author: Ilya Tokar
Date: 2019-11-15T12:29:18-05:00
New Revision: 767eadd782291026b9b87be871de6bcd347c7d14

URL: https://github.com/llvm/llvm-project/commit/767eadd782291026b9b87be871de6bcd347c7d14
DIFF: https://github.com/llvm/llvm-project/commit/767eadd782291026b9b87be871de6bcd347c7d14.diff

LOG: [libcxx] use __builtin_isnan in std::isnan.

Summary: This allows std::isnan to be fully inlined, instead of generating calls.

Reviewers: EricWF

Reviewed By: EricWF

Subscribers: christof, ldionne

Differential Revision: https://reviews.llvm.org/D69806

Added: 
    

Modified: 
    libcxx/include/math.h

Removed: 
    


################################################################################
diff  --git a/libcxx/include/math.h b/libcxx/include/math.h
index 194df2077bb1..c9b4733e9c44 100644
--- a/libcxx/include/math.h
+++ b/libcxx/include/math.h
@@ -510,7 +510,11 @@ _LIBCPP_INLINE_VISIBILITY
 bool
 __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
 {
+#if __has_builtin(__builtin_isnan)
+    return __builtin_isnan(__lcpp_x);
+#else
     return isnan(__lcpp_x);
+#endif
 }
 
 #undef isnan


        


More information about the libcxx-commits mailing list