public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 00/14] Optimize integral-related type traits
@ 2024-01-10  9:22 Ken Matsui
  2024-01-10  9:22 ` [PATCH 01/14] c++: Implement __is_integral built-in trait Ken Matsui
                   ` (13 more replies)
  0 siblings, 14 replies; 30+ messages in thread
From: Ken Matsui @ 2024-01-10  9:22 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Ken Matsui

This patch series implements __is_integral, __is_floating_point,
__is_arithmetic, __is_unsigned, __is_signed, and __is_scalar built-in
traits and optimizes std::is_integral, std::is_floating_point,
std::is_arithmetic, std::is_unsigned, std::is_signed, std::is_scalar,
std::is_fundamental, and std::is_compound compilation performance.
Here are the benchmark results:

std::is_integral: https://github.com/ken-matsui/gcc-bench/blob/main/is_integral.md#wed-jan-10-112014-am-pst-2024
Time: -28.5606%, Peak Mem: -25.0022%, Total Mem: -22.4503%

std::is_integral_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_integral_v.md#wed-jan-10-112014-am-pst-2024
Time: -44.9068%, Peak Mem: -37.046%, Total Mem: -36.3088%

std::is_floating_point: https://github.com/ken-matsui/gcc-bench/blob/main/is_floating_point.md#wed-jan-10-112014-am-pst-2024
Time: -22.1413%, Peak Mem: -24.9831%, Total Mem: -22.4503%

std::is_floating_point_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_floating_point_v.md#wed-jan-10-112014-am-pst-2024
Time: -44.9223%, Peak Mem: -37.0304%, Total Mem: -36.2869%

std::is_arithmetic: https://github.com/ken-matsui/gcc-bench/blob/main/is_arithmetic.md#wed-jan-10-112014-am-pst-2024
Time: -67.5805%, Peak Mem: -55.3318%, Total Mem: -58.5106%

std::is_arithmetic_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_arithmetic_v.md#wed-jan-10-112014-am-pst-2024
Time: -74.1939%, Peak Mem: -61.3623%, Total Mem: -64.8586%

std::is_fundamental: https://github.com/ken-matsui/gcc-bench/blob/main/is_fundamental.md#wed-jan-10-112014-am-pst-2024
Time: -62.5392%, Peak Mem: -49.5002%, Total Mem: -53.3734%

std::is_fundamental_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_fundamental_v.md#wed-jan-10-112014-am-pst-2024
Time: -56.9926%, Peak Mem: -49.3151%, Total Mem: -53.8913%

std::is_compound: https://github.com/ken-matsui/gcc-bench/blob/main/is_compound.md#wed-jan-10-112014-am-pst-2024
Time: -56.3176%, Peak Mem: -45.7971%, Total Mem: -49.4637%

std::is_compound_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_compound_v.md#wed-jan-10-112014-am-pst-2024
Time: -56.0783%, Peak Mem: -47.7484%, Total Mem: -52.5631%

std::is_unsigned: https://github.com/ken-matsui/gcc-bench/blob/main/is_unsigned.md#wed-jan-10-112014-am-pst-2024
Time: -75.9165%, Peak Mem: -65.632%, Total Mem: -68.8883%

std::is_unsigned_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_unsigned_v.md#wed-jan-10-112014-am-pst-2024
Time: -81.7237%, Peak Mem: -70.1175%, Total Mem: -73.4473%

std::is_signed: https://github.com/ken-matsui/gcc-bench/blob/main/is_signed.md#wed-jan-10-112014-am-pst-2024
Time: -72.8341%, Peak Mem: -61.9239%, Total Mem: -64.5455%

std::is_signed_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_signed_v.md#wed-jan-10-112014-am-pst-2024
Time: -79.9365%, Peak Mem: -66.9684%, Total Mem: -69.8372%

std::is_scalar: https://github.com/ken-matsui/gcc-bench/blob/main/is_scalar.md#wed-jan-10-112014-am-pst-2024
Time: -87.2356%, Peak Mem: -79.0888%, Total Mem: -82.2095%

std::is_scalar_v: https://github.com/ken-matsui/gcc-bench/blob/main/is_scalar_v.md#wed-jan-10-112014-am-pst-2024
Time: -89.5349%, Peak Mem: -83.2528%, Total Mem: -85.6074%

Ken Matsui (14):
  c++: Implement __is_integral built-in trait
  libstdc++: Optimize std::is_integral compilation performance
  c++: Implement __is_floating_point built-in trait
  libstdc++: Optimize std::is_floating_point compilation performance
  c++: Implement __is_arithmetic built-in trait
  libstdc++: Optimize std::is_arithmetic compilation performance
  libstdc++: Optimize std::is_fundamental compilation performance
  libstdc++: Optimize std::is_compound compilation performance
  c++: Implement __is_unsigned built-in trait
  libstdc++: Optimize std::is_unsigned compilation performance
  c++: Implement __is_signed built-in trait
  libstdc++: Optimize std::is_signed compilation performance
  c++: Implement __is_scalar built-in trait
  libstdc++: Optimize std::is_scalar compilation performance

 gcc/cp/constraint.cc                         |  18 ++++
 gcc/cp/cp-trait.def                          |   6 ++
 gcc/cp/semantics.cc                          |  65 +++++++++++-
 gcc/testsuite/g++.dg/ext/has-builtin-1.C     |  18 ++++
 gcc/testsuite/g++.dg/ext/is_arithmetic.C     |  31 ++++++
 gcc/testsuite/g++.dg/ext/is_floating_point.C |  43 ++++++++
 gcc/testsuite/g++.dg/ext/is_integral.C       |  49 +++++++++
 gcc/testsuite/g++.dg/ext/is_scalar.C         |  28 +++++
 gcc/testsuite/g++.dg/ext/is_signed.C         |  45 +++++++++
 gcc/testsuite/g++.dg/ext/is_unsigned.C       |  45 +++++++++
 libstdc++-v3/include/std/type_traits         | 101 ++++++++++++++++++-
 11 files changed, 441 insertions(+), 8 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/ext/is_arithmetic.C
 create mode 100644 gcc/testsuite/g++.dg/ext/is_floating_point.C
 create mode 100644 gcc/testsuite/g++.dg/ext/is_integral.C
 create mode 100644 gcc/testsuite/g++.dg/ext/is_scalar.C
 create mode 100644 gcc/testsuite/g++.dg/ext/is_signed.C
 create mode 100644 gcc/testsuite/g++.dg/ext/is_unsigned.C

-- 
2.43.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 01/14] c++: Implement __is_integral built-in trait
  2024-01-10  9:22 [PATCH 00/14] Optimize integral-related type traits Ken Matsui
@ 2024-01-10  9:22 ` Ken Matsui
  2024-01-17  0:30   ` Jason Merrill
  2024-01-10  9:22 ` [PATCH 02/14] libstdc++: Optimize std::is_integral compilation performance Ken Matsui
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Ken Matsui @ 2024-01-10  9:22 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Ken Matsui

This patch implements built-in trait for std::is_integral.

gcc/cp/ChangeLog:

	* cp-trait.def: Define __is_integral.
	* constraint.cc (diagnose_trait_expr): Handle
	CPTK_IS_INTEGRAL.
	* semantics.cc (trait_expr_value): Likewise.
	(finish_trait_expr): Likewise.
	(integral_type_p): New function.

gcc/testsuite/ChangeLog:

	* g++.dg/ext/has-builtin-1.C: Test existence of __is_integral.
	* g++.dg/ext/is_integral.C: New test.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
 gcc/cp/constraint.cc                     |  3 ++
 gcc/cp/cp-trait.def                      |  1 +
 gcc/cp/semantics.cc                      | 18 +++++++++
 gcc/testsuite/g++.dg/ext/has-builtin-1.C |  3 ++
 gcc/testsuite/g++.dg/ext/is_integral.C   | 49 ++++++++++++++++++++++++
 5 files changed, 74 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/ext/is_integral.C

diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
index fef68cf7ab2..3a105a2ee2a 100644
--- a/gcc/cp/constraint.cc
+++ b/gcc/cp/constraint.cc
@@ -3755,6 +3755,9 @@ diagnose_trait_expr (tree expr, tree args)
     case CPTK_IS_FUNCTION:
       inform (loc, "  %qT is not a function", t1);
       break;
+    case CPTK_IS_INTEGRAL:
+      inform (loc, "  %qT is not an integral type", t1);
+      break;
     case CPTK_IS_LAYOUT_COMPATIBLE:
       inform (loc, "  %qT is not layout compatible with %qT", t1, t2);
       break;
diff --git a/gcc/cp/cp-trait.def b/gcc/cp/cp-trait.def
index 394f006f20f..2773c3fa10e 100644
--- a/gcc/cp/cp-trait.def
+++ b/gcc/cp/cp-trait.def
@@ -70,6 +70,7 @@ DEFTRAIT_EXPR (IS_EMPTY, "__is_empty", 1)
 DEFTRAIT_EXPR (IS_ENUM, "__is_enum", 1)
 DEFTRAIT_EXPR (IS_FINAL, "__is_final", 1)
 DEFTRAIT_EXPR (IS_FUNCTION, "__is_function", 1)
+DEFTRAIT_EXPR (IS_INTEGRAL, "__is_integral", 1)
 DEFTRAIT_EXPR (IS_LAYOUT_COMPATIBLE, "__is_layout_compatible", 2)
 DEFTRAIT_EXPR (IS_LITERAL_TYPE, "__is_literal_type", 1)
 DEFTRAIT_EXPR (IS_MEMBER_FUNCTION_POINTER, "__is_member_function_pointer", 1)
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index 3299e270446..1a335f69826 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -12258,6 +12258,20 @@ is_corresponding_member_aggr (location_t loc, tree basetype1, tree membertype1,
   return ret;
 }
 
+/* Return true if T is an integral type.  With __STRICT_ANSI__, __int128 and
+   unsigned __int128 are not integral types.  */
+
+static bool
+integral_type_p (const_tree t)
+{
+  if (flag_iso)
+    return CP_INTEGRAL_TYPE_P (t)
+      && t != intTI_type_node
+      && t != unsigned_intTI_type_node;
+  else
+    return CP_INTEGRAL_TYPE_P (t);
+}
+
 /* Fold __builtin_is_corresponding_member call.  */
 
 tree
@@ -12465,6 +12479,9 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2)
     case CPTK_IS_FUNCTION:
       return type_code1 == FUNCTION_TYPE;
 
+    case CPTK_IS_INTEGRAL:
+      return integral_type_p (type1);
+
     case CPTK_IS_LAYOUT_COMPATIBLE:
       return layout_compatible_type_p (type1, type2);
 
@@ -12691,6 +12708,7 @@ finish_trait_expr (location_t loc, cp_trait_kind kind, tree type1, tree type2)
     case CPTK_IS_CLASS:
     case CPTK_IS_ENUM:
     case CPTK_IS_FUNCTION:
+    case CPTK_IS_INTEGRAL:
     case CPTK_IS_MEMBER_FUNCTION_POINTER:
     case CPTK_IS_MEMBER_OBJECT_POINTER:
     case CPTK_IS_MEMBER_POINTER:
diff --git a/gcc/testsuite/g++.dg/ext/has-builtin-1.C b/gcc/testsuite/g++.dg/ext/has-builtin-1.C
index 02b4b4d745d..d621171481c 100644
--- a/gcc/testsuite/g++.dg/ext/has-builtin-1.C
+++ b/gcc/testsuite/g++.dg/ext/has-builtin-1.C
@@ -89,6 +89,9 @@
 #if !__has_builtin (__is_function)
 # error "__has_builtin (__is_function) failed"
 #endif
+#if !__has_builtin (__is_integral)
+# error "__has_builtin (__is_integral) failed"
+#endif
 #if !__has_builtin (__is_layout_compatible)
 # error "__has_builtin (__is_layout_compatible) failed"
 #endif
diff --git a/gcc/testsuite/g++.dg/ext/is_integral.C b/gcc/testsuite/g++.dg/ext/is_integral.C
new file mode 100644
index 00000000000..d2c732133dd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/is_integral.C
@@ -0,0 +1,49 @@
+// { dg-do compile { target c++11 } }
+
+#define SA(X) static_assert((X),#X)
+
+#define SA_TEST_CATEGORY(TRAIT, TYPE, EXPECT)	\
+  SA(TRAIT(TYPE) == EXPECT);			\
+  SA(TRAIT(const TYPE) == EXPECT);		\
+  SA(TRAIT(volatile TYPE) == EXPECT);		\
+  SA(TRAIT(const volatile TYPE) == EXPECT)
+
+SA_TEST_CATEGORY(__is_integral, void, false);
+
+SA_TEST_CATEGORY(__is_integral, char, true);
+SA_TEST_CATEGORY(__is_integral, signed char, true);
+SA_TEST_CATEGORY(__is_integral, unsigned char, true);
+SA_TEST_CATEGORY(__is_integral, wchar_t, true);
+#ifdef _GLIBCXX_USE_CHAR8_T
+SA_TEST_CATEGORY(__is_integral, char8_t, true);
+#endif
+SA_TEST_CATEGORY(__is_integral, char16_t, true);
+SA_TEST_CATEGORY(__is_integral, char32_t, true);
+SA_TEST_CATEGORY(__is_integral, short, true);
+SA_TEST_CATEGORY(__is_integral, unsigned short, true);
+SA_TEST_CATEGORY(__is_integral, int, true);
+SA_TEST_CATEGORY(__is_integral, unsigned int, true);
+SA_TEST_CATEGORY(__is_integral, long, true);
+SA_TEST_CATEGORY(__is_integral, unsigned long, true);
+SA_TEST_CATEGORY(__is_integral, long long, true);
+SA_TEST_CATEGORY(__is_integral, unsigned long long, true);
+
+SA_TEST_CATEGORY(__is_integral, float, false);
+SA_TEST_CATEGORY(__is_integral, double, false);
+SA_TEST_CATEGORY(__is_integral, long double, false);
+
+#ifndef __STRICT_ANSI__
+// GNU Extensions.
+#ifdef __SIZEOF_INT128__
+SA_TEST_CATEGORY(__is_integral, __int128, true);
+SA_TEST_CATEGORY(__is_integral, unsigned __int128, true);
+#endif
+
+#ifdef _GLIBCXX_USE_FLOAT128
+SA_TEST_CATEGORY(__is_integral, __float128, false);
+#endif
+#endif
+
+// Sanity check.
+class ClassType { };
+SA_TEST_CATEGORY(__is_integral, ClassType, false);
-- 
2.43.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 02/14] libstdc++: Optimize std::is_integral compilation performance
  2024-01-10  9:22 [PATCH 00/14] Optimize integral-related type traits Ken Matsui
  2024-01-10  9:22 ` [PATCH 01/14] c++: Implement __is_integral built-in trait Ken Matsui
