Re: [PATCH 04/14] libstdc++: Optimize std::is_floating_point compilation performance

2024-01-10 Thread Jonathan Wakely
On Wed, 10 Jan 2024 at 19:43, Ken Matsui  wrote:
>
> This patch optimizes the compilation performance of
> std::is_floating_point by dispatching to the new
> __is_floating_point built-in trait.

OK for trunk (if the new built-in is approved).


>
> libstdc++-v3/ChangeLog:
>
> * include/std/type_traits (is_floating_point): Use
> __is_floating_point built-in trait.
> (is_floating_point_v): Likewise.
>
> Signed-off-by: Ken Matsui 
> ---
>  libstdc++-v3/include/std/type_traits | 13 +
>  1 file changed, 13 insertions(+)
>
> diff --git a/libstdc++-v3/include/std/type_traits 
> b/libstdc++-v3/include/std/type_traits
> index afa281d9cc4..23ea70eca18 100644
> --- a/libstdc++-v3/include/std/type_traits
> +++ b/libstdc++-v3/include/std/type_traits
> @@ -470,6 +470,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>  { };
>  #endif
>
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_floating_point)
> +  /// is_floating_point
> +  template
> +struct is_floating_point
> +: public __bool_constant<__is_floating_point(_Tp)>
> +{ };
> +#else
>/// @cond undocumented
>template
>  struct __is_floating_point_helper
> @@ -529,6 +536,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>  struct is_floating_point
>  : public __is_floating_point_helper<__remove_cv_t<_Tp>>::type
>  { };
> +#endif
>
>/// is_array
>  #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_array)
> @@ -3238,8 +3246,13 @@ template 
>inline constexpr bool is_integral_v = is_integral<_Tp>::value;
>  #endif
>
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_floating_point)
> +template 
> +  inline constexpr bool is_floating_point_v = __is_floating_point(_Tp);
> +#else
>  template 
>inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value;
> +#endif
>
>  #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_array)
>  template 
> --
> 2.43.0
>



[PATCH 04/14] libstdc++: Optimize std::is_floating_point compilation performance

2024-01-10 Thread Ken Matsui
This patch optimizes the compilation performance of
std::is_floating_point by dispatching to the new
__is_floating_point built-in trait.

libstdc++-v3/ChangeLog:

* include/std/type_traits (is_floating_point): Use
__is_floating_point built-in trait.
(is_floating_point_v): Likewise.

Signed-off-by: Ken Matsui 
---
 libstdc++-v3/include/std/type_traits | 13 +
 1 file changed, 13 insertions(+)

diff --git a/libstdc++-v3/include/std/type_traits 
b/libstdc++-v3/include/std/type_traits
index afa281d9cc4..23ea70eca18 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -470,6 +470,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 { };
 #endif
 
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_floating_point)
+  /// is_floating_point
+  template
+struct is_floating_point
+: public __bool_constant<__is_floating_point(_Tp)>
+{ };
+#else
   /// @cond undocumented
   template
 struct __is_floating_point_helper
@@ -529,6 +536,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 struct is_floating_point
 : public __is_floating_point_helper<__remove_cv_t<_Tp>>::type
 { };
+#endif
 
   /// is_array
 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_array)
@@ -3238,8 +3246,13 @@ template 
   inline constexpr bool is_integral_v = is_integral<_Tp>::value;
 #endif
 
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_floating_point)
+template 
+  inline constexpr bool is_floating_point_v = __is_floating_point(_Tp);
+#else
 template 
   inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value;
+#endif
 
 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_array)
 template 
-- 
2.43.0