From 767eadd782291026b9b87be871de6bcd347c7d14 Mon Sep 17 00:00:00 2001 From: Ilya Tokar Date: Fri, 15 Nov 2019 12:29:02 -0500 Subject: [PATCH] [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 --- libcxx/include/math.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libcxx/include/math.h b/libcxx/include/math.h index 194df20..c9b4733 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 -- 2.7.4