@ 2024-01-10  9:22 ` Ken Matsui
  2024-01-10 21:19   ` Jonathan Wakely
  2024-01-10  9:22 ` [PATCH 03/14] c++: Implement __is_floating_point built-in trait Ken Matsui
                   ` (11 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Ken Matsui @ 2024-01-10  9:22 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Ken Matsui

This patch optimizes the compilation performance of std::is_integral
by dispatching to the new __is_integral built-in trait.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (is_integral): Use __is_integral
	built-in trait.
	(is_integral_v): Likewise.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
 libstdc++-v3/include/std/type_traits | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 1cec0822b73..afa281d9cc4 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -334,6 +334,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     struct is_void<const volatile void>
     : public true_type { };
 
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_integral)
+  /// is_integral
+  template<typename _Tp>
+    struct is_integral
+    : public __bool_constant<__is_integral(_Tp)>
+    { };
+#else
   /// @cond undocumented
   template<typename>
     struct __is_integral_helper
@@ -461,6 +468,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     struct is_integral
     : public __is_integral_helper<__remove_cv_t<_Tp>>::type
     { };
+#endif
 
   /// @cond undocumented
   template<typename>
@@ -3221,8 +3229,15 @@ template <typename _Tp>
   inline constexpr bool is_void_v = is_void<_Tp>::value;
 template <typename _Tp>
   inline constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value;
+
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_integral)
+template <typename _Tp>
+  inline constexpr bool is_integral_v = __is_integral(_Tp);
+#else
 template <typename _Tp>
   inline constexpr bool is_integral_v = is_integral<_Tp>::value;
+#endif
+
 template <typename _Tp>
   inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value;
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 03/14] c++: Implement __is_floating_point built-in trait
  2024-01-10  9:22 [PATCH 00/14] Optimize integral-related type traits Ken Matsui
  2024-01-10  9:22 ` [PATCH 01/14] c++: Implement __is_integral built-in trait Ken Matsui
  2024-01-10  9:22 ` [PATCH 02/14] libstdc++: Optimize std::is_integral compilation performance Ken Matsui
@ 2024-01-10  9:22 ` Ken Matsui
  2024-01-17  0:36   ` Jason Merrill
  2024-01-10  9:22 ` [PATCH 04/14] libstdc++: Optimize std::is_floating_point compilation performance Ken Matsui
                   ` (10 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Ken Matsui @ 2024-01-10  9:22 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Ken Matsui

This patch implements built-in trait for std::is_floating_point.

gcc/cp/ChangeLog:

	* cp-trait.def: Define __is_floating_point.
	* constraint.cc (diagnose_trait_expr): Handle
	CPTK_IS_FLOATING_POINT.
	* semantics.cc (trait_expr_value): Likewise.
	(finish_trait_expr): Likewise.
	(floating_point_type_p): New function.

gcc/testsuite/ChangeLog:

	* g++.dg/ext/has-builtin-1.C: Test existence of
	__is_floating_point.
	* g++.dg/ext/is_floating_point.C: New test.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
 gcc/cp/constraint.cc                         |  3 ++
 gcc/cp/cp-trait.def                          |  1 +
 gcc/cp/semantics.cc                          | 17 ++++++++
 gcc/testsuite/g++.dg/ext/has-builtin-1.C     |  3 ++
 gcc/testsuite/g++.dg/ext/is_floating_point.C | 43 ++++++++++++++++++++
 5 files changed, 67 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/ext/is_floating_point.C

diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
index 3a105a2ee2a..aca0b91711f 100644
--- a/gcc/cp/constraint.cc
+++ b/gcc/cp/constraint.cc
@@ -3752,6 +3752,9 @@ diagnose_trait_expr (tree expr, tree args)
     case CPTK_IS_FINAL:
       inform (loc, "  %qT is not a final class", t1);
       break;
+    case CPTK_IS_FLOATING_POINT:
+      inform (loc, "  %qT is not a floating point type", t1);
+      break;
     case CPTK_IS_FUNCTION:
       inform (loc, "  %qT is not a function", t1);
       break;
diff --git a/gcc/cp/cp-trait.def b/gcc/cp/cp-trait.def
index 2773c3fa10e..acf668d48ee 100644
--- a/gcc/cp/cp-trait.def
+++ b/gcc/cp/cp-trait.def
@@ -69,6 +69,7 @@ DEFTRAIT_EXPR (IS_CONVERTIBLE, "__is_convertible", 2)
 DEFTRAIT_EXPR (IS_EMPTY, "__is_empty", 1)
 DEFTRAIT_EXPR (IS_ENUM, "__is_enum", 1)
 DEFTRAIT_EXPR (IS_FINAL, "__is_final", 1)
+DEFTRAIT_EXPR (IS_FLOATING_POINT, "__is_floating_point", 1)
 DEFTRAIT_EXPR (IS_FUNCTION, "__is_function", 1)
 DEFTRAIT_EXPR (IS_INTEGRAL, "__is_integral", 1)
 DEFTRAIT_EXPR (IS_LAYOUT_COMPATIBLE, "__is_layout_compatible", 2)
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index 1a335f69826..c052e47c204 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -12272,6 +12272,19 @@ integral_type_p (const_tree t)
     return CP_INTEGRAL_TYPE_P (t);
 }
 
+/* Return true if T is a floating point type.  With __STRICT_ANSI__, __float128
+   is not a floating point type.  However, _Float128 is a floating point type.
+   */
+
+static bool
+floating_point_type_p (const_tree t)
+{
+  if (flag_iso)
+    return SCALAR_FLOAT_TYPE_P (t) && t != float128t_type_node;
+  else
+    return SCALAR_FLOAT_TYPE_P (t);
+}
+
 /* Fold __builtin_is_corresponding_member call.  */
 
 tree
@@ -12476,6 +12489,9 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2)
     case CPTK_IS_FINAL:
       return CLASS_TYPE_P (type1) && CLASSTYPE_FINAL (type1);
 
+    case CPTK_IS_FLOATING_POINT:
+      return floating_point_type_p (type1);
+
     case CPTK_IS_FUNCTION:
       return type_code1 == FUNCTION_TYPE;
 
@@ -12707,6 +12723,7 @@ finish_trait_expr (location_t loc, cp_trait_kind kind, tree type1, tree type2)
     case CPTK_IS_BOUNDED_ARRAY:
     case CPTK_IS_CLASS:
     case CPTK_IS_ENUM:
+    case CPTK_IS_FLOATING_POINT:
     case CPTK_IS_FUNCTION:
     case CPTK_IS_INTEGRAL:
     case CPTK_IS_MEMBER_FUNCTION_POINTER:
diff --git a/gcc/testsuite/g++.dg/ext/has-builtin-1.C b/gcc/testsuite/g++.dg/ext/has-builtin-1.C
index d621171481c..5dc70a19e79 100644
--- a/gcc/testsuite/g++.dg/ext/has-builtin-1.C
+++ b/gcc/testsuite/g++.dg/ext/has-builtin-1.C
@@ -86,6 +86,9 @@
 #if !__has_builtin (__is_final)
 # error "__has_builtin (__is_final) failed"
 #endif
+#if !__has_builtin (__is_floating_point)
+# error "__has_builtin (__is_floating_point) failed"
+#endif
 #if !__has_builtin (__is_function)
 # error "__has_builtin (__is_function) failed"
 #endif
diff --git a/gcc/testsuite/g++.dg/ext/is_floating_point.C b/gcc/testsuite/g++.dg/ext/is_floating_point.C
new file mode 100644
index 00000000000..1807279dfc2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/is_floating_point.C
@@ -0,0 +1,43 @@
+// { dg-do compile { target c++11 } }
+
+#define SA(X) static_assert((X),#X)
+
+#define SA_TEST_CATEGORY(TRAIT, TYPE, EXPECT)	\
+  SA(TRAIT(TYPE) == EXPECT);			\
+  SA(TRAIT(const TYPE) == EXPECT);		\
+  SA(TRAIT(volatile TYPE) == EXPECT);		\
+  SA(TRAIT(const volatile TYPE) == EXPECT)
+
+SA_TEST_CATEGORY(__is_floating_point, void, false);
+SA_TEST_CATEGORY(__is_floating_point, char, false);
+SA_TEST_CATEGORY(__is_floating_point, signed char, false);
+SA_TEST_CATEGORY(__is_floating_point, unsigned char, false);
+SA_TEST_CATEGORY(__is_floating_point, wchar_t, false);
+SA_TEST_CATEGORY(__is_floating_point, short, false);
+SA_TEST_CATEGORY(__is_floating_point, unsigned short, false);
+SA_TEST_CATEGORY(__is_floating_point, int, false);
+SA_TEST_CATEGORY(__is_floating_point, unsigned int, false);
+SA_TEST_CATEGORY(__is_floating_point, long, false);
+SA_TEST_CATEGORY(__is_floating_point, unsigned long, false);
+SA_TEST_CATEGORY(__is_floating_point, long long, false);
+SA_TEST_CATEGORY(__is_floating_point, unsigned long long, false);
+
+SA_TEST_CATEGORY(__is_floating_point, float, true);
+SA_TEST_CATEGORY(__is_floating_point, double, true);
+SA_TEST_CATEGORY(__is_floating_point, long double, true);
+
+#ifndef __STRICT_ANSI__
+// GNU Extensions.
+#ifdef _GLIBCXX_USE_FLOAT128
+SA_TEST_CATEGORY(__is_floating_point, __float128, true);
+#endif
+
+#ifdef __SIZEOF_INT128__
+SA_TEST_CATEGORY(__is_floating_point, __int128, false);
+SA_TEST_CATEGORY(__is_floating_point, unsigned __int128, false);
+#endif
+#endif
+
+// Sanity check.
+class ClassType { };
+SA_TEST_CATEGORY(__is_floating_point, ClassType, false);
-- 
2.43.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 04/14] libstdc++: Optimize std::is_floating_point compilation performance
  2024-01-10  9:22 [PATCH 00/14] Optimize integral-related type traits Ken Matsui
                   ` (2 preceding siblings ...)
  2024-01-10  9:22 ` [PATCH 03/14] c++: Implement __is_floating_point built-in trait Ken Matsui
@ 2024-01-10  9:22 ` Ken Matsui
  2024-01-10 21:20   ` Jonathan Wakely
  2024-01-10  9:22 ` [PATCH 05/14] c++: Implement __is_arithmetic built-in trait Ken Matsui
                   ` (9 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Ken Matsui @ 2024-01-10  9:22 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, 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 <kmatsui@gcc.gnu.org>
---
 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<typename _Tp>
+    struct is_floating_point
+    : public __bool_constant<__is_floating_point(_Tp)>
+    { };
+#else
   /// @cond undocumented
   template<typename>
     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 <typename _Tp>
   inline constexpr bool is_integral_v = is_integral<_Tp>::value;
 #endif
 
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_floating_point)
+template <typename _Tp>
+  inline constexpr bool is_floating_point_v = __is_floating_point(_Tp);
+#else
 template <typename _Tp>
   inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value;
