[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
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 767eadd782291026b9b87be871de6bcd347c7d14
diff --git a/include/math.h b/include/math.h
index 194df20..c9b4733 100644
--- a/include/math.h
+++ b/include/math.h
@@ -510,7 +510,11 @@
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