+#endif
 
 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_array)
 template <typename _Tp>
-- 
2.43.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 05/14] c++: Implement __is_arithmetic built-in trait
  2024-01-10  9:22 [PATCH 00/14] Optimize integral-related type traits Ken Matsui
                   ` (3 preceding siblings ...)
  2024-01-10  9:22 ` [PATCH 04/14] libstdc++: Optimize std::is_floating_point compilation performance Ken Matsui
@ 2024-01-10  9:22 ` Ken Matsui
  2024-01-10  9:22 ` [PATCH 06/14] libstdc++: Optimize std::is_arithmetic compilation performance Ken Matsui
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-01-10  9:22 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Ken Matsui

This patch implements built-in trait for std::is_arithmetic.

gcc/cp/ChangeLog:

	* cp-trait.def: Define __is_arithmetic.
	* constraint.cc (diagnose_trait_expr): Handle
	CPTK_IS_ARITHMETIC.
	* semantics.cc (trait_expr_value): Likewise.
	(finish_trait_expr): Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/ext/has-builtin-1.C: Test existence of __is_arithmetic.
	* g++.dg/ext/is_arithmetic.C: New test.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
 gcc/cp/constraint.cc                     |  3 +++
 gcc/cp/cp-trait.def                      |  1 +
 gcc/cp/semantics.cc                      | 10 +++++---
 gcc/testsuite/g++.dg/ext/has-builtin-1.C |  3 +++
 gcc/testsuite/g++.dg/ext/is_arithmetic.C | 31 ++++++++++++++++++++++++
 5 files changed, 45 insertions(+), 3 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/ext/is_arithmetic.C

diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
index aca0b91711f..d25c3109789 100644
--- a/gcc/cp/constraint.cc
+++ b/gcc/cp/constraint.cc
@@ -3722,6 +3722,9 @@ diagnose_trait_expr (tree expr, tree args)
     case CPTK_IS_ARRAY:
       inform (loc, "  %qT is not an array", t1);
       break;
+    case CPTK_IS_ARITHMETIC:
+      inform (loc, "  %qT is not an arithmetic type", t1);
+      break;
     case CPTK_IS_ASSIGNABLE:
       inform (loc, "  %qT is not assignable from %qT", t1, t2);
       break;
diff --git a/gcc/cp/cp-trait.def b/gcc/cp/cp-trait.def
index acf668d48ee..8df3ed8fedf 100644
--- a/gcc/cp/cp-trait.def
+++ b/gcc/cp/cp-trait.def
@@ -60,6 +60,7 @@ DEFTRAIT_EXPR (HAS_VIRTUAL_DESTRUCTOR, "__has_virtual_destructor", 1)
 DEFTRAIT_EXPR (IS_ABSTRACT, "__is_abstract", 1)
 DEFTRAIT_EXPR (IS_AGGREGATE, "__is_aggregate", 1)
 DEFTRAIT_EXPR (IS_ARRAY, "__is_array", 1)
+DEFTRAIT_EXPR (IS_ARITHMETIC, "__is_arithmetic", 1)
 DEFTRAIT_EXPR (IS_ASSIGNABLE, "__is_assignable", 2)
 DEFTRAIT_EXPR (IS_BASE_OF, "__is_base_of", 2)
 DEFTRAIT_EXPR (IS_BOUNDED_ARRAY, "__is_bounded_array", 1)
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index c052e47c204..882e0924ea4 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -2818,7 +2818,7 @@ perform_koenig_lookup (cp_expr fn_expr, vec<tree, va_gc> *args,
 
   if (fn && template_id && fn != error_mark_node)
     fn = build2 (TEMPLATE_ID_EXPR, unknown_type_node, fn, tmpl_args);
-  
+
   return cp_expr (fn, loc);
 }
 
@@ -9325,7 +9325,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
 	      && OMP_CLAUSE_CODE (c) != OMP_CLAUSE_SHARED
 	      && DECL_P (t))
 	    bitmap_clear_bit (&aligned_head, DECL_UID (t));
-	    
+
 	  if (VAR_P (t) && CP_DECL_THREAD_LOCAL_P (t))
 	    share_name = "threadprivate";
 	  else switch (cxx_omp_predetermined_sharing_1 (t))
@@ -12013,7 +12013,7 @@ pointer_interconvertible_base_of_p (tree base, tree derived)
   if (!NON_UNION_CLASS_TYPE_P (base)
       || !NON_UNION_CLASS_TYPE_P (derived))
     return false;
-    
+
   if (same_type_p (base, derived))
     return true;
 
@@ -12460,6 +12460,9 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2)
     case CPTK_IS_ARRAY:
       return type_code1 == ARRAY_TYPE;
 
+    case CPTK_IS_ARITHMETIC:
+      return integral_type_p (type1) || floating_point_type_p (type1);
+
     case CPTK_IS_ASSIGNABLE:
       return is_xible (MODIFY_EXPR, type1, type2);
 
@@ -12720,6 +12723,7 @@ finish_trait_expr (location_t loc, cp_trait_kind kind, tree type1, tree type2)
       break;
 
     case CPTK_IS_ARRAY:
+    case CPTK_IS_ARITHMETIC:
     case CPTK_IS_BOUNDED_ARRAY:
     case CPTK_IS_CLASS:
     case CPTK_IS_ENUM:
diff --git a/gcc/testsuite/g++.dg/ext/has-builtin-1.C b/gcc/testsuite/g++.dg/ext/has-builtin-1.C
index 5dc70a19e79..a64a6a85bc2 100644
--- a/gcc/testsuite/g++.dg/ext/has-builtin-1.C
+++ b/gcc/testsuite/g++.dg/ext/has-builtin-1.C
@@ -59,6 +59,9 @@
 #if !__has_builtin (__is_array)
 # error "__has_builtin (__is_array) failed"
 #endif
+#if !__has_builtin (__is_arithmetic)
+# error "__has_builtin (__is_arithmetic) failed"
+#endif
 #if !__has_builtin (__is_assignable)
 # error "__has_builtin (__is_assignable) failed"
 #endif
diff --git a/gcc/testsuite/g++.dg/ext/is_arithmetic.C b/gcc/testsuite/g++.dg/ext/is_arithmetic.C
new file mode 100644
index 00000000000..719e976fbdf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/is_arithmetic.C
@@ -0,0 +1,31 @@
+// { dg-do compile { target c++11 } }
+
+#define SA(X) static_assert((X),#X)
+
+#define SA_TEST_CATEGORY(TRAIT, TYPE, EXPECT)	\
+  SA(TRAIT(TYPE) == EXPECT);			\
+  SA(TRAIT(const TYPE) == EXPECT);		\
+  SA(TRAIT(volatile TYPE) == EXPECT);		\
+  SA(TRAIT(const volatile TYPE) == EXPECT)
+
+SA_TEST_CATEGORY(__is_arithmetic, void, false);
+
+SA_TEST_CATEGORY(__is_arithmetic, char, true);
+SA_TEST_CATEGORY(__is_arithmetic, signed char, true);
+SA_TEST_CATEGORY(__is_arithmetic, unsigned char, true);
+SA_TEST_CATEGORY(__is_arithmetic, wchar_t, true);
+SA_TEST_CATEGORY(__is_arithmetic, short, true);
+SA_TEST_CATEGORY(__is_arithmetic, unsigned short, true);
+SA_TEST_CATEGORY(__is_arithmetic, int, true);
+SA_TEST_CATEGORY(__is_arithmetic, unsigned int, true);
+SA_TEST_CATEGORY(__is_arithmetic, long, true);
+SA_TEST_CATEGORY(__is_arithmetic, unsigned long, true);
+SA_TEST_CATEGORY(__is_arithmetic, long long, true);
+SA_TEST_CATEGORY(__is_arithmetic, unsigned long long, true);
+SA_TEST_CATEGORY(__is_arithmetic, float, true);
+SA_TEST_CATEGORY(__is_arithmetic, double, true);
+SA_TEST_CATEGORY(__is_arithmetic, long double, true);
+
+// Sanity check.
+class ClassType { };
+SA_TEST_CATEGORY(__is_arithmetic, ClassType, false);
-- 
2.43.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 06/14] libstdc++: Optimize std::is_arithmetic compilation performance
  2024-01-10  9:22 [PATCH 00/14] Optimize integral-related type traits Ken Matsui
                   ` (4 preceding siblings ...)
  2024-01-10  9:22 ` [PATCH 05/14] c++: Implement __is_arithmetic built-in trait Ken Matsui
@ 2024-01-10  9:22 ` Ken Matsui
  2024-01-10 21:20   ` Jonathan Wakely
  2024-01-10  9:22 ` [PATCH 07/14] libstdc++: Optimize std::is_fundamental " Ken Matsui
                   ` (7 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Ken Matsui @ 2024-01-10  9:22 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Ken Matsui

This patch optimizes the compilation performance of std::is_arithmetic
by dispatching to the new __is_arithmetic built-in trait.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (is_arithmetic): Use __is_arithmetic
	built-in trait.
	(is_arithmetic_v): Likewise.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
 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 23ea70eca18..9baf3b2aa46 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -728,10 +728,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif
 
   /// is_arithmetic
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_arithmetic)
+  template<typename _Tp>
+    struct is_arithmetic
+    : public __bool_constant<__is_arithmetic(_Tp)>
+    { };
+#else
   template<typename _Tp>
     struct is_arithmetic
     : public __or_<is_integral<_Tp>, is_floating_point<_Tp>>::type
     { };
+#endif
 
   /// is_fundamental
   template<typename _Tp>
@@ -3317,8 +3324,14 @@ template <typename _Tp>
   inline constexpr bool is_reference_v<_Tp&&> = true;
 #endif
 
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_arithmetic)
+template <typename _Tp>
+  inline constexpr bool is_arithmetic_v = __is_arithmetic(_Tp);
+#else
 template <typename _Tp>
   inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value;
+#endif
+
 template <typename _Tp>
   inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value;
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 07/14] libstdc++: Optimize std::is_fundamental compilation performance
  2024-01-10  9:22 [PATCH 00/14] Optimize integral-related type traits Ken Matsui
                   ` (5 preceding siblings ...)
  2024-01-10  9:22 ` [PATCH 06/14] libstdc++: Optimize std::is_arithmetic compilation performance Ken Matsui
@ 2024-01-10  9:22 ` Ken Matsui
  2024-01-10  9:22 ` [PATCH 08/14] libstdc++: Optimize std::is_compound " Ken Matsui
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-01-10  9:22 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Ken Matsui

This patch optimizes the compilation performance of std::is_fundamental
by dispatching to the new __is_arithmetic built-in trait.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (is_fundamental_v): Use
	__is_arithmetic built-in trait.
	(is_fundamental): Likewise. Optimize the original
	implementation.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
 libstdc++-v3/include/std/type_traits | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 9baf3b2aa46..1c560d97e85 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -741,11 +741,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif
 
   /// is_fundamental
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_arithmetic)
+  template<typename _Tp>
+    struct is_fundamental
+    : public __bool_constant<__is_arithmetic(_Tp)
+                             || is_void<_Tp>::value
+                             || is_null_pointer<_Tp>::value>
+    { };
+#else
   template<typename _Tp>
     struct is_fundamental
-    : public __or_<is_arithmetic<_Tp>, is_void<_Tp>,
-		   is_null_pointer<_Tp>>::type
+    : public __bool_constant<is_arithmetic<_Tp>::value
+                             || is_void<_Tp>::value
+                             || is_null_pointer<_Tp>::value>
     { };
+#endif
 
   /// is_object
 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_object)
@@ -3327,13 +3337,15 @@ template <typename _Tp>
 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_arithmetic)
 template <typename _Tp>
   inline constexpr bool is_arithmetic_v = __is_arithmetic(_Tp);
+template <typename _Tp>
+  inline constexpr bool is_fundamental_v
+    = __is_arithmetic(_Tp) || is_void_v<_Tp> || is_null_pointer_v<_Tp>;
 #else
 template <typename _Tp>
   inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value;
-#endif
-
 template <typename _Tp>
   inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value;
+#endif
 
 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_object)
 template <typename _Tp>
-- 
2.43.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 08/14] libstdc++: Optimize std::is_compound compilation performance
  2024-01-10  9:22 [PATCH 00/14] Optimize integral-related type traits Ken Matsui
                   ` (6 preceding siblings ...)
  2024-01-10  9:22 ` [PATCH 07/14] libstdc++: Optimize std::is_fundamental " Ken Matsui
@ 2024-01-10  9:22 ` Ken Matsui
  2024-01-10 21:21   ` Jonathan Wakely
  2024-01-10  9:23 ` [PATCH 09/14] c++: Implement __is_unsigned built-in trait Ken Matsui
                   ` (5 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Ken Matsui @ 2024-01-10  9:22 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Ken Matsui

This patch optimizes the compilation performance of std::is_compound
by dispatching to the new __is_arithmetic built-in trait.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (is_compound): Do not use __not_.
	(is_compound_v): Use is_fundamental_v instead.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
 libstdc++-v3/include/std/type_traits | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 1c560d97e85..6294f5af533 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -784,7 +784,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   /// is_compound
   template<typename _Tp>
     struct is_compound
-    : public __not_<is_fundamental<_Tp>>::type { };
+    : public __bool_constant<!is_fundamental<_Tp>::value> { };
 
   /// is_member_pointer
 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_pointer)
@@ -3358,7 +3358,7 @@ template <typename _Tp>
 template <typename _Tp>
   inline constexpr bool is_scalar_v = is_scalar<_Tp>::value;
 template <typename _Tp>
-  inline constexpr bool is_compound_v = is_compound<_Tp>::value;
+  inline constexpr bool is_compound_v = !is_fundamental_v<_Tp>;
 
 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_pointer)
 template <typename _Tp>
-- 
2.43.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 09/14] c++: Implement __is_unsigned built-in trait
  2024-01-10  9:22 [PATCH 00/14] Optimize integral-related type traits Ken Matsui
                   ` (7 preceding siblings ...)
  2024-01-10  9:22 ` [PATCH 08/14] libstdc++: Optimize std::is_compound " Ken Matsui
@ 2024-01-10  9:23 ` Ken Matsui
  2024-01-17  0:41   ` Jason Merrill
  2024-01-10  9:23 ` [PATCH 10/14] libstdc++: Optimize std::is_unsigned compilation performance Ken Matsui
                   ` (4 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Ken Matsui @ 2024-01-10  9:23 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Ken Matsui

This patch implements built-in trait for std::is_unsigned.

gcc/cp/ChangeLog:

	* cp-trait.def: Define __is_unsigned.
	* constraint.cc (diagnose_trait_expr): Handle CPTK_IS_UNSIGNED.
	* semantics.cc (trait_expr_value): Likewise.
	(finish_trait_expr): Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/ext/has-builtin-1.C: Test existence of __is_unsigned.
	* g++.dg/ext/is_unsigned.C: New test.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
 gcc/cp/constraint.cc                     |  3 ++
 gcc/cp/cp-trait.def                      |  1 +
 gcc/cp/semantics.cc                      |  4 +++
 gcc/testsuite/g++.dg/ext/has-builtin-1.C |  3 ++
 gcc/testsuite/g++.dg/ext/is_unsigned.C   | 45 ++++++++++++++++++++++++
 5 files changed, 56 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/ext/is_unsigned.C

diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
index d25c3109789..7e4b3cd38c4 100644
--- a/gcc/cp/constraint.cc
+++ b/gcc/cp/constraint.cc
@@ -3834,6 +3834,9 @@ diagnose_trait_expr (tree expr, tree args)
     case CPTK_IS_UNION:
       inform (loc, "  %qT is not a union", t1);
       break;
+    case CPTK_IS_UNSIGNED:
+      inform (loc, "  %qT is not an unsigned type", t1);
+      break;
     case CPTK_REF_CONSTRUCTS_FROM_TEMPORARY:
       inform (loc, "  %qT is not a reference that binds to a temporary "
 	      "object of type %qT (direct-initialization)", t1, t2);
diff --git a/gcc/cp/cp-trait.def b/gcc/cp/cp-trait.def
index 8df3ed8fedf..734522eb5ba 100644
--- a/gcc/cp/cp-trait.def
+++ b/gcc/cp/cp-trait.def
@@ -94,6 +94,7 @@ DEFTRAIT_EXPR (IS_TRIVIALLY_ASSIGNABLE, "__is_trivially_assignable", 2)
 DEFTRAIT_EXPR (IS_TRIVIALLY_CONSTRUCTIBLE, "__is_trivially_constructible", -1)
 DEFTRAIT_EXPR (IS_TRIVIALLY_COPYABLE, "__is_trivially_copyable", 1)
 DEFTRAIT_EXPR (IS_UNION, "__is_union", 1)
+DEFTRAIT_EXPR (IS_UNSIGNED, "__is_unsigned", 1)
 DEFTRAIT_EXPR (REF_CONSTRUCTS_FROM_TEMPORARY, "__reference_constructs_from_temporary", 2)
 DEFTRAIT_EXPR (REF_CONVERTS_FROM_TEMPORARY, "__reference_converts_from_temporary", 2)
 DEFTRAIT_TYPE (REMOVE_CV, "__remove_cv", 1)
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index 882e0924ea4..522db3f57e4 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -12566,6 +12566,9 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2)
     case CPTK_IS_UNION:
       return type_code1 == UNION_TYPE;
 
+    case CPTK_IS_UNSIGNED:
+      return TYPE_UNSIGNED (type1);
+
     case CPTK_REF_CONSTRUCTS_FROM_TEMPORARY:
       return ref_xes_from_temporary (type1, type2, /*direct_init=*/true);
 
@@ -12738,6 +12741,7 @@ finish_trait_expr (location_t loc, cp_trait_kind kind, tree type1, tree type2)
     case CPTK_IS_SAME:
     case CPTK_IS_SCOPED_ENUM:
     case CPTK_IS_UNION:
+    case CPTK_IS_UNSIGNED:
       break;
 
     case CPTK_IS_LAYOUT_COMPATIBLE:
diff --git a/gcc/testsuite/g++.dg/ext/has-builtin-1.C b/gcc/testsuite/g++.dg/ext/has-builtin-1.C
index a64a6a85bc2..062b06234e6 100644
--- a/gcc/testsuite/g++.dg/ext/has-builtin-1.C
+++ b/gcc/testsuite/g++.dg/ext/has-builtin-1.C
@@ -164,6 +164,9 @@
 #if !__has_builtin (__is_union)
 # error "__has_builtin (__is_union) failed"
 #endif
+#if !__has_builtin (__is_unsigned)
+# error "__has_builtin (__is_unsigned) failed"
+#endif
 #if !__has_builtin (__reference_constructs_from_temporary)
 # error "__has_builtin (__reference_constructs_from_temporary) failed"
 #endif
diff --git a/gcc/testsuite/g++.dg/ext/is_unsigned.C b/gcc/testsuite/g++.dg/ext/is_unsigned.C
new file mode 100644
index 00000000000..5694f89dca3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/is_unsigned.C
@@ -0,0 +1,45 @@
+// { dg-do compile { target c++11 } }
+
+#define SA(X) static_assert((X),#X)
+
+#define SA_TEST_CATEGORY(TRAIT, X, expect)	\
+  SA(TRAIT(X) == expect);			\
+  SA(TRAIT(const X) == expect);			\
+  SA(TRAIT(volatile X) == expect);		\
+  SA(TRAIT(const volatile X) == expect)
+
+SA_TEST_CATEGORY(__is_unsigned, void, false);
+
+SA_TEST_CATEGORY(__is_unsigned, bool, (bool(-1) > bool(0)));
+SA_TEST_CATEGORY(__is_unsigned, char, (char(-1) > char(0)));
+SA_TEST_CATEGORY(__is_unsigned, signed char, false);
+SA_TEST_CATEGORY(__is_unsigned, unsigned char, true);
+SA_TEST_CATEGORY(__is_unsigned, wchar_t, (wchar_t(-1) > wchar_t(0)));
+SA_TEST_CATEGORY(__is_unsigned, short, false);
+SA_TEST_CATEGORY(__is_unsigned, unsigned short, true);
+SA_TEST_CATEGORY(__is_unsigned, int, false);
+SA_TEST_CATEGORY(__is_unsigned, unsigned int, true);
+SA_TEST_CATEGORY(__is_unsigned, long, false);
+SA_TEST_CATEGORY(__is_unsigned, unsigned long, true);
+SA_TEST_CATEGORY(__is_unsigned, long long, false);
+SA_TEST_CATEGORY(__is_unsigned, unsigned long long, true);
+
+SA_TEST_CATEGORY(__is_unsigned, float, false);
+SA_TEST_CATEGORY(__is_unsigned, double, false);
+SA_TEST_CATEGORY(__is_unsigned, long double, false);
+
+#ifndef __STRICT_ANSI__
+// GNU Extensions.
+#ifdef __SIZEOF_INT128__
+SA_TEST_CATEGORY(__is_unsigned, unsigned __int128, true);
+SA_TEST_CATEGORY(__is_unsigned, __int128, false);
+#endif
+
+#ifdef _GLIBCXX_USE_FLOAT128
+SA_TEST_CATEGORY(__is_unsigned, __float128, false);
+#endif
+#endif
+
+// Sanity check.
+class ClassType { };
+SA_TEST_CATEGORY(__is_unsigned, ClassType, false);
-- 
2.43.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 10/14] libstdc++: Optimize std::is_unsigned compilation performance
  2024-01-10  9:22 [PATCH 00/14] Optimize integral-related type traits Ken Matsui
                   ` (8 preceding siblings ...)
  2024-01-10  9:23 ` [PATCH 09/14] c++: Implement __is_unsigned built-in trait Ken Matsui
@ 2024-01-10  9:23 ` Ken Matsui
  2024-01-10 21:22   ` Jonathan Wakely
  2024-01-10  9:23 ` [PATCH 11/14] c++: Implement __is_signed built-in trait Ken Matsui
                   ` (3 subsequent siblings)
  13 siblings, 1 reply; 30+ messages in thread
From: Ken Matsui @ 2024-01-10  9:23 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Ken Matsui

This patch optimizes the compilation performance of std::is_unsigned
by dispatching to the new __is_unsigned built-in trait.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (is_unsigned): Use __is_unsigned
	built-in trait.
	(is_unsigned_v): Likewise.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
 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 6294f5af533..4bcfb1389e3 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -987,10 +987,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     { };
 
   /// is_unsigned
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_unsigned)
+  template<typename _Tp>
+    struct is_unsigned
+    : public __bool_constant<__is_unsigned(_Tp)>
+    { };
+#else
   template<typename _Tp>
     struct is_unsigned
     : public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>>::type
     { };
+#endif
 
   /// @cond undocumented
   template<typename _Tp, typename _Up = _Tp&&>
@@ -3413,8 +3420,14 @@ template <typename _Tp>
 
 template <typename _Tp>
   inline constexpr bool is_signed_v = is_signed<_Tp>::value;
+
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_unsigned)
+template <typename _Tp>
+  inline constexpr bool is_unsigned_v = __is_unsigned(_Tp);
+#else
 template <typename _Tp>
   inline constexpr bool is_unsigned_v = is_unsigned<_Tp>::value;
+#endif
 
 template <typename _Tp, typename... _Args>
   inline constexpr bool is_constructible_v = __is_constructible(_Tp, _Args...);
-- 
2.43.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 11/14] c++: Implement __is_signed built-in trait
  2024-01-10  9:22 [PATCH 00/14] Optimize integral-related type traits Ken Matsui
                   ` (9 preceding siblings ...)
  2024-01-10  9:23 ` [PATCH 10/14] libstdc++: Optimize std::is_unsigned compilation performance Ken Matsui
@ 2024-01-10  9:23 ` Ken Matsui
  2024-01-10  9:23 ` [PATCH 12/14] libstdc++: Optimize std::is_signed compilation performance Ken Matsui
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-01-10  9:23 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Ken Matsui

This patch implements built-in trait for std::is_signed.

gcc/cp/ChangeLog:

	* cp-trait.def: Define __is_signed.
	* constraint.cc (diagnose_trait_expr): Handle CPTK_IS_SIGNED.
	* semantics.cc (trait_expr_value): Likewise.
	(finish_trait_expr): Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/ext/has-builtin-1.C: Test existence of __is_signed.
	* g++.dg/ext/is_signed.C: New test.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
 gcc/cp/constraint.cc                     |  3 ++
 gcc/cp/cp-trait.def                      |  1 +
 gcc/cp/semantics.cc                      |  6 ++++
 gcc/testsuite/g++.dg/ext/has-builtin-1.C |  3 ++
 gcc/testsuite/g++.dg/ext/is_signed.C     | 45 ++++++++++++++++++++++++
 5 files changed, 58 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/ext/is_signed.C

diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
index 7e4b3cd38c4..d2e41aa053d 100644
--- a/gcc/cp/constraint.cc
+++ b/gcc/cp/constraint.cc
@@ -3813,6 +3813,9 @@ diagnose_trait_expr (tree expr, tree args)
     case CPTK_IS_SCOPED_ENUM:
       inform (loc, "  %qT is not a scoped enum", t1);
       break;
+    case CPTK_IS_SIGNED:
+      inform (loc, "  %qT is not a signed type", t1);
+      break;
     case CPTK_IS_STD_LAYOUT:
       inform (loc, "  %qT is not an standard layout type", t1);
       break;
diff --git a/gcc/cp/cp-trait.def b/gcc/cp/cp-trait.def
index 734522eb5ba..6dac7622a7c 100644
--- a/gcc/cp/cp-trait.def
+++ b/gcc/cp/cp-trait.def
@@ -88,6 +88,7 @@ DEFTRAIT_EXPR (IS_POLYMORPHIC, "__is_polymorphic", 1)
 DEFTRAIT_EXPR (IS_REFERENCE, "__is_reference", 1)
 DEFTRAIT_EXPR (IS_SAME, "__is_same", 2)
 DEFTRAIT_EXPR (IS_SCOPED_ENUM, "__is_scoped_enum", 1)
+DEFTRAIT_EXPR (IS_SIGNED, "__is_signed", 1)
 DEFTRAIT_EXPR (IS_STD_LAYOUT, "__is_standard_layout", 1)
 DEFTRAIT_EXPR (IS_TRIVIAL, "__is_trivial", 1)
 DEFTRAIT_EXPR (IS_TRIVIALLY_ASSIGNABLE, "__is_trivially_assignable", 2)
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index 522db3f57e4..c3d6fc2d10f 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -12548,6 +12548,11 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2)
     case CPTK_IS_SCOPED_ENUM:
       return SCOPED_ENUM_P (type1);
 
+    case CPTK_IS_SIGNED:
+      return (integral_type_p (type1)
+	|| floating_point_type_p (type1))
+	&& TYPE_SIGN (type1) == SIGNED;
+
     case CPTK_IS_STD_LAYOUT:
       return std_layout_type_p (type1);
 
@@ -12740,6 +12745,7 @@ finish_trait_expr (location_t loc, cp_trait_kind kind, tree type1, tree type2)
     case CPTK_IS_REFERENCE:
     case CPTK_IS_SAME:
     case CPTK_IS_SCOPED_ENUM:
+    case CPTK_IS_SIGNED:
     case CPTK_IS_UNION:
     case CPTK_IS_UNSIGNED:
       break;
diff --git a/gcc/testsuite/g++.dg/ext/has-builtin-1.C b/gcc/testsuite/g++.dg/ext/has-builtin-1.C
index 062b06234e6..e3d16add403 100644
--- a/gcc/testsuite/g++.dg/ext/has-builtin-1.C
+++ b/gcc/testsuite/g++.dg/ext/has-builtin-1.C
@@ -146,6 +146,9 @@
 #if !__has_builtin (__is_scoped_enum)
 # error "__has_builtin (__is_scoped_enum) failed"
 #endif
+#if !__has_builtin (__is_signed)
+# error "__has_builtin (__is_signed) failed"
+#endif
 #if !__has_builtin (__is_standard_layout)
 # error "__has_builtin (__is_standard_layout) failed"
 #endif
diff --git a/gcc/testsuite/g++.dg/ext/is_signed.C b/gcc/testsuite/g++.dg/ext/is_signed.C
new file mode 100644
index 00000000000..a46ba54ac14
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/is_signed.C
@@ -0,0 +1,45 @@
+// { dg-do compile { target c++11 } }
+
+#define SA(X) static_assert((X),#X)
+
+#define SA_TEST_CATEGORY(TRAIT, X, expect)	\
+  SA(TRAIT(X) == expect);			\
+  SA(TRAIT(const X) == expect);			\
+  SA(TRAIT(volatile X) == expect);		\
+  SA(TRAIT(const volatile X) == expect)
+
+SA_TEST_CATEGORY(__is_signed, void, false);
+
+SA_TEST_CATEGORY(__is_signed, bool, bool(-1) < bool(0));
+SA_TEST_CATEGORY(__is_signed, char, char(-1) < char(0));
+SA_TEST_CATEGORY(__is_signed, signed char, true);
+SA_TEST_CATEGORY(__is_signed, unsigned char, false);
+SA_TEST_CATEGORY(__is_signed, wchar_t, wchar_t(-1) < wchar_t(0));
+SA_TEST_CATEGORY(__is_signed, short, true);
+SA_TEST_CATEGORY(__is_signed, unsigned short, false);
+SA_TEST_CATEGORY(__is_signed, int, true);
+SA_TEST_CATEGORY(__is_signed, unsigned int, false);
+SA_TEST_CATEGORY(__is_signed, long, true);
+SA_TEST_CATEGORY(__is_signed, unsigned long, false);
+SA_TEST_CATEGORY(__is_signed, long long, true);
+SA_TEST_CATEGORY(__is_signed, unsigned long long, false);
+
+SA_TEST_CATEGORY(__is_signed, float, true);
+SA_TEST_CATEGORY(__is_signed, double, true);
+SA_TEST_CATEGORY(__is_signed, long double, true);
+
+#ifndef __STRICT_ANSI__
+// GNU Extensions.
+#ifdef __SIZEOF_INT128__
+SA_TEST_CATEGORY(__is_signed, __int128, true);
+SA_TEST_CATEGORY(__is_signed, unsigned __int128, false);
+#endif
+
+#ifdef _GLIBCXX_USE_FLOAT128
+SA_TEST_CATEGORY(__is_signed, __float128, true);
+#endif
+#endif
+
+// Sanity check.
+class ClassType { };
+SA_TEST_CATEGORY(__is_signed, ClassType, false);
-- 
2.43.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 12/14] libstdc++: Optimize std::is_signed compilation performance
  2024-01-10  9:22 [PATCH 00/14] Optimize integral-related type traits Ken Matsui
                   ` (10 preceding siblings ...)
  2024-01-10  9:23 ` [PATCH 11/14] c++: Implement __is_signed built-in trait Ken Matsui
@ 2024-01-10  9:23 ` Ken Matsui
  2024-01-10 21:22   ` Jonathan Wakely
  2024-01-10  9:23 ` [PATCH 13/14] c++: Implement __is_scalar built-in trait Ken Matsui
  2024-01-10  9:23 ` [PATCH 14/14] libstdc++: Optimize std::is_scalar compilation performance Ken Matsui
  13 siblings, 1 reply; 30+ messages in thread
From: Ken Matsui @ 2024-01-10  9:23 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Ken Matsui

This patch optimizes the compilation performance of std::is_signed
by dispatching to the new __is_signed built-in trait.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (is_signed): Use __is_signed built-in
	trait.
	(is_signed_v): Likewise.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
 libstdc++-v3/include/std/type_traits | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 4bcfb1389e3..b917c743aea 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -968,6 +968,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     : public __bool_constant<__is_abstract(_Tp)>
     { };
 
+  /// is_signed
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_signed)
+  template<typename _Tp>
+    struct is_signed
+    : public __bool_constant<__is_signed(_Tp)>
+    { };
+#else
   /// @cond undocumented
   template<typename _Tp,
 	   bool = is_arithmetic<_Tp>::value>
@@ -980,11 +987,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     { };
   /// @endcond
 
-  /// is_signed
   template<typename _Tp>
     struct is_signed
     : public __is_signed_helper<_Tp>::type
     { };
+#endif
 
   /// is_unsigned
 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_unsigned)
@@ -3418,8 +3425,13 @@ template <typename _Tp>
 template <typename _Tp>
   inline constexpr bool is_final_v = __is_final(_Tp);
 
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_signed)
+template <typename _Tp>
+  inline constexpr bool is_signed_v = __is_signed(_Tp);
+#else
 template <typename _Tp>
   inline constexpr bool is_signed_v = is_signed<_Tp>::value;
+#endif
 
 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_unsigned)
 template <typename _Tp>
-- 
2.43.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 13/14] c++: Implement __is_scalar built-in trait
  2024-01-10  9:22 [PATCH 00/14] Optimize integral-related type traits Ken Matsui
                   ` (11 preceding siblings ...)
  2024-01-10  9:23 ` [PATCH 12/14] libstdc++: Optimize std::is_signed compilation performance Ken Matsui
@ 2024-01-10  9:23 ` Ken Matsui
  2024-01-10 19:59   ` Ken Matsui
  2024-01-10  9:23 ` [PATCH 14/14] libstdc++: Optimize std::is_scalar compilation performance Ken Matsui
  13 siblings, 1 reply; 30+ messages in thread
From: Ken Matsui @ 2024-01-10  9:23 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Ken Matsui

This patch implements built-in trait for std::is_scalar.

gcc/cp/ChangeLog:

	* cp-trait.def: Define __is_scalar.
	* constraint.cc (diagnose_trait_expr): Handle CPTK_IS_SCALAR.
	* semantics.cc (trait_expr_value): Likewise.
	(finish_trait_expr): Likewise.

gcc/testsuite/ChangeLog:

	* g++.dg/ext/has-builtin-1.C: Test existence of __is_scalar.
	* g++.dg/ext/is_scalar.C: New test.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
 gcc/cp/constraint.cc                     |  3 +++
 gcc/cp/cp-trait.def                      |  1 +
 gcc/cp/semantics.cc                      | 10 +++++++++
 gcc/testsuite/g++.dg/ext/has-builtin-1.C |  3 +++
 gcc/testsuite/g++.dg/ext/is_scalar.C     | 28 ++++++++++++++++++++++++
 5 files changed, 45 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/ext/is_scalar.C

diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
index d2e41aa053d..7293f33c676 100644
--- a/gcc/cp/constraint.cc
+++ b/gcc/cp/constraint.cc
@@ -3810,6 +3810,9 @@ diagnose_trait_expr (tree expr, tree args)
     case CPTK_IS_SAME:
       inform (loc, "  %qT is not the same as %qT", t1, t2);
       break;
+    case CPTK_IS_SCALAR:
+      inform (loc, "  %qT is not a scalar type", t1);
+      break;
     case CPTK_IS_SCOPED_ENUM:
       inform (loc, "  %qT is not a scoped enum", t1);
       break;
diff --git a/gcc/cp/cp-trait.def b/gcc/cp/cp-trait.def
index 6dac7622a7c..48e195b4938 100644
--- a/gcc/cp/cp-trait.def
+++ b/gcc/cp/cp-trait.def
@@ -87,6 +87,7 @@ DEFTRAIT_EXPR (IS_POD, "__is_pod", 1)
 DEFTRAIT_EXPR (IS_POLYMORPHIC, "__is_polymorphic", 1)
 DEFTRAIT_EXPR (IS_REFERENCE, "__is_reference", 1)
 DEFTRAIT_EXPR (IS_SAME, "__is_same", 2)
+DEFTRAIT_EXPR (IS_SCALAR, "__is_scalar", 1)
 DEFTRAIT_EXPR (IS_SCOPED_ENUM, "__is_scoped_enum", 1)
 DEFTRAIT_EXPR (IS_SIGNED, "__is_signed", 1)
 DEFTRAIT_EXPR (IS_STD_LAYOUT, "__is_standard_layout", 1)
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index c3d6fc2d10f..2426ba629d9 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -12545,6 +12545,15 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2)
     case CPTK_IS_SAME:
       return same_type_p (type1, type2);
 
+    case CPTK_IS_SCALAR:
+      return (TYPE_PTRDATAMEM_P (type1)
+	|| TREE_CODE (type1) == ENUMERAL_TYPE
+	|| integral_type_p (type1)
+	|| floating_point_type_p (type1)
+	|| TYPE_PTR_P (type1)
+	|| TYPE_PTRMEMFUNC_P (type1)
+	|| NULLPTR_TYPE_P (type1));
+
     case CPTK_IS_SCOPED_ENUM:
       return SCOPED_ENUM_P (type1);
 
@@ -12744,6 +12753,7 @@ finish_trait_expr (location_t loc, cp_trait_kind kind, tree type1, tree type2)
     case CPTK_IS_OBJECT:
     case CPTK_IS_REFERENCE:
     case CPTK_IS_SAME:
+    case CPTK_IS_SCALAR:
     case CPTK_IS_SCOPED_ENUM:
     case CPTK_IS_SIGNED:
     case CPTK_IS_UNION:
diff --git a/gcc/testsuite/g++.dg/ext/has-builtin-1.C b/gcc/testsuite/g++.dg/ext/has-builtin-1.C
index e3d16add403..c860f7e12ca 100644
--- a/gcc/testsuite/g++.dg/ext/has-builtin-1.C
+++ b/gcc/testsuite/g++.dg/ext/has-builtin-1.C
@@ -143,6 +143,9 @@
 #if !__has_builtin (__is_same_as)
 # error "__has_builtin (__is_same_as) failed"
 #endif
+#if !__has_builtin (__is_scalar)
+# error "__has_builtin (__is_scalar) failed"
+#endif
 #if !__has_builtin (__is_scoped_enum)
 # error "__has_builtin (__is_scoped_enum) failed"
 #endif
diff --git a/gcc/testsuite/g++.dg/ext/is_scalar.C b/gcc/testsuite/g++.dg/ext/is_scalar.C
new file mode 100644
index 00000000000..ad4c2d7ea05
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/is_scalar.C
@@ -0,0 +1,28 @@
+// { dg-do compile { target c++11 } }
+
+#define SA(X) static_assert((X),#X)
+
+#define SA_TEST_FN(TRAIT, TYPE, EXPECT)		\
+  SA(TRAIT(TYPE) == EXPECT);			\
+  SA(TRAIT(const TYPE) == EXPECT)
+
+#define SA_TEST_CATEGORY(TRAIT, TYPE, EXPECT)	\
+  SA(TRAIT(TYPE) == EXPECT);			\
+  SA(TRAIT(const TYPE) == EXPECT);		\
+  SA(TRAIT(volatile TYPE) == EXPECT);		\
+  SA(TRAIT(const volatile TYPE) == EXPECT)
+
+class ClassType { };
+enum EnumType { e0 };
+
+SA_TEST_CATEGORY(__is_scalar, int, true);
+SA_TEST_CATEGORY(__is_scalar, float, true);
+SA_TEST_CATEGORY(__is_scalar, EnumType, true);
+SA_TEST_CATEGORY(__is_scalar, int*, true);
+SA_TEST_FN(__is_scalar, int(*)(int), true);
+SA_TEST_CATEGORY(__is_scalar, int (ClassType::*), true);
+SA_TEST_FN(__is_scalar, int (ClassType::*) (int), true);
+SA_TEST_CATEGORY(__is_scalar, decltype(nullptr), true);
+
+// Sanity check.
+SA_TEST_CATEGORY(__is_scalar, ClassType, false);
-- 
2.43.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 14/14] libstdc++: Optimize std::is_scalar compilation performance
  2024-01-10  9:22 [PATCH 00/14] Optimize integral-related type traits Ken Matsui
                   ` (12 preceding siblings ...)
  2024-01-10  9:23 ` [PATCH 13/14] c++: Implement __is_scalar built-in trait Ken Matsui
@ 2024-01-10  9:23 ` Ken Matsui
  2024-01-10 21:22   ` Jonathan Wakely
  13 siblings, 1 reply; 30+ messages in thread
From: Ken Matsui @ 2024-01-10  9:23 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Ken Matsui

This patch optimizes the compilation performance of std::is_scalar
by dispatching to the new __is_scalar built-in trait.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (is_scalar): Use __is_scalar built-in
	trait.
	(is_scalar_v): Likewise.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
 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 b917c743aea..9ace6a9f08f 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -775,11 +775,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     struct is_member_pointer;
 
   /// is_scalar
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_scalar)
+  template<typename _Tp>
+    struct is_scalar
+    : public __bool_constant<__is_scalar(_Tp)>
+    { };
+#else
   template<typename _Tp>
     struct is_scalar
     : public __or_<is_arithmetic<_Tp>, is_enum<_Tp>, is_pointer<_Tp>,
                    is_member_pointer<_Tp>, is_null_pointer<_Tp>>::type
     { };
+#endif
 
   /// is_compound
   template<typename _Tp>
@@ -3369,8 +3376,14 @@ template <typename _Tp>
   inline constexpr bool is_object_v = is_object<_Tp>::value;
 #endif
 
+#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_scalar)
+template <typename _Tp>
+  inline constexpr bool is_scalar_v = __is_scalar(_Tp);
+#else
 template <typename _Tp>
   inline constexpr bool is_scalar_v = is_scalar<_Tp>::value;
+#endif
+
 template <typename _Tp>
   inline constexpr bool is_compound_v = !is_fundamental_v<_Tp>;
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 13/14] c++: Implement __is_scalar built-in trait
  2024-01-10  9:23 ` [PATCH 13/14] c++: Implement __is_scalar built-in trait Ken Matsui
@ 2024-01-10 19:59   ` Ken Matsui
  0 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-01-10 19:59 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc-patches, libstdc++

On 01-10 (01:23), Ken Matsui wrote:
> This patch implements built-in trait for std::is_scalar.
> 
> gcc/cp/ChangeLog:
> 
> 	* cp-trait.def: Define __is_scalar.
> 	* constraint.cc (diagnose_trait_expr): Handle CPTK_IS_SCALAR.
> 	* semantics.cc (trait_expr_value): Likewise.
> 	(finish_trait_expr): Likewise.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* g++.dg/ext/has-builtin-1.C: Test existence of __is_scalar.
> 	* g++.dg/ext/is_scalar.C: New test.
> 
> Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
> ---
>  gcc/cp/constraint.cc                     |  3 +++
>  gcc/cp/cp-trait.def                      |  1 +
>  gcc/cp/semantics.cc                      | 10 +++++++++
>  gcc/testsuite/g++.dg/ext/has-builtin-1.C |  3 +++
>  gcc/testsuite/g++.dg/ext/is_scalar.C     | 28 ++++++++++++++++++++++++
>  5 files changed, 45 insertions(+)
>  create mode 100644 gcc/testsuite/g++.dg/ext/is_scalar.C
> 
> diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
> index d2e41aa053d..7293f33c676 100644
> --- a/gcc/cp/constraint.cc
> +++ b/gcc/cp/constraint.cc
> @@ -3810,6 +3810,9 @@ diagnose_trait_expr (tree expr, tree args)
>      case CPTK_IS_SAME:
>        inform (loc, "  %qT is not the same as %qT", t1, t2);
>        break;
> +    case CPTK_IS_SCALAR:
> +      inform (loc, "  %qT is not a scalar type", t1);
> +      break;
>      case CPTK_IS_SCOPED_ENUM:
>        inform (loc, "  %qT is not a scoped enum", t1);
>        break;
> diff --git a/gcc/cp/cp-trait.def b/gcc/cp/cp-trait.def
> index 6dac7622a7c..48e195b4938 100644
> --- a/gcc/cp/cp-trait.def
> +++ b/gcc/cp/cp-trait.def
> @@ -87,6 +87,7 @@ DEFTRAIT_EXPR (IS_POD, "__is_pod", 1)
>  DEFTRAIT_EXPR (IS_POLYMORPHIC, "__is_polymorphic", 1)
>  DEFTRAIT_EXPR (IS_REFERENCE, "__is_reference", 1)
>  DEFTRAIT_EXPR (IS_SAME, "__is_same", 2)
> +DEFTRAIT_EXPR (IS_SCALAR, "__is_scalar", 1)
>  DEFTRAIT_EXPR (IS_SCOPED_ENUM, "__is_scoped_enum", 1)
>  DEFTRAIT_EXPR (IS_SIGNED, "__is_signed", 1)
>  DEFTRAIT_EXPR (IS_STD_LAYOUT, "__is_standard_layout", 1)
> diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
> index c3d6fc2d10f..2426ba629d9 100644
> --- a/gcc/cp/semantics.cc
> +++ b/gcc/cp/semantics.cc
> @@ -12545,6 +12545,15 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2)
>      case CPTK_IS_SAME:
>        return same_type_p (type1, type2);
>  
> +    case CPTK_IS_SCALAR:
> +      return (TYPE_PTRDATAMEM_P (type1)
> +	|| TREE_CODE (type1) == ENUMERAL_TYPE
> +	|| integral_type_p (type1)
> +	|| floating_point_type_p (type1)
> +	|| TYPE_PTR_P (type1)
> +	|| TYPE_PTRMEMFUNC_P (type1)
> +	|| NULLPTR_TYPE_P (type1));
> +

Hi Jonathan,

Related to this Bugzilla report:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96710

do we want to update the is_scalar behavior?  For this patch, I just
followed the current implementation.

>      case CPTK_IS_SCOPED_ENUM:
>        return SCOPED_ENUM_P (type1);
>  
> @@ -12744,6 +12753,7 @@ finish_trait_expr (location_t loc, cp_trait_kind kind, tree type1, tree type2)
>      case CPTK_IS_OBJECT:
>      case CPTK_IS_REFERENCE:
>      case CPTK_IS_SAME:
> +    case CPTK_IS_SCALAR:
>      case CPTK_IS_SCOPED_ENUM:
>      case CPTK_IS_SIGNED:
>      case CPTK_IS_UNION:
> diff --git a/gcc/testsuite/g++.dg/ext/has-builtin-1.C b/gcc/testsuite/g++.dg/ext/has-builtin-1.C
> index e3d16add403..c860f7e12ca 100644
> --- a/gcc/testsuite/g++.dg/ext/has-builtin-1.C
> +++ b/gcc/testsuite/g++.dg/ext/has-builtin-1.C
> @@ -143,6 +143,9 @@
>  #if !__has_builtin (__is_same_as)
>  # error "__has_builtin (__is_same_as) failed"
>  #endif
> +#if !__has_builtin (__is_scalar)
> +# error "__has_builtin (__is_scalar) failed"
> +#endif
>  #if !__has_builtin (__is_scoped_enum)
>  # error "__has_builtin (__is_scoped_enum) failed"
>  #endif
> diff --git a/gcc/testsuite/g++.dg/ext/is_scalar.C b/gcc/testsuite/g++.dg/ext/is_scalar.C
> new file mode 100644
> index 00000000000..ad4c2d7ea05
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/ext/is_scalar.C
> @@ -0,0 +1,28 @@
> +// { dg-do compile { target c++11 } }
> +
> +#define SA(X) static_assert((X),#X)
> +
> +#define SA_TEST_FN(TRAIT, TYPE, EXPECT)		\
> +  SA(TRAIT(TYPE) == EXPECT);			\
> +  SA(TRAIT(const TYPE) == EXPECT)
> +
> +#define SA_TEST_CATEGORY(TRAIT, TYPE, EXPECT)	\
> +  SA(TRAIT(TYPE) == EXPECT);			\
> +  SA(TRAIT(const TYPE) == EXPECT);		\
> +  SA(TRAIT(volatile TYPE) == EXPECT);		\
> +  SA(TRAIT(const volatile TYPE) == EXPECT)
> +
> +class ClassType { };
> +enum EnumType { e0 };
> +
> +SA_TEST_CATEGORY(__is_scalar, int, true);
> +SA_TEST_CATEGORY(__is_scalar, float, true);
> +SA_TEST_CATEGORY(__is_scalar, EnumType, true);
> +SA_TEST_CATEGORY(__is_scalar, int*, true);
> +SA_TEST_FN(__is_scalar, int(*)(int), true);
> +SA_TEST_CATEGORY(__is_scalar, int (ClassType::*), true);
> +SA_TEST_FN(__is_scalar, int (ClassType::*) (int), true);
> +SA_TEST_CATEGORY(__is_scalar, decltype(nullptr), true);
> +
> +// Sanity check.
> +SA_TEST_CATEGORY(__is_scalar, ClassType, false);
> -- 
> 2.43.0
> 

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 02/14] libstdc++: Optimize std::is_integral compilation performance
  2024-01-10  9:22 ` [PATCH 02/14] libstdc++: Optimize std::is_integral compilation performance Ken Matsui
@ 2024-01-10 21:19   ` Jonathan Wakely
  0 siblings, 0 replies; 30+ messages in thread
From: Jonathan Wakely @ 2024-01-10 21:19 UTC (permalink / raw)
  To: Ken Matsui; +Cc: gcc-patches, libstdc++

On Wed, 10 Jan 2024 at 19:48, Ken Matsui <kmatsui@gcc.gnu.org> wrote:
>
> This patch optimizes the compilation performance of std::is_integral
> by dispatching to the new __is_integral built-in trait.

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


>
> libstdc++-v3/ChangeLog:
>
>         * include/std/type_traits (is_integral): Use __is_integral
>         built-in trait.
>         (is_integral_v): Likewise.
>
> Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
> ---
>  libstdc++-v3/include/std/type_traits | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
> index 1cec0822b73..afa281d9cc4 100644
> --- a/libstdc++-v3/include/std/type_traits
> +++ b/libstdc++-v3/include/std/type_traits
> @@ -334,6 +334,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>      struct is_void<const volatile void>
>      : public true_type { };
>
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_integral)
> +  /// is_integral
> +  template<typename _Tp>
> +    struct is_integral
> +    : public __bool_constant<__is_integral(_Tp)>
> +    { };
> +#else
>    /// @cond undocumented
>    template<typename>
>      struct __is_integral_helper
> @@ -461,6 +468,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>      struct is_integral
>      : public __is_integral_helper<__remove_cv_t<_Tp>>::type
>      { };
> +#endif
>
>    /// @cond undocumented
>    template<typename>
> @@ -3221,8 +3229,15 @@ template <typename _Tp>
>    inline constexpr bool is_void_v = is_void<_Tp>::value;
>  template <typename _Tp>
>    inline constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value;
> +
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_integral)
> +template <typename _Tp>
> +  inline constexpr bool is_integral_v = __is_integral(_Tp);
> +#else
>  template <typename _Tp>
>    inline constexpr bool is_integral_v = is_integral<_Tp>::value;
> +#endif
> +
>  template <typename _Tp>
>    inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value;
>
> --
> 2.43.0
>


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 04/14] libstdc++: Optimize std::is_floating_point compilation performance
  2024-01-10  9:22 ` [PATCH 04/14] libstdc++: Optimize std::is_floating_point compilation performance Ken Matsui
@ 2024-01-10 21:20   ` Jonathan Wakely
  0 siblings, 0 replies; 30+ messages in thread
From: Jonathan Wakely @ 2024-01-10 21:20 UTC (permalink / raw)
  To: Ken Matsui; +Cc: gcc-patches, libstdc++

On Wed, 10 Jan 2024 at 19:43, Ken Matsui <kmatsui@gcc.gnu.org> 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 <kmatsui@gcc.gnu.org>
> ---
>  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<typename _Tp>
> +    struct is_floating_point
> +    : public __bool_constant<__is_floating_point(_Tp)>
> +    { };
> +#else
>    /// @cond undocumented
>    template<typename>
>      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 <typename _Tp>
>    inline constexpr bool is_integral_v = is_integral<_Tp>::value;
>  #endif
>
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_floating_point)
> +template <typename _Tp>
> +  inline constexpr bool is_floating_point_v = __is_floating_point(_Tp);
> +#else
>  template <typename _Tp>
>    inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value;
> +#endif
>
>  #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_array)
>  template <typename _Tp>
> --
> 2.43.0
>


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 06/14] libstdc++: Optimize std::is_arithmetic compilation performance
  2024-01-10  9:22 ` [PATCH 06/14] libstdc++: Optimize std::is_arithmetic compilation performance Ken Matsui
@ 2024-01-10 21:20   ` Jonathan Wakely
  0 siblings, 0 replies; 30+ messages in thread
From: Jonathan Wakely @ 2024-01-10 21:20 UTC (permalink / raw)
  To: Ken Matsui; +Cc: gcc-patches, libstdc++

On Wed, 10 Jan 2024 at 19:47, Ken Matsui <kmatsui@gcc.gnu.org> wrote:
>
> This patch optimizes the compilation performance of std::is_arithmetic
> by dispatching to the new __is_arithmetic built-in trait.

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


>
> libstdc++-v3/ChangeLog:
>
>         * include/std/type_traits (is_arithmetic): Use __is_arithmetic
>         built-in trait.
>         (is_arithmetic_v): Likewise.
>
> Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
> ---
>  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 23ea70eca18..9baf3b2aa46 100644
> --- a/libstdc++-v3/include/std/type_traits
> +++ b/libstdc++-v3/include/std/type_traits
> @@ -728,10 +728,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>  #endif
>
>    /// is_arithmetic
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_arithmetic)
> +  template<typename _Tp>
> +    struct is_arithmetic
> +    : public __bool_constant<__is_arithmetic(_Tp)>
> +    { };
> +#else
>    template<typename _Tp>
>      struct is_arithmetic
>      : public __or_<is_integral<_Tp>, is_floating_point<_Tp>>::type
>      { };
> +#endif
>
>    /// is_fundamental
>    template<typename _Tp>
> @@ -3317,8 +3324,14 @@ template <typename _Tp>
>    inline constexpr bool is_reference_v<_Tp&&> = true;
>  #endif
>
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_arithmetic)
> +template <typename _Tp>
> +  inline constexpr bool is_arithmetic_v = __is_arithmetic(_Tp);
> +#else
>  template <typename _Tp>
>    inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value;
> +#endif
> +
>  template <typename _Tp>
>    inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value;
>
> --
> 2.43.0
>


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 08/14] libstdc++: Optimize std::is_compound compilation performance
  2024-01-10  9:22 ` [PATCH 08/14] libstdc++: Optimize std::is_compound " Ken Matsui
@ 2024-01-10 21:21   ` Jonathan Wakely
  2024-01-11  3:02     ` Ken Matsui
  0 siblings, 1 reply; 30+ messages in thread
From: Jonathan Wakely @ 2024-01-10 21:21 UTC (permalink / raw)
  To: Ken Matsui; +Cc: gcc-patches, libstdc++

On Wed, 10 Jan 2024 at 19:41, Ken Matsui <kmatsui@gcc.gnu.org> wrote:
>
> This patch optimizes the compilation performance of std::is_compound
> by dispatching to the new __is_arithmetic built-in trait.

OK for trunk (no need to wait for anything else to be approved).

>
> libstdc++-v3/ChangeLog:
>
>         * include/std/type_traits (is_compound): Do not use __not_.
>         (is_compound_v): Use is_fundamental_v instead.
>
> Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
> ---
>  libstdc++-v3/include/std/type_traits | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
> index 1c560d97e85..6294f5af533 100644
> --- a/libstdc++-v3/include/std/type_traits
> +++ b/libstdc++-v3/include/std/type_traits
> @@ -784,7 +784,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>    /// is_compound
>    template<typename _Tp>
>      struct is_compound
> -    : public __not_<is_fundamental<_Tp>>::type { };
> +    : public __bool_constant<!is_fundamental<_Tp>::value> { };
>
>    /// is_member_pointer
>  #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_pointer)
> @@ -3358,7 +3358,7 @@ template <typename _Tp>
>  template <typename _Tp>
>    inline constexpr bool is_scalar_v = is_scalar<_Tp>::value;
>  template <typename _Tp>
> -  inline constexpr bool is_compound_v = is_compound<_Tp>::value;
> +  inline constexpr bool is_compound_v = !is_fundamental_v<_Tp>;
>
>  #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_pointer)
>  template <typename _Tp>
> --
> 2.43.0
>


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 10/14] libstdc++: Optimize std::is_unsigned compilation performance
  2024-01-10  9:23 ` [PATCH 10/14] libstdc++: Optimize std::is_unsigned compilation performance Ken Matsui
@ 2024-01-10 21:22   ` Jonathan Wakely
  0 siblings, 0 replies; 30+ messages in thread
From: Jonathan Wakely @ 2024-01-10 21:22 UTC (permalink / raw)
  To: Ken Matsui; +Cc: gcc-patches, libstdc++

On Wed, 10 Jan 2024 at 19:41, Ken Matsui <kmatsui@gcc.gnu.org> wrote:
>
> This patch optimizes the compilation performance of std::is_unsigned
> by dispatching to the new __is_unsigned built-in trait.

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


>
> libstdc++-v3/ChangeLog:
>
>         * include/std/type_traits (is_unsigned): Use __is_unsigned
>         built-in trait.
>         (is_unsigned_v): Likewise.
>
> Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
> ---
>  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 6294f5af533..4bcfb1389e3 100644
> --- a/libstdc++-v3/include/std/type_traits
> +++ b/libstdc++-v3/include/std/type_traits
> @@ -987,10 +987,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>      { };
>
>    /// is_unsigned
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_unsigned)
> +  template<typename _Tp>
> +    struct is_unsigned
> +    : public __bool_constant<__is_unsigned(_Tp)>
> +    { };
> +#else
>    template<typename _Tp>
>      struct is_unsigned
>      : public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>>::type
>      { };
> +#endif
>
>    /// @cond undocumented
>    template<typename _Tp, typename _Up = _Tp&&>
> @@ -3413,8 +3420,14 @@ template <typename _Tp>
>
>  template <typename _Tp>
>    inline constexpr bool is_signed_v = is_signed<_Tp>::value;
> +
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_unsigned)
> +template <typename _Tp>
> +  inline constexpr bool is_unsigned_v = __is_unsigned(_Tp);
> +#else
>  template <typename _Tp>
>    inline constexpr bool is_unsigned_v = is_unsigned<_Tp>::value;
> +#endif
>
>  template <typename _Tp, typename... _Args>
>    inline constexpr bool is_constructible_v = __is_constructible(_Tp, _Args...);
> --
> 2.43.0
>


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 12/14] libstdc++: Optimize std::is_signed compilation performance
  2024-01-10  9:23 ` [PATCH 12/14] libstdc++: Optimize std::is_signed compilation performance Ken Matsui
@ 2024-01-10 21:22   ` Jonathan Wakely
  0 siblings, 0 replies; 30+ messages in thread
From: Jonathan Wakely @ 2024-01-10 21:22 UTC (permalink / raw)
  To: Ken Matsui; +Cc: gcc-patches, libstdc++

On Wed, 10 Jan 2024 at 19:47, Ken Matsui <kmatsui@gcc.gnu.org> wrote:
>
> This patch optimizes the compilation performance of std::is_signed
> by dispatching to the new __is_signed built-in trait.

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


>
> libstdc++-v3/ChangeLog:
>
>         * include/std/type_traits (is_signed): Use __is_signed built-in
>         trait.
>         (is_signed_v): Likewise.
>
> Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
> ---
>  libstdc++-v3/include/std/type_traits | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
> index 4bcfb1389e3..b917c743aea 100644
> --- a/libstdc++-v3/include/std/type_traits
> +++ b/libstdc++-v3/include/std/type_traits
> @@ -968,6 +968,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>      : public __bool_constant<__is_abstract(_Tp)>
>      { };
>
> +  /// is_signed
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_signed)
> +  template<typename _Tp>
> +    struct is_signed
> +    : public __bool_constant<__is_signed(_Tp)>
> +    { };
> +#else
>    /// @cond undocumented
>    template<typename _Tp,
>            bool = is_arithmetic<_Tp>::value>
> @@ -980,11 +987,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>      { };
>    /// @endcond
>
> -  /// is_signed
>    template<typename _Tp>
>      struct is_signed
>      : public __is_signed_helper<_Tp>::type
>      { };
> +#endif
>
>    /// is_unsigned
>  #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_unsigned)
> @@ -3418,8 +3425,13 @@ template <typename _Tp>
>  template <typename _Tp>
>    inline constexpr bool is_final_v = __is_final(_Tp);
>
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_signed)
> +template <typename _Tp>
> +  inline constexpr bool is_signed_v = __is_signed(_Tp);
> +#else
>  template <typename _Tp>
>    inline constexpr bool is_signed_v = is_signed<_Tp>::value;
> +#endif
>
>  #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_unsigned)
>  template <typename _Tp>
> --
> 2.43.0
>


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 14/14] libstdc++: Optimize std::is_scalar compilation performance
  2024-01-10  9:23 ` [PATCH 14/14] libstdc++: Optimize std::is_scalar compilation performance Ken Matsui
@ 2024-01-10 21:22   ` Jonathan Wakely
  0 siblings, 0 replies; 30+ messages in thread
From: Jonathan Wakely @ 2024-01-10 21:22 UTC (permalink / raw)
  To: Ken Matsui; +Cc: gcc-patches, libstdc++

On Wed, 10 Jan 2024 at 19:47, Ken Matsui <kmatsui@gcc.gnu.org> wrote:
>
> This patch optimizes the compilation performance of std::is_scalar
> by dispatching to the new __is_scalar built-in trait.

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


>
> libstdc++-v3/ChangeLog:
>
>         * include/std/type_traits (is_scalar): Use __is_scalar built-in
>         trait.
>         (is_scalar_v): Likewise.
>
> Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
> ---
>  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 b917c743aea..9ace6a9f08f 100644
> --- a/libstdc++-v3/include/std/type_traits
> +++ b/libstdc++-v3/include/std/type_traits
> @@ -775,11 +775,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
>      struct is_member_pointer;
>
>    /// is_scalar
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_scalar)
> +  template<typename _Tp>
> +    struct is_scalar
> +    : public __bool_constant<__is_scalar(_Tp)>
> +    { };
> +#else
>    template<typename _Tp>
>      struct is_scalar
>      : public __or_<is_arithmetic<_Tp>, is_enum<_Tp>, is_pointer<_Tp>,
>                     is_member_pointer<_Tp>, is_null_pointer<_Tp>>::type
>      { };
> +#endif
>
>    /// is_compound
>    template<typename _Tp>
> @@ -3369,8 +3376,14 @@ template <typename _Tp>
>    inline constexpr bool is_object_v = is_object<_Tp>::value;
>  #endif
>
> +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_scalar)
> +template <typename _Tp>
> +  inline constexpr bool is_scalar_v = __is_scalar(_Tp);
> +#else
>  template <typename _Tp>
>    inline constexpr bool is_scalar_v = is_scalar<_Tp>::value;
> +#endif
> +
>  template <typename _Tp>
>    inline constexpr bool is_compound_v = !is_fundamental_v<_Tp>;
>
> --
> 2.43.0
>


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Re: [PATCH 08/14] libstdc++: Optimize std::is_compound compilation performance
  2024-01-10 21:21   ` Jonathan Wakely
@ 2024-01-11  3:02     ` Ken Matsui
  2024-01-11  4:14       ` [committed] " Ken Matsui
  0 siblings, 1 reply; 30+ messages in thread
From: Ken Matsui @ 2024-01-11  3:02 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: Ken Matsui, gcc-patches, libstdc++

On 01-10 (21:21), Jonathan Wakely wrote:
> On Wed, 10 Jan 2024 at 19:41, Ken Matsui <kmatsui@gcc.gnu.org> wrote:
> >
> > This patch optimizes the compilation performance of std::is_compound
> > by dispatching to the new __is_arithmetic built-in trait.
> 
> OK for trunk (no need to wait for anything else to be approved).
> 
Thank you for your all reviews!  This commit message is not quite accurate,
so I will update it before committing.

> >
> > libstdc++-v3/ChangeLog:
> >
> >         * include/std/type_traits (is_compound): Do not use __not_.
> >         (is_compound_v): Use is_fundamental_v instead.
> >
> > Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
> > ---
> >  libstdc++-v3/include/std/type_traits | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
> > index 1c560d97e85..6294f5af533 100644
> > --- a/libstdc++-v3/include/std/type_traits
> > +++ b/libstdc++-v3/include/std/type_traits
> > @@ -784,7 +784,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> >    /// is_compound
> >    template<typename _Tp>
> >      struct is_compound
> > -    : public __not_<is_fundamental<_Tp>>::type { };
> > +    : public __bool_constant<!is_fundamental<_Tp>::value> { };
> >
> >    /// is_member_pointer
> >  #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_pointer)
> > @@ -3358,7 +3358,7 @@ template <typename _Tp>
> >  template <typename _Tp>
> >    inline constexpr bool is_scalar_v = is_scalar<_Tp>::value;
> >  template <typename _Tp>
> > -  inline constexpr bool is_compound_v = is_compound<_Tp>::value;
> > +  inline constexpr bool is_compound_v = !is_fundamental_v<_Tp>;
> >
> >  #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_pointer)
> >  template <typename _Tp>
> > --
> > 2.43.0
> >
> 

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [committed] libstdc++: Optimize std::is_compound compilation performance
  2024-01-11  3:02     ` Ken Matsui
@ 2024-01-11  4:14       ` Ken Matsui
  0 siblings, 0 replies; 30+ messages in thread
From: Ken Matsui @ 2024-01-11  4:14 UTC (permalink / raw)
  To: gcc-patches; +Cc: libstdc++, Ken Matsui

This patch optimizes the compilation performance of std::is_compound.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (is_compound): Do not use __not_.
	(is_compound_v): Use is_fundamental_v instead.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
 libstdc++-v3/include/std/type_traits | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 1cec0822b73..b6b680a3c58 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -751,7 +751,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   /// is_compound
   template<typename _Tp>
     struct is_compound
-    : public __not_<is_fundamental<_Tp>>::type { };
+    : public __bool_constant<!is_fundamental<_Tp>::value> { };
 
   /// is_member_pointer
 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_pointer)
@@ -3305,7 +3305,7 @@ template <typename _Tp>
 template <typename _Tp>
   inline constexpr bool is_scalar_v = is_scalar<_Tp>::value;
 template <typename _Tp>
-  inline constexpr bool is_compound_v = is_compound<_Tp>::value;
+  inline constexpr bool is_compound_v = !is_fundamental_v<_Tp>;
 
 #if _GLIBCXX_USE_BUILTIN_TRAIT(__is_member_pointer)
 template <typename _Tp>
-- 
2.43.0


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 01/14] c++: Implement __is_integral built-in trait
  2024-01-10  9:22 ` [PATCH 01/14] c++: Implement __is_integral built-in trait Ken Matsui
@ 2024-01-17  0:30   ` Jason Merrill
  2024-01-17  7:42     ` Jonathan Wakely
  0 siblings, 1 reply; 30+ messages in thread
From: Jason Merrill @ 2024-01-17  0:30 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++, Ken Matsui, gcc-patches

On 1/10/24 04:22, Ken Matsui wrote:
> +/* Return true if T is an integral type.  With __STRICT_ANSI__, __int128 and
> +   unsigned __int128 are not integral types.  */

This really needs a rationale, since they are actually integer types.  I 
know __int128 is considered an extension rather than an extended integer 
type under the standard, but is there a writeup we can point to for why?

And even if we don't want to subject it to all the standard requirements 
of an extended integer type, why not still say it's an integral type? 
flag_iso is only supposed to disable features that could conflict with 
obscure but standard-conforming code, and since __int128 is in the 
reserved namespace, I'd think it should be safe to support (to the 
degree that we do) regardless of flag_iso.

Jason


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 03/14] c++: Implement __is_floating_point built-in trait
  2024-01-10  9:22 ` [PATCH 03/14] c++: Implement __is_floating_point built-in trait Ken Matsui
@ 2024-01-17  0:36   ` Jason Merrill
  0 siblings, 0 replies; 30+ messages in thread
From: Jason Merrill @ 2024-01-17  0:36 UTC (permalink / raw)
  To: Ken Matsui, gcc-patches; +Cc: libstdc++

On 1/10/24 04:22, Ken Matsui wrote:
> +/* Return true if T is a floating point type.  With __STRICT_ANSI__, __float128
> +   is not a floating point type.  However, _Float128 is a floating point type.

My comment about __is_integral again, but more so; if we support 
_Float128, why not __float128?  And what about __bfloat16_t?

Jason


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 09/14] c++: Implement __is_unsigned built-in trait
  2024-01-10  9:23 ` [PATCH 09/14] c++: Implement __is_unsigned built-in trait Ken Matsui
@ 2024-01-17  0:41   ` Jason Merrill
  0 siblings, 0 replies; 30+ messages in thread
From: Jason Merrill @ 2024-01-17  0:41 UTC (permalink / raw)
  To: Ken Matsui, gcc-patches; +Cc: libstdc++

On 1/10/24 04:23, Ken Matsui wrote:
> This patch implements built-in trait for std::is_unsigned.
> 
> +    case CPTK_IS_UNSIGNED:
> +      return TYPE_UNSIGNED (type1);

This seems to lack the checks for arithmetic type that the __is_signed 
patch has.

Jason


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 01/14] c++: Implement __is_integral built-in trait
  2024-01-17  0:30   ` Jason Merrill
@ 2024-01-17  7:42     ` Jonathan Wakely
  2024-01-17 11:28       ` Joseph Myers
  0 siblings, 1 reply; 30+ messages in thread
From: Jonathan Wakely @ 2024-01-17  7:42 UTC (permalink / raw)
  To: Jason Merrill; +Cc: Jonathan Wakely, libstdc++, Ken Matsui, gcc-patches

On Wed, 17 Jan 2024 at 00:31, Jason Merrill wrote:
>
> On 1/10/24 04:22, Ken Matsui wrote:
> > +/* Return true if T is an integral type.  With __STRICT_ANSI__, __int128 and
> > +   unsigned __int128 are not integral types.  */
>
> This really needs a rationale, since they are actually integer types.  I
> know __int128 is considered an extension rather than an extended integer
> type under the standard, but is there a writeup we can point to for why?
>
> And even if we don't want to subject it to all the standard requirements
> of an extended integer type, why not still say it's an integral type?
> flag_iso is only supposed to disable features that could conflict with
> obscure but standard-conforming code, and since __int128 is in the
> reserved namespace, I'd think it should be safe to support (to the
> degree that we do) regardless of flag_iso.

The reason for __int128 not being an integral type is because the
standard says that intmax_t must be the largest standard or extended
integer type, and intmax_t is fixed by ABI to be a 64-bit type. As a
result, GCC has historically said that 128-bit integer types are not
part of the "standard or extended integer type"classification, in
Joseph's words they're sui generis types. But C2x and C++23 changed
this, and now we can just do the obvious, simple thing and say that
128-bit integer types are integer types.
This changed with https://cplusplus.github.io/LWG/issue3828 for C++.

So we can remove the dependency on __STRICT_ISO__ for 128-bit integer
types, and implementing std::is_integral with a built-in seems like
the perfect time to do that. But that seems like stage 1 material, as
we need to go through the library and see what needs to change.


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 01/14] c++: Implement __is_integral built-in trait
  2024-01-17  7:42     ` Jonathan Wakely
@ 2024-01-17 11:28       ` Joseph Myers
  0 siblings, 0 replies; 30+ messages in thread
From: Joseph Myers @ 2024-01-17 11:28 UTC (permalink / raw)
  To: Jonathan Wakely
  Cc: Jason Merrill, Jonathan Wakely, libstdc++, Ken Matsui, gcc-patches

On Wed, 17 Jan 2024, Jonathan Wakely wrote:

> So we can remove the dependency on __STRICT_ISO__ for 128-bit integer
> types, and implementing std::is_integral with a built-in seems like
> the perfect time to do that. But that seems like stage 1 material, as
> we need to go through the library and see what needs to change.

As noted on IRC, for C23 there would also be library issues in making 
__int128 an extended integer type.  If it's an extended integer type, then 
C23 would require <stdint.h> to define int128_t, uint128_t, int_least128_t 
and uint_least128_t, along with the macros INT128_WIDTH, UINT128_WIDTH, 
INT_LEAST128_WIDTH, UINT_LEAST128_WIDTH (trivial), and INT128_C and 
UINT128_C (require an integer constant suffix), and INT128_MAX, 
INT128_MIN, UINT128_MAX, INT_LEAST128_MAX, INT_LEAST128_MIN, 
UINT_LEAST128_MAX (most simply defined using an integer constant suffix, 
though don't strictly require one).  And <inttypes.h> would have to define 
all the printf and scanf format macros for int128_t, uint128_t, 
int_least128_t and uint_least128_t - so library support would be needed 
for those (the format macros themselves should probably expand to "w128d" 
and similar, a C23 feature already supported for narrower types by glibc 
and by GCC format checking, rather than inventing new features there).

So because an extended integer type (without padding bits) in C23 is 
expected to have all the library support from <stdint.h> and <inttypes.h>, 
you need integer constant suffixes and printf/scanf support before you can 
declare __int128 an extended integer type for C23.

(If adding printf and scanf support for int128_t to glibc, it probably 
makes sense to add user-visible functions such as strtoi128 at the same 
time - no such functions are in the standard, but something like them 
would be needed internally as part of the scanf implementation, and it's 
likely they would be useful for users as well.)

-- 
Joseph S. Myers
josmyers@redhat.com


^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2024-01-17 11:28 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-10  9:22 [PATCH 00/14] Optimize integral-related type traits Ken Matsui
2024-01-10  9:22 ` [PATCH 01/14] c++: Implement __is_integral built-in trait Ken Matsui
2024-01-17  0:30   ` Jason Merrill
2024-01-17  7:42     ` Jonathan Wakely
2024-01-17 11:28       ` Joseph Myers
2024-01-10  9:22 ` [PATCH 02/14] libstdc++: Optimize std::is_integral compilation performance Ken Matsui
2024-01-10 21:19   ` Jonathan Wakely
2024-01-10  9:22 ` [PATCH 03/14] c++: Implement __is_floating_point built-in trait Ken Matsui
2024-01-17  0:36   ` Jason Merrill
2024-01-10  9:22 ` [PATCH 04/14] libstdc++: Optimize std::is_floating_point compilation performance Ken Matsui
2024-01-10 21:20   ` Jonathan Wakely
2024-01-10  9:22 ` [PATCH 05/14] c++: Implement __is_arithmetic built-in trait Ken Matsui
2024-01-10  9:22 ` [PATCH 06/14] libstdc++: Optimize std::is_arithmetic compilation performance Ken Matsui
2024-01-10 21:20   ` Jonathan Wakely
2024-01-10  9:22 ` [PATCH 07/14] libstdc++: Optimize std::is_fundamental " Ken Matsui
2024-01-10  9:22 ` [PATCH 08/14] libstdc++: Optimize std::is_compound " Ken Matsui
2024-01-10 21:21   ` Jonathan Wakely
2024-01-11  3:02     ` Ken Matsui
2024-01-11  4:14       ` [committed] " Ken Matsui
2024-01-10  9:23 ` [PATCH 09/14] c++: Implement __is_unsigned built-in trait Ken Matsui
2024-01-17  0:41   ` Jason Merrill
2024-01-10  9:23 ` [PATCH 10/14] libstdc++: Optimize std::is_unsigned compilation performance Ken Matsui
2024-01-10 21:22   ` Jonathan Wakely
2024-01-10  9:23 ` [PATCH 11/14] c++: Implement __is_signed built-in trait Ken Matsui
2024-01-10  9:23 ` [PATCH 12/14] libstdc++: Optimize std::is_signed compilation performance Ken Matsui
2024-01-10 21:22   ` Jonathan Wakely
2024-01-10  9:23 ` [PATCH 13/14] c++: Implement __is_scalar built-in trait Ken Matsui
2024-01-10 19:59   ` Ken Matsui
2024-01-10  9:23 ` [PATCH 14/14] libstdc++: Optimize std::is_scalar compilation performance Ken Matsui
2024-01-10 21:22   ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).