public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: Debug support
@ 2021-06-15 17:20 William Schmidt
  0 siblings, 0 replies; 7+ messages in thread
From: William Schmidt @ 2021-06-15 17:20 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:fbb96af3938b0c4f7046e6124e464055e0850f6b

commit fbb96af3938b0c4f7046e6124e464055e0850f6b
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Thu Apr 1 14:40:08 2021 -0500

    rs6000: Debug support
    
    2021-04-01  Bill Schmidt  <wschmidt@linux.ibm.com>
    
    gcc/
            * config/rs6000/rs6000-call.c (rs6000_debug_type): New function.
            (def_builtin): Change debug formatting for easier parsing and
            include more information.
            (rs6000_init_builtins): Add dump of autogenerated builtins.
            (altivec_init_builtins): Dump __builtin_altivec_mask_for_load for
            completeness.

Diff:
---
 gcc/config/rs6000/rs6000-call.c | 193 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 189 insertions(+), 4 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index 6c73920b165..2f9b16fbb5d 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -8880,6 +8880,106 @@ rs6000_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
 
 /* Builtins.  */
 
+/* Debug utility to translate a type node to a single token.  */
+static
+const char *rs6000_debug_type (tree type)
+{
+  if (type == void_type_node)
+    return "void";
+  else if (type == long_integer_type_node)
+    return "long";
+  else if (type == long_unsigned_type_node)
+    return "ulong";
+  else if (type == long_long_integer_type_node)
+    return "longlong";
+  else if (type == long_long_unsigned_type_node)
+    return "ulonglong";
+  else if (type == bool_V16QI_type_node)
+    return "vbc";
+  else if (type == bool_V2DI_type_node)
+    return "vbll";
+  else if (type == bool_V4SI_type_node)
+    return "vbi";
+  else if (type == bool_V8HI_type_node)
+    return "vbs";
+  else if (type == bool_int_type_node)
+    return "bool";
+  else if (type == dfloat64_type_node)
+    return "_Decimal64";
+  else if (type == double_type_node)
+    return "double";
+  else if (type == intDI_type_node)
+    return "sll";
+  else if (type == intHI_type_node)
+    return "ss";
+  else if (type == ibm128_float_type_node)
+    return "__ibm128";
+  else if (type == opaque_V4SI_type_node)
+    return "opaque";
+  else if (POINTER_TYPE_P (type))
+    return "void*";
+  else if (type == intQI_type_node || type == char_type_node)
+    return "sc";
+  else if (type == dfloat32_type_node)
+    return "_Decimal32";
+  else if (type == float_type_node)
+    return "float";
+  else if (type == intSI_type_node || type == integer_type_node)
+    return "si";
+  else if (type == dfloat128_type_node)
+    return "_Decimal128";
+  else if (type == long_double_type_node)
+    return "longdouble";
+  else if (type == intTI_type_node)
+    return "sq";
+  else if (type == unsigned_intDI_type_node)
+    return "ull";
+  else if (type == unsigned_intHI_type_node)
+    return "us";
+  else if (type == unsigned_intQI_type_node)
+    return "uc";
+  else if (type == unsigned_intSI_type_node)
+    return "ui";
+  else if (type == unsigned_intTI_type_node)
+    return "uq";
+  else if (type == unsigned_V16QI_type_node)
+    return "vuc";
+  else if (type == unsigned_V1TI_type_node)
+    return "vuq";
+  else if (type == unsigned_V2DI_type_node)
+    return "vull";
+  else if (type == unsigned_V4SI_type_node)
+    return "vui";
+  else if (type == unsigned_V8HI_type_node)
+    return "vus";
+  else if (type == V16QI_type_node)
+    return "vsc";
+  else if (type == V1TI_type_node)
+    return "vsq";
+  else if (type == V2DF_type_node)
+    return "vd";
+  else if (type == V2DI_type_node)
+    return "vsll";
+  else if (type == V4SF_type_node)
+    return "vf";
+  else if (type == V4SI_type_node)
+    return "vsi";
+  else if (type == V8HI_type_node)
+    return "vss";
+  else if (type == pixel_V8HI_type_node)
+    return "vp";
+  else if (type == pcvoid_type_node)
+    return "voidc*";
+  else if (type == float128_type_node)
+    return "_Float128";
+  else if (type == vector_pair_type_node)
+    return "__vector_pair";
+  else if (type == vector_quad_type_node)
+    return "__vector_quad";
+  else
+    return "unknown";
+}
+
 static void
 def_builtin (const char *name, tree type, enum rs6000_builtins code)
 {
@@ -8908,7 +9008,7 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
       /* const function, function only depends on the inputs.  */
       TREE_READONLY (t) = 1;
       TREE_NOTHROW (t) = 1;
-      attr_string = ", const";
+      attr_string = "= const";
     }
   else if ((classify & RS6000_BTC_PURE) != 0)
     {
@@ -8916,7 +9016,7 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
 	 external state.  */
       DECL_PURE_P (t) = 1;
       TREE_NOTHROW (t) = 1;
-      attr_string = ", pure";
+      attr_string = "= pure";
     }
   else if ((classify & RS6000_BTC_FP) != 0)
     {
@@ -8930,12 +9030,12 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
 	{
 	  DECL_PURE_P (t) = 1;
 	  DECL_IS_NOVOPS (t) = 1;
-	  attr_string = ", fp, pure";
+	  attr_string = "= fp, pure";
 	}
       else
 	{
 	  TREE_READONLY (t) = 1;
-	  attr_string = ", fp, const";
+	  attr_string = "= fp, const";
 	}
     }
   else if ((classify & (RS6000_BTC_QUAD | RS6000_BTC_PAIR)) != 0)
@@ -8944,9 +9044,27 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
   else if ((classify & RS6000_BTC_ATTR_MASK) != 0)
     gcc_unreachable ();
 
+  if (TARGET_DEBUG_BUILTIN)
+    {
+      tree t = TREE_TYPE (type);
+      fprintf (stderr, "%s %s (", rs6000_debug_type (t), name);
+      t = TYPE_ARG_TYPES (type);
+      while (t && TREE_VALUE (t) != void_type_node)
+	{
+	  fprintf (stderr, "%s",
+		   rs6000_debug_type (TREE_VALUE (t)));
+	  t = TREE_CHAIN (t);
+	  if (t && TREE_VALUE (t) != void_type_node)
+	    fprintf (stderr, ", ");
+	}
+      fprintf (stderr, "); %s [%4d]\n", attr_string, (int)code);
+    }
+
+  /*
   if (TARGET_DEBUG_BUILTIN)
     fprintf (stderr, "rs6000_builtin, code = %4d, %s%s\n",
 	     (int)code, name, attr_string);
+  */
 }
 
 static const struct builtin_compatibility bdesc_compat[] =
@@ -16099,6 +16217,67 @@ rs6000_init_builtins (void)
     altivec_builtin_mask_for_load
       = rs6000_builtin_decls_x[RS6000_BIF_MASK_FOR_LOAD];
 
+  if (TARGET_DEBUG_BUILTIN)
+     {
+      fprintf (stderr, "\nAutogenerated built-in functions:\n\n");
+      for (int i = 1; i < (int) RS6000_BIF_MAX; i++)
+	{
+	  bif_enable e = rs6000_builtin_info_x[i].enable;
+	  if (e == ENB_P5 && !TARGET_POPCNTB)
+	    continue;
+	  if (e == ENB_P6 && !TARGET_CMPB)
+	    continue;
+	  if (e == ENB_ALTIVEC && !TARGET_ALTIVEC)
+	    continue;
+	  if (e == ENB_VSX && !TARGET_VSX)
+	    continue;
+	  if (e == ENB_P7 && !TARGET_POPCNTD)
+	    continue;
+	  if (e == ENB_P7_64 && (!TARGET_POPCNTD || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P8 && !TARGET_DIRECT_MOVE)
+	    continue;
+	  if (e == ENB_P8V && !TARGET_P8_VECTOR)
+	    continue;
+	  if (e == ENB_P9 && !TARGET_MODULO)
+	    continue;
+	  if (e == ENB_P9_64 && (!TARGET_MODULO || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P9V && !TARGET_P9_VECTOR)
+	    continue;
+	  if (e == ENB_IEEE128_HW && !TARGET_FLOAT128_HW)
+	    continue;
+	  if (e == ENB_DFP && !TARGET_DFP)
+	    continue;
+	  if (e == ENB_CRYPTO && !TARGET_CRYPTO)
+	    continue;
+	  if (e == ENB_HTM && !TARGET_HTM)
+	    continue;
+	  if (e == ENB_P10 && !TARGET_POWER10)
+	    continue;
+	  if (e == ENB_P10_64 && (!TARGET_POWER10 || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_MMA && !TARGET_MMA)
+	    continue;
+	  tree fntype = rs6000_builtin_info_x[i].fntype;
+	  tree t = TREE_TYPE (fntype);
+	  fprintf (stderr, "%s %s (", rs6000_debug_type (t),
+		   rs6000_builtin_info_x[i].bifname);
+	  t = TYPE_ARG_TYPES (fntype);
+	  while (t && TREE_VALUE (t) != void_type_node)
+	    {
+	      fprintf (stderr, "%s",
+		       rs6000_debug_type (TREE_VALUE (t)));
+	      t = TREE_CHAIN (t);
+	      if (t && TREE_VALUE (t) != void_type_node)
+		fprintf (stderr, ", ");
+	    }
+	  fprintf (stderr, "); %s [%4d]\n",
+		   rs6000_builtin_info_x[i].attr_string, (int) i);
+	}
+      fprintf (stderr, "\nEnd autogenerated built-in functions.\n\n\n");
+     }
+
   if (new_builtins_are_live)
     {
 #ifdef SUBTARGET_INIT_BUILTINS
@@ -16762,6 +16941,12 @@ altivec_init_builtins (void)
 			       ALTIVEC_BUILTIN_MASK_FOR_LOAD,
 			       BUILT_IN_MD, NULL, NULL_TREE);
   TREE_READONLY (decl) = 1;
+  if (TARGET_DEBUG_BUILTIN)
+    fprintf (stderr, "%s __builtin_altivec_mask_for_load (%s); [%4d]\n",
+	     rs6000_debug_type (TREE_TYPE (v16qi_ftype_pcvoid)),
+	     rs6000_debug_type (TREE_VALUE
+				(TYPE_ARG_TYPES (v16qi_ftype_pcvoid))),
+	     (int) ALTIVEC_BUILTIN_MASK_FOR_LOAD);
   /* Record the decl. Will be used by rs6000_builtin_mask_for_load.  */
   altivec_builtin_mask_for_load = decl;


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

* [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: Debug support
@ 2021-07-29 14:47 William Schmidt
  0 siblings, 0 replies; 7+ messages in thread
From: William Schmidt @ 2021-07-29 14:47 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:01270e0b50e1c2cb382f856b9f77a05a60fe4042

commit 01270e0b50e1c2cb382f856b9f77a05a60fe4042
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Wed Jul 28 16:55:11 2021 -0400

    rs6000: Debug support
    
    2021-07-28  Bill Schmidt  <wschmidt@linux.ibm.com>
    
    gcc/
            * config/rs6000/rs6000-call.c (rs6000_debug_type): New function.
            (def_builtin): Change debug formatting for easier parsing and
            include more information.
            (rs6000_init_builtins): Add dump of autogenerated builtins.
            (altivec_init_builtins): Dump __builtin_altivec_mask_for_load for
            completeness.

Diff:
---
 gcc/config/rs6000/rs6000-call.c | 191 ++++++++++++++++++++++++++++++++++++++--
 1 file changed, 185 insertions(+), 6 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index d14d58be7d7..8e2f76f1b5c 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -8880,6 +8880,106 @@ rs6000_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
 
 /* Builtins.  */
 
+/* Debug utility to translate a type node to a single token.  */
+static
+const char *rs6000_debug_type (tree type)
+{
+  if (type == void_type_node)
+    return "void";
+  else if (type == long_integer_type_node)
+    return "long";
+  else if (type == long_unsigned_type_node)
+    return "ulong";
+  else if (type == long_long_integer_type_node)
+    return "longlong";
+  else if (type == long_long_unsigned_type_node)
+    return "ulonglong";
+  else if (type == bool_V2DI_type_node)
+    return "vbll";
+  else if (type == bool_V4SI_type_node)
+    return "vbi";
+  else if (type == bool_V8HI_type_node)
+    return "vbs";
+  else if (type == bool_V16QI_type_node)
+    return "vbc";
+  else if (type == bool_int_type_node)
+    return "bool";
+  else if (type == dfloat64_type_node)
+    return "_Decimal64";
+  else if (type == double_type_node)
+    return "double";
+  else if (type == intDI_type_node)
+    return "sll";
+  else if (type == intHI_type_node)
+    return "ss";
+  else if (type == ibm128_float_type_node)
+    return "__ibm128";
+  else if (type == opaque_V4SI_type_node)
+    return "opaque";
+  else if (POINTER_TYPE_P (type))
+    return "void*";
+  else if (type == intQI_type_node || type == char_type_node)
+    return "sc";
+  else if (type == dfloat32_type_node)
+    return "_Decimal32";
+  else if (type == float_type_node)
+    return "float";
+  else if (type == intSI_type_node || type == integer_type_node)
+    return "si";
+  else if (type == dfloat128_type_node)
+    return "_Decimal128";
+  else if (type == long_double_type_node)
+    return "longdouble";
+  else if (type == intTI_type_node)
+    return "sq";
+  else if (type == unsigned_intDI_type_node)
+    return "ull";
+  else if (type == unsigned_intHI_type_node)
+    return "us";
+  else if (type == unsigned_intQI_type_node)
+    return "uc";
+  else if (type == unsigned_intSI_type_node)
+    return "ui";
+  else if (type == unsigned_intTI_type_node)
+    return "uq";
+  else if (type == unsigned_V1TI_type_node)
+    return "vuq";
+  else if (type == unsigned_V2DI_type_node)
+    return "vull";
+  else if (type == unsigned_V4SI_type_node)
+    return "vui";
+  else if (type == unsigned_V8HI_type_node)
+    return "vus";
+  else if (type == unsigned_V16QI_type_node)
+    return "vuc";
+  else if (type == V16QI_type_node)
+    return "vsc";
+  else if (type == V1TI_type_node)
+    return "vsq";
+  else if (type == V2DF_type_node)
+    return "vd";
+  else if (type == V2DI_type_node)
+    return "vsll";
+  else if (type == V4SF_type_node)
+    return "vf";
+  else if (type == V4SI_type_node)
+    return "vsi";
+  else if (type == V8HI_type_node)
+    return "vss";
+  else if (type == pixel_V8HI_type_node)
+    return "vp";
+  else if (type == pcvoid_type_node)
+    return "voidc*";
+  else if (type == float128_type_node)
+    return "_Float128";
+  else if (type == vector_pair_type_node)
+    return "__vector_pair";
+  else if (type == vector_quad_type_node)
+    return "__vector_quad";
+  else
+    return "unknown";
+}
+
 static void
 def_builtin (const char *name, tree type, enum rs6000_builtins code)
 {
@@ -8908,7 +9008,7 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
       /* const function, function only depends on the inputs.  */
       TREE_READONLY (t) = 1;
       TREE_NOTHROW (t) = 1;
-      attr_string = ", const";
+      attr_string = "= const";
     }
   else if ((classify & RS6000_BTC_PURE) != 0)
     {
@@ -8916,7 +9016,7 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
 	 external state.  */
       DECL_PURE_P (t) = 1;
       TREE_NOTHROW (t) = 1;
-      attr_string = ", pure";
+      attr_string = "= pure";
     }
   else if ((classify & RS6000_BTC_FP) != 0)
     {
@@ -8930,12 +9030,12 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
 	{
 	  DECL_PURE_P (t) = 1;
 	  DECL_IS_NOVOPS (t) = 1;
-	  attr_string = ", fp, pure";
+	  attr_string = "= fp, pure";
 	}
       else
 	{
 	  TREE_READONLY (t) = 1;
-	  attr_string = ", fp, const";
+	  attr_string = "= fp, const";
 	}
     }
   else if ((classify & (RS6000_BTC_QUAD | RS6000_BTC_PAIR)) != 0)
@@ -8945,8 +9045,20 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
     gcc_unreachable ();
 
   if (TARGET_DEBUG_BUILTIN)
-    fprintf (stderr, "rs6000_builtin, code = %4d, %s%s\n",
-	     (int)code, name, attr_string);
+    {
+      tree t = TREE_TYPE (type);
+      fprintf (stderr, "%s %s (", rs6000_debug_type (t), name);
+      t = TYPE_ARG_TYPES (type);
+      while (t && TREE_VALUE (t) != void_type_node)
+	{
+	  fprintf (stderr, "%s",
+		   rs6000_debug_type (TREE_VALUE (t)));
+	  t = TREE_CHAIN (t);
+	  if (t && TREE_VALUE (t) != void_type_node)
+	    fprintf (stderr, ", ");
+	}
+      fprintf (stderr, "); %s [%4d]\n", attr_string, (int)code);
+    }
 }
 
 static const struct builtin_compatibility bdesc_compat[] =
@@ -16184,6 +16296,67 @@ rs6000_init_builtins (void)
     altivec_builtin_mask_for_load
       = rs6000_builtin_decls_x[RS6000_BIF_MASK_FOR_LOAD];
 
+  if (TARGET_DEBUG_BUILTIN)
+     {
+      fprintf (stderr, "\nAutogenerated built-in functions:\n\n");
+      for (int i = 1; i < (int) RS6000_BIF_MAX; i++)
+	{
+	  bif_enable e = rs6000_builtin_info_x[i].enable;
+	  if (e == ENB_P5 && !TARGET_POPCNTB)
+	    continue;
+	  if (e == ENB_P6 && !TARGET_CMPB)
+	    continue;
+	  if (e == ENB_ALTIVEC && !TARGET_ALTIVEC)
+	    continue;
+	  if (e == ENB_VSX && !TARGET_VSX)
+	    continue;
+	  if (e == ENB_P7 && !TARGET_POPCNTD)
+	    continue;
+	  if (e == ENB_P7_64 && (!TARGET_POPCNTD || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P8 && !TARGET_DIRECT_MOVE)
+	    continue;
+	  if (e == ENB_P8V && !TARGET_P8_VECTOR)
+	    continue;
+	  if (e == ENB_P9 && !TARGET_MODULO)
+	    continue;
+	  if (e == ENB_P9_64 && (!TARGET_MODULO || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P9V && !TARGET_P9_VECTOR)
+	    continue;
+	  if (e == ENB_IEEE128_HW && !TARGET_FLOAT128_HW)
+	    continue;
+	  if (e == ENB_DFP && !TARGET_DFP)
+	    continue;
+	  if (e == ENB_CRYPTO && !TARGET_CRYPTO)
+	    continue;
+	  if (e == ENB_HTM && !TARGET_HTM)
+	    continue;
+	  if (e == ENB_P10 && !TARGET_POWER10)
+	    continue;
+	  if (e == ENB_P10_64 && (!TARGET_POWER10 || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_MMA && !TARGET_MMA)
+	    continue;
+	  tree fntype = rs6000_builtin_info_x[i].fntype;
+	  tree t = TREE_TYPE (fntype);
+	  fprintf (stderr, "%s %s (", rs6000_debug_type (t),
+		   rs6000_builtin_info_x[i].bifname);
+	  t = TYPE_ARG_TYPES (fntype);
+	  while (t && TREE_VALUE (t) != void_type_node)
+	    {
+	      fprintf (stderr, "%s",
+		       rs6000_debug_type (TREE_VALUE (t)));
+	      t = TREE_CHAIN (t);
+	      if (t && TREE_VALUE (t) != void_type_node)
+		fprintf (stderr, ", ");
+	    }
+	  fprintf (stderr, "); %s [%4d]\n",
+		   rs6000_builtin_info_x[i].attr_string, (int) i);
+	}
+      fprintf (stderr, "\nEnd autogenerated built-in functions.\n\n\n");
+     }
+
   if (new_builtins_are_live)
     {
 #ifdef SUBTARGET_INIT_BUILTINS
@@ -16847,6 +17020,12 @@ altivec_init_builtins (void)
 			       ALTIVEC_BUILTIN_MASK_FOR_LOAD,
 			       BUILT_IN_MD, NULL, NULL_TREE);
   TREE_READONLY (decl) = 1;
+  if (TARGET_DEBUG_BUILTIN)
+    fprintf (stderr, "%s __builtin_altivec_mask_for_load (%s); [%4d]\n",
+	     rs6000_debug_type (TREE_TYPE (v16qi_ftype_pcvoid)),
+	     rs6000_debug_type (TREE_VALUE
+				(TYPE_ARG_TYPES (v16qi_ftype_pcvoid))),
+	     (int) ALTIVEC_BUILTIN_MASK_FOR_LOAD);
   /* Record the decl. Will be used by rs6000_builtin_mask_for_load.  */
   altivec_builtin_mask_for_load = decl;


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

* [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: Debug support
@ 2021-06-25 16:19 William Schmidt
  0 siblings, 0 replies; 7+ messages in thread
From: William Schmidt @ 2021-06-25 16:19 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:45258f83249345b1faf49554a6f4a7940983f822

commit 45258f83249345b1faf49554a6f4a7940983f822
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Thu Apr 1 14:40:08 2021 -0500

    rs6000: Debug support
    
    2021-04-01  Bill Schmidt  <wschmidt@linux.ibm.com>
    
    gcc/
            * config/rs6000/rs6000-call.c (rs6000_debug_type): New function.
            (def_builtin): Change debug formatting for easier parsing and
            include more information.
            (rs6000_init_builtins): Add dump of autogenerated builtins.
            (altivec_init_builtins): Dump __builtin_altivec_mask_for_load for
            completeness.

Diff:
---
 gcc/config/rs6000/rs6000-call.c | 193 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 189 insertions(+), 4 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index 54cf014ed23..d28bb14b0bb 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -8880,6 +8880,106 @@ rs6000_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
 
 /* Builtins.  */
 
+/* Debug utility to translate a type node to a single token.  */
+static
+const char *rs6000_debug_type (tree type)
+{
+  if (type == void_type_node)
+    return "void";
+  else if (type == long_integer_type_node)
+    return "long";
+  else if (type == long_unsigned_type_node)
+    return "ulong";
+  else if (type == long_long_integer_type_node)
+    return "longlong";
+  else if (type == long_long_unsigned_type_node)
+    return "ulonglong";
+  else if (type == bool_V16QI_type_node)
+    return "vbc";
+  else if (type == bool_V2DI_type_node)
+    return "vbll";
+  else if (type == bool_V4SI_type_node)
+    return "vbi";
+  else if (type == bool_V8HI_type_node)
+    return "vbs";
+  else if (type == bool_int_type_node)
+    return "bool";
+  else if (type == dfloat64_type_node)
+    return "_Decimal64";
+  else if (type == double_type_node)
+    return "double";
+  else if (type == intDI_type_node)
+    return "sll";
+  else if (type == intHI_type_node)
+    return "ss";
+  else if (type == ibm128_float_type_node)
+    return "__ibm128";
+  else if (type == opaque_V4SI_type_node)
+    return "opaque";
+  else if (POINTER_TYPE_P (type))
+    return "void*";
+  else if (type == intQI_type_node || type == char_type_node)
+    return "sc";
+  else if (type == dfloat32_type_node)
+    return "_Decimal32";
+  else if (type == float_type_node)
+    return "float";
+  else if (type == intSI_type_node || type == integer_type_node)
+    return "si";
+  else if (type == dfloat128_type_node)
+    return "_Decimal128";
+  else if (type == long_double_type_node)
+    return "longdouble";
+  else if (type == intTI_type_node)
+    return "sq";
+  else if (type == unsigned_intDI_type_node)
+    return "ull";
+  else if (type == unsigned_intHI_type_node)
+    return "us";
+  else if (type == unsigned_intQI_type_node)
+    return "uc";
+  else if (type == unsigned_intSI_type_node)
+    return "ui";
+  else if (type == unsigned_intTI_type_node)
+    return "uq";
+  else if (type == unsigned_V16QI_type_node)
+    return "vuc";
+  else if (type == unsigned_V1TI_type_node)
+    return "vuq";
+  else if (type == unsigned_V2DI_type_node)
+    return "vull";
+  else if (type == unsigned_V4SI_type_node)
+    return "vui";
+  else if (type == unsigned_V8HI_type_node)
+    return "vus";
+  else if (type == V16QI_type_node)
+    return "vsc";
+  else if (type == V1TI_type_node)
+    return "vsq";
+  else if (type == V2DF_type_node)
+    return "vd";
+  else if (type == V2DI_type_node)
+    return "vsll";
+  else if (type == V4SF_type_node)
+    return "vf";
+  else if (type == V4SI_type_node)
+    return "vsi";
+  else if (type == V8HI_type_node)
+    return "vss";
+  else if (type == pixel_V8HI_type_node)
+    return "vp";
+  else if (type == pcvoid_type_node)
+    return "voidc*";
+  else if (type == float128_type_node)
+    return "_Float128";
+  else if (type == vector_pair_type_node)
+    return "__vector_pair";
+  else if (type == vector_quad_type_node)
+    return "__vector_quad";
+  else
+    return "unknown";
+}
+
 static void
 def_builtin (const char *name, tree type, enum rs6000_builtins code)
 {
@@ -8908,7 +9008,7 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
       /* const function, function only depends on the inputs.  */
       TREE_READONLY (t) = 1;
       TREE_NOTHROW (t) = 1;
-      attr_string = ", const";
+      attr_string = "= const";
     }
   else if ((classify & RS6000_BTC_PURE) != 0)
     {
@@ -8916,7 +9016,7 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
 	 external state.  */
       DECL_PURE_P (t) = 1;
       TREE_NOTHROW (t) = 1;
-      attr_string = ", pure";
+      attr_string = "= pure";
     }
   else if ((classify & RS6000_BTC_FP) != 0)
     {
@@ -8930,12 +9030,12 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
 	{
 	  DECL_PURE_P (t) = 1;
 	  DECL_IS_NOVOPS (t) = 1;
-	  attr_string = ", fp, pure";
+	  attr_string = "= fp, pure";
 	}
       else
 	{
 	  TREE_READONLY (t) = 1;
-	  attr_string = ", fp, const";
+	  attr_string = "= fp, const";
 	}
     }
   else if ((classify & (RS6000_BTC_QUAD | RS6000_BTC_PAIR)) != 0)
@@ -8944,9 +9044,27 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
   else if ((classify & RS6000_BTC_ATTR_MASK) != 0)
     gcc_unreachable ();
 
+  if (TARGET_DEBUG_BUILTIN)
+    {
+      tree t = TREE_TYPE (type);
+      fprintf (stderr, "%s %s (", rs6000_debug_type (t), name);
+      t = TYPE_ARG_TYPES (type);
+      while (t && TREE_VALUE (t) != void_type_node)
+	{
+	  fprintf (stderr, "%s",
+		   rs6000_debug_type (TREE_VALUE (t)));
+	  t = TREE_CHAIN (t);
+	  if (t && TREE_VALUE (t) != void_type_node)
+	    fprintf (stderr, ", ");
+	}
+      fprintf (stderr, "); %s [%4d]\n", attr_string, (int)code);
+    }
+
+  /*
   if (TARGET_DEBUG_BUILTIN)
     fprintf (stderr, "rs6000_builtin, code = %4d, %s%s\n",
 	     (int)code, name, attr_string);
+  */
 }
 
 static const struct builtin_compatibility bdesc_compat[] =
@@ -16122,6 +16240,67 @@ rs6000_init_builtins (void)
     altivec_builtin_mask_for_load
       = rs6000_builtin_decls_x[RS6000_BIF_MASK_FOR_LOAD];
 
+  if (TARGET_DEBUG_BUILTIN)
+     {
+      fprintf (stderr, "\nAutogenerated built-in functions:\n\n");
+      for (int i = 1; i < (int) RS6000_BIF_MAX; i++)
+	{
+	  bif_enable e = rs6000_builtin_info_x[i].enable;
+	  if (e == ENB_P5 && !TARGET_POPCNTB)
+	    continue;
+	  if (e == ENB_P6 && !TARGET_CMPB)
+	    continue;
+	  if (e == ENB_ALTIVEC && !TARGET_ALTIVEC)
+	    continue;
+	  if (e == ENB_VSX && !TARGET_VSX)
+	    continue;
+	  if (e == ENB_P7 && !TARGET_POPCNTD)
+	    continue;
+	  if (e == ENB_P7_64 && (!TARGET_POPCNTD || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P8 && !TARGET_DIRECT_MOVE)
+	    continue;
+	  if (e == ENB_P8V && !TARGET_P8_VECTOR)
+	    continue;
+	  if (e == ENB_P9 && !TARGET_MODULO)
+	    continue;
+	  if (e == ENB_P9_64 && (!TARGET_MODULO || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P9V && !TARGET_P9_VECTOR)
+	    continue;
+	  if (e == ENB_IEEE128_HW && !TARGET_FLOAT128_HW)
+	    continue;
+	  if (e == ENB_DFP && !TARGET_DFP)
+	    continue;
+	  if (e == ENB_CRYPTO && !TARGET_CRYPTO)
+	    continue;
+	  if (e == ENB_HTM && !TARGET_HTM)
+	    continue;
+	  if (e == ENB_P10 && !TARGET_POWER10)
+	    continue;
+	  if (e == ENB_P10_64 && (!TARGET_POWER10 || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_MMA && !TARGET_MMA)
+	    continue;
+	  tree fntype = rs6000_builtin_info_x[i].fntype;
+	  tree t = TREE_TYPE (fntype);
+	  fprintf (stderr, "%s %s (", rs6000_debug_type (t),
+		   rs6000_builtin_info_x[i].bifname);
+	  t = TYPE_ARG_TYPES (fntype);
+	  while (t && TREE_VALUE (t) != void_type_node)
+	    {
+	      fprintf (stderr, "%s",
+		       rs6000_debug_type (TREE_VALUE (t)));
+	      t = TREE_CHAIN (t);
+	      if (t && TREE_VALUE (t) != void_type_node)
+		fprintf (stderr, ", ");
+	    }
+	  fprintf (stderr, "); %s [%4d]\n",
+		   rs6000_builtin_info_x[i].attr_string, (int) i);
+	}
+      fprintf (stderr, "\nEnd autogenerated built-in functions.\n\n\n");
+     }
+
   if (new_builtins_are_live)
     {
 #ifdef SUBTARGET_INIT_BUILTINS
@@ -16785,6 +16964,12 @@ altivec_init_builtins (void)
 			       ALTIVEC_BUILTIN_MASK_FOR_LOAD,
 			       BUILT_IN_MD, NULL, NULL_TREE);
   TREE_READONLY (decl) = 1;
+  if (TARGET_DEBUG_BUILTIN)
+    fprintf (stderr, "%s __builtin_altivec_mask_for_load (%s); [%4d]\n",
+	     rs6000_debug_type (TREE_TYPE (v16qi_ftype_pcvoid)),
+	     rs6000_debug_type (TREE_VALUE
+				(TYPE_ARG_TYPES (v16qi_ftype_pcvoid))),
+	     (int) ALTIVEC_BUILTIN_MASK_FOR_LOAD);
   /* Record the decl. Will be used by rs6000_builtin_mask_for_load.  */
   altivec_builtin_mask_for_load = decl;


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

* [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: Debug support
@ 2021-04-26 20:52 William Schmidt
  0 siblings, 0 replies; 7+ messages in thread
From: William Schmidt @ 2021-04-26 20:52 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:edee3119cd0d656c2b30114b5d64af4a83607ddb

commit edee3119cd0d656c2b30114b5d64af4a83607ddb
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Thu Apr 1 14:40:08 2021 -0500

    rs6000: Debug support
    
    2021-04-01  Bill Schmidt  <wschmidt@linux.ibm.com>
    
    gcc/
            * config/rs6000/rs6000-call.c (rs6000_debug_type): New function.
            (def_builtin): Change debug formatting for easier parsing and
            include more information.
            (rs6000_init_builtins): Add dump of autogenerated builtins.
            (altivec_init_builtins): Dump __builtin_altivec_mask_for_load for
            completeness.

Diff:
---
 gcc/config/rs6000/rs6000-call.c | 193 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 189 insertions(+), 4 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index 406fb9ce2cb..288bc6b455a 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -8779,6 +8779,106 @@ rs6000_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
 
 /* Builtins.  */
 
+/* Debug utility to translate a type node to a single token.  */
+static
+const char *rs6000_debug_type (tree type)
+{
+  if (type == void_type_node)
+    return "void";
+  else if (type == long_integer_type_node)
+    return "long";
+  else if (type == long_unsigned_type_node)
+    return "ulong";
+  else if (type == long_long_integer_type_node)
+    return "longlong";
+  else if (type == long_long_unsigned_type_node)
+    return "ulonglong";
+  else if (type == bool_V16QI_type_node)
+    return "vbc";
+  else if (type == bool_V2DI_type_node)
+    return "vbll";
+  else if (type == bool_V4SI_type_node)
+    return "vbi";
+  else if (type == bool_V8HI_type_node)
+    return "vbs";
+  else if (type == bool_int_type_node)
+    return "bool";
+  else if (type == dfloat64_type_node)
+    return "_Decimal64";
+  else if (type == double_type_node)
+    return "double";
+  else if (type == intDI_type_node)
+    return "sll";
+  else if (type == intHI_type_node)
+    return "ss";
+  else if (type == ibm128_float_type_node)
+    return "__ibm128";
+  else if (type == opaque_V4SI_type_node)
+    return "opaque";
+  else if (POINTER_TYPE_P (type))
+    return "void*";
+  else if (type == intQI_type_node || type == char_type_node)
+    return "sc";
+  else if (type == dfloat32_type_node)
+    return "_Decimal32";
+  else if (type == float_type_node)
+    return "float";
+  else if (type == intSI_type_node || type == integer_type_node)
+    return "si";
+  else if (type == dfloat128_type_node)
+    return "_Decimal128";
+  else if (type == long_double_type_node)
+    return "longdouble";
+  else if (type == intTI_type_node)
+    return "sq";
+  else if (type == unsigned_intDI_type_node)
+    return "ull";
+  else if (type == unsigned_intHI_type_node)
+    return "us";
+  else if (type == unsigned_intQI_type_node)
+    return "uc";
+  else if (type == unsigned_intSI_type_node)
+    return "ui";
+  else if (type == unsigned_intTI_type_node)
+    return "uq";
+  else if (type == unsigned_V16QI_type_node)
+    return "vuc";
+  else if (type == unsigned_V1TI_type_node)
+    return "vuq";
+  else if (type == unsigned_V2DI_type_node)
+    return "vull";
+  else if (type == unsigned_V4SI_type_node)
+    return "vui";
+  else if (type == unsigned_V8HI_type_node)
+    return "vus";
+  else if (type == V16QI_type_node)
+    return "vsc";
+  else if (type == V1TI_type_node)
+    return "vsq";
+  else if (type == V2DF_type_node)
+    return "vd";
+  else if (type == V2DI_type_node)
+    return "vsll";
+  else if (type == V4SF_type_node)
+    return "vf";
+  else if (type == V4SI_type_node)
+    return "vsi";
+  else if (type == V8HI_type_node)
+    return "vss";
+  else if (type == pixel_V8HI_type_node)
+    return "vp";
+  else if (type == pcvoid_type_node)
+    return "voidc*";
+  else if (type == float128_type_node)
+    return "_Float128";
+  else if (type == vector_pair_type_node)
+    return "__vector_pair";
+  else if (type == vector_quad_type_node)
+    return "__vector_quad";
+  else
+    return "unknown";
+}
+
 static void
 def_builtin (const char *name, tree type, enum rs6000_builtins code)
 {
@@ -8807,7 +8907,7 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
       /* const function, function only depends on the inputs.  */
       TREE_READONLY (t) = 1;
       TREE_NOTHROW (t) = 1;
-      attr_string = ", const";
+      attr_string = "= const";
     }
   else if ((classify & RS6000_BTC_PURE) != 0)
     {
@@ -8815,7 +8915,7 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
 	 external state.  */
       DECL_PURE_P (t) = 1;
       TREE_NOTHROW (t) = 1;
-      attr_string = ", pure";
+      attr_string = "= pure";
     }
   else if ((classify & RS6000_BTC_FP) != 0)
     {
@@ -8829,12 +8929,12 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
 	{
 	  DECL_PURE_P (t) = 1;
 	  DECL_IS_NOVOPS (t) = 1;
-	  attr_string = ", fp, pure";
+	  attr_string = "= fp, pure";
 	}
       else
 	{
 	  TREE_READONLY (t) = 1;
-	  attr_string = ", fp, const";
+	  attr_string = "= fp, const";
 	}
     }
   else if ((classify & (RS6000_BTC_QUAD | RS6000_BTC_PAIR)) != 0)
@@ -8843,9 +8943,27 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
   else if ((classify & RS6000_BTC_ATTR_MASK) != 0)
     gcc_unreachable ();
 
+  if (TARGET_DEBUG_BUILTIN)
+    {
+      tree t = TREE_TYPE (type);
+      fprintf (stderr, "%s %s (", rs6000_debug_type (t), name);
+      t = TYPE_ARG_TYPES (type);
+      while (t && TREE_VALUE (t) != void_type_node)
+	{
+	  fprintf (stderr, "%s",
+		   rs6000_debug_type (TREE_VALUE (t)));
+	  t = TREE_CHAIN (t);
+	  if (t && TREE_VALUE (t) != void_type_node)
+	    fprintf (stderr, ", ");
+	}
+      fprintf (stderr, "); %s [%4d]\n", attr_string, (int)code);
+    }
+
+  /*
   if (TARGET_DEBUG_BUILTIN)
     fprintf (stderr, "rs6000_builtin, code = %4d, %s%s\n",
 	     (int)code, name, attr_string);
+  */
 }
 
 static const struct builtin_compatibility bdesc_compat[] =
@@ -15972,6 +16090,67 @@ rs6000_init_builtins (void)
     altivec_builtin_mask_for_load
       = rs6000_builtin_decls_x[RS6000_BIF_MASK_FOR_LOAD];
 
+  if (TARGET_DEBUG_BUILTIN)
+     {
+      fprintf (stderr, "\nAutogenerated built-in functions:\n\n");
+      for (int i = 1; i < (int) RS6000_BIF_MAX; i++)
+	{
+	  bif_enable e = rs6000_builtin_info_x[i].enable;
+	  if (e == ENB_P5 && !TARGET_POPCNTB)
+	    continue;
+	  if (e == ENB_P6 && !TARGET_CMPB)
+	    continue;
+	  if (e == ENB_ALTIVEC && !TARGET_ALTIVEC)
+	    continue;
+	  if (e == ENB_VSX && !TARGET_VSX)
+	    continue;
+	  if (e == ENB_P7 && !TARGET_POPCNTD)
+	    continue;
+	  if (e == ENB_P7_64 && (!TARGET_POPCNTD || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P8 && !TARGET_DIRECT_MOVE)
+	    continue;
+	  if (e == ENB_P8V && !TARGET_P8_VECTOR)
+	    continue;
+	  if (e == ENB_P9 && !TARGET_MODULO)
+	    continue;
+	  if (e == ENB_P9_64 && (!TARGET_MODULO || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P9V && !TARGET_P9_VECTOR)
+	    continue;
+	  if (e == ENB_IEEE128_HW && !TARGET_FLOAT128_HW)
+	    continue;
+	  if (e == ENB_DFP && !TARGET_DFP)
+	    continue;
+	  if (e == ENB_CRYPTO && !TARGET_CRYPTO)
+	    continue;
+	  if (e == ENB_HTM && !TARGET_HTM)
+	    continue;
+	  if (e == ENB_P10 && !TARGET_POWER10)
+	    continue;
+	  if (e == ENB_P10_64 && (!TARGET_POWER10 || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_MMA && !TARGET_MMA)
+	    continue;
+	  tree fntype = rs6000_builtin_info_x[i].fntype;
+	  tree t = TREE_TYPE (fntype);
+	  fprintf (stderr, "%s %s (", rs6000_debug_type (t),
+		   rs6000_builtin_info_x[i].bifname);
+	  t = TYPE_ARG_TYPES (fntype);
+	  while (t && TREE_VALUE (t) != void_type_node)
+	    {
+	      fprintf (stderr, "%s",
+		       rs6000_debug_type (TREE_VALUE (t)));
+	      t = TREE_CHAIN (t);
+	      if (t && TREE_VALUE (t) != void_type_node)
+		fprintf (stderr, ", ");
+	    }
+	  fprintf (stderr, "); %s [%4d]\n",
+		   rs6000_builtin_info_x[i].attr_string, (int) i);
+	}
+      fprintf (stderr, "\nEnd autogenerated built-in functions.\n\n\n");
+     }
+
   if (new_builtins_are_live)
     {
 #ifdef SUBTARGET_INIT_BUILTINS
@@ -16628,6 +16807,12 @@ altivec_init_builtins (void)
 			       ALTIVEC_BUILTIN_MASK_FOR_LOAD,
 			       BUILT_IN_MD, NULL, NULL_TREE);
   TREE_READONLY (decl) = 1;
+  if (TARGET_DEBUG_BUILTIN)
+    fprintf (stderr, "%s __builtin_altivec_mask_for_load (%s); [%4d]\n",
+	     rs6000_debug_type (TREE_TYPE (v16qi_ftype_pcvoid)),
+	     rs6000_debug_type (TREE_VALUE
+				(TYPE_ARG_TYPES (v16qi_ftype_pcvoid))),
+	     (int) ALTIVEC_BUILTIN_MASK_FOR_LOAD);
   /* Record the decl. Will be used by rs6000_builtin_mask_for_load.  */
   altivec_builtin_mask_for_load = decl;


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

* [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: Debug support
@ 2021-04-02 22:13 William Schmidt
  0 siblings, 0 replies; 7+ messages in thread
From: William Schmidt @ 2021-04-02 22:13 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d063d134c818d3c61258accdbc37469416015977

commit d063d134c818d3c61258accdbc37469416015977
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Thu Apr 1 14:40:08 2021 -0500

    rs6000: Debug support
    
    2021-04-01  Bill Schmidt  <wschmidt@linux.ibm.com>
    
    gcc/
            * config/rs6000/rs6000-call.c (rs6000_debug_type): New function.
            (def_builtin): Change debug formatting for easier parsing and
            include more information.
            (rs6000_init_builtins): Add dump of autogenerated builtins.
            (altivec_init_builtins): Dump __builtin_altivec_mask_for_load for
            completeness.

Diff:
---
 gcc/config/rs6000/rs6000-call.c | 193 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 189 insertions(+), 4 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index 406fb9ce2cb..288bc6b455a 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -8779,6 +8779,106 @@ rs6000_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
 
 /* Builtins.  */
 
+/* Debug utility to translate a type node to a single token.  */
+static
+const char *rs6000_debug_type (tree type)
+{
+  if (type == void_type_node)
+    return "void";
+  else if (type == long_integer_type_node)
+    return "long";
+  else if (type == long_unsigned_type_node)
+    return "ulong";
+  else if (type == long_long_integer_type_node)
+    return "longlong";
+  else if (type == long_long_unsigned_type_node)
+    return "ulonglong";
+  else if (type == bool_V16QI_type_node)
+    return "vbc";
+  else if (type == bool_V2DI_type_node)
+    return "vbll";
+  else if (type == bool_V4SI_type_node)
+    return "vbi";
+  else if (type == bool_V8HI_type_node)
+    return "vbs";
+  else if (type == bool_int_type_node)
+    return "bool";
+  else if (type == dfloat64_type_node)
+    return "_Decimal64";
+  else if (type == double_type_node)
+    return "double";
+  else if (type == intDI_type_node)
+    return "sll";
+  else if (type == intHI_type_node)
+    return "ss";
+  else if (type == ibm128_float_type_node)
+    return "__ibm128";
+  else if (type == opaque_V4SI_type_node)
+    return "opaque";
+  else if (POINTER_TYPE_P (type))
+    return "void*";
+  else if (type == intQI_type_node || type == char_type_node)
+    return "sc";
+  else if (type == dfloat32_type_node)
+    return "_Decimal32";
+  else if (type == float_type_node)
+    return "float";
+  else if (type == intSI_type_node || type == integer_type_node)
+    return "si";
+  else if (type == dfloat128_type_node)
+    return "_Decimal128";
+  else if (type == long_double_type_node)
+    return "longdouble";
+  else if (type == intTI_type_node)
+    return "sq";
+  else if (type == unsigned_intDI_type_node)
+    return "ull";
+  else if (type == unsigned_intHI_type_node)
+    return "us";
+  else if (type == unsigned_intQI_type_node)
+    return "uc";
+  else if (type == unsigned_intSI_type_node)
+    return "ui";
+  else if (type == unsigned_intTI_type_node)
+    return "uq";
+  else if (type == unsigned_V16QI_type_node)
+    return "vuc";
+  else if (type == unsigned_V1TI_type_node)
+    return "vuq";
+  else if (type == unsigned_V2DI_type_node)
+    return "vull";
+  else if (type == unsigned_V4SI_type_node)
+    return "vui";
+  else if (type == unsigned_V8HI_type_node)
+    return "vus";
+  else if (type == V16QI_type_node)
+    return "vsc";
+  else if (type == V1TI_type_node)
+    return "vsq";
+  else if (type == V2DF_type_node)
+    return "vd";
+  else if (type == V2DI_type_node)
+    return "vsll";
+  else if (type == V4SF_type_node)
+    return "vf";
+  else if (type == V4SI_type_node)
+    return "vsi";
+  else if (type == V8HI_type_node)
+    return "vss";
+  else if (type == pixel_V8HI_type_node)
+    return "vp";
+  else if (type == pcvoid_type_node)
+    return "voidc*";
+  else if (type == float128_type_node)
+    return "_Float128";
+  else if (type == vector_pair_type_node)
+    return "__vector_pair";
+  else if (type == vector_quad_type_node)
+    return "__vector_quad";
+  else
+    return "unknown";
+}
+
 static void
 def_builtin (const char *name, tree type, enum rs6000_builtins code)
 {
@@ -8807,7 +8907,7 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
       /* const function, function only depends on the inputs.  */
       TREE_READONLY (t) = 1;
       TREE_NOTHROW (t) = 1;
-      attr_string = ", const";
+      attr_string = "= const";
     }
   else if ((classify & RS6000_BTC_PURE) != 0)
     {
@@ -8815,7 +8915,7 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
 	 external state.  */
       DECL_PURE_P (t) = 1;
       TREE_NOTHROW (t) = 1;
-      attr_string = ", pure";
+      attr_string = "= pure";
     }
   else if ((classify & RS6000_BTC_FP) != 0)
     {
@@ -8829,12 +8929,12 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
 	{
 	  DECL_PURE_P (t) = 1;
 	  DECL_IS_NOVOPS (t) = 1;
-	  attr_string = ", fp, pure";
+	  attr_string = "= fp, pure";
 	}
       else
 	{
 	  TREE_READONLY (t) = 1;
-	  attr_string = ", fp, const";
+	  attr_string = "= fp, const";
 	}
     }
   else if ((classify & (RS6000_BTC_QUAD | RS6000_BTC_PAIR)) != 0)
@@ -8843,9 +8943,27 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
   else if ((classify & RS6000_BTC_ATTR_MASK) != 0)
     gcc_unreachable ();
 
+  if (TARGET_DEBUG_BUILTIN)
+    {
+      tree t = TREE_TYPE (type);
+      fprintf (stderr, "%s %s (", rs6000_debug_type (t), name);
+      t = TYPE_ARG_TYPES (type);
+      while (t && TREE_VALUE (t) != void_type_node)
+	{
+	  fprintf (stderr, "%s",
+		   rs6000_debug_type (TREE_VALUE (t)));
+	  t = TREE_CHAIN (t);
+	  if (t && TREE_VALUE (t) != void_type_node)
+	    fprintf (stderr, ", ");
+	}
+      fprintf (stderr, "); %s [%4d]\n", attr_string, (int)code);
+    }
+
+  /*
   if (TARGET_DEBUG_BUILTIN)
     fprintf (stderr, "rs6000_builtin, code = %4d, %s%s\n",
 	     (int)code, name, attr_string);
+  */
 }
 
 static const struct builtin_compatibility bdesc_compat[] =
@@ -15972,6 +16090,67 @@ rs6000_init_builtins (void)
     altivec_builtin_mask_for_load
       = rs6000_builtin_decls_x[RS6000_BIF_MASK_FOR_LOAD];
 
+  if (TARGET_DEBUG_BUILTIN)
+     {
+      fprintf (stderr, "\nAutogenerated built-in functions:\n\n");
+      for (int i = 1; i < (int) RS6000_BIF_MAX; i++)
+	{
+	  bif_enable e = rs6000_builtin_info_x[i].enable;
+	  if (e == ENB_P5 && !TARGET_POPCNTB)
+	    continue;
+	  if (e == ENB_P6 && !TARGET_CMPB)
+	    continue;
+	  if (e == ENB_ALTIVEC && !TARGET_ALTIVEC)
+	    continue;
+	  if (e == ENB_VSX && !TARGET_VSX)
+	    continue;
+	  if (e == ENB_P7 && !TARGET_POPCNTD)
+	    continue;
+	  if (e == ENB_P7_64 && (!TARGET_POPCNTD || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P8 && !TARGET_DIRECT_MOVE)
+	    continue;
+	  if (e == ENB_P8V && !TARGET_P8_VECTOR)
+	    continue;
+	  if (e == ENB_P9 && !TARGET_MODULO)
+	    continue;
+	  if (e == ENB_P9_64 && (!TARGET_MODULO || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P9V && !TARGET_P9_VECTOR)
+	    continue;
+	  if (e == ENB_IEEE128_HW && !TARGET_FLOAT128_HW)
+	    continue;
+	  if (e == ENB_DFP && !TARGET_DFP)
+	    continue;
+	  if (e == ENB_CRYPTO && !TARGET_CRYPTO)
+	    continue;
+	  if (e == ENB_HTM && !TARGET_HTM)
+	    continue;
+	  if (e == ENB_P10 && !TARGET_POWER10)
+	    continue;
+	  if (e == ENB_P10_64 && (!TARGET_POWER10 || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_MMA && !TARGET_MMA)
+	    continue;
+	  tree fntype = rs6000_builtin_info_x[i].fntype;
+	  tree t = TREE_TYPE (fntype);
+	  fprintf (stderr, "%s %s (", rs6000_debug_type (t),
+		   rs6000_builtin_info_x[i].bifname);
+	  t = TYPE_ARG_TYPES (fntype);
+	  while (t && TREE_VALUE (t) != void_type_node)
+	    {
+	      fprintf (stderr, "%s",
+		       rs6000_debug_type (TREE_VALUE (t)));
+	      t = TREE_CHAIN (t);
+	      if (t && TREE_VALUE (t) != void_type_node)
+		fprintf (stderr, ", ");
+	    }
+	  fprintf (stderr, "); %s [%4d]\n",
+		   rs6000_builtin_info_x[i].attr_string, (int) i);
+	}
+      fprintf (stderr, "\nEnd autogenerated built-in functions.\n\n\n");
+     }
+
   if (new_builtins_are_live)
     {
 #ifdef SUBTARGET_INIT_BUILTINS
@@ -16628,6 +16807,12 @@ altivec_init_builtins (void)
 			       ALTIVEC_BUILTIN_MASK_FOR_LOAD,
 			       BUILT_IN_MD, NULL, NULL_TREE);
   TREE_READONLY (decl) = 1;
+  if (TARGET_DEBUG_BUILTIN)
+    fprintf (stderr, "%s __builtin_altivec_mask_for_load (%s); [%4d]\n",
+	     rs6000_debug_type (TREE_TYPE (v16qi_ftype_pcvoid)),
+	     rs6000_debug_type (TREE_VALUE
+				(TYPE_ARG_TYPES (v16qi_ftype_pcvoid))),
+	     (int) ALTIVEC_BUILTIN_MASK_FOR_LOAD);
   /* Record the decl. Will be used by rs6000_builtin_mask_for_load.  */
   altivec_builtin_mask_for_load = decl;


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

* [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: Debug support
@ 2021-04-01 19:51 William Schmidt
  0 siblings, 0 replies; 7+ messages in thread
From: William Schmidt @ 2021-04-01 19:51 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:dbc34a26326448aa72cb062e4dc3217e840aa311

commit dbc34a26326448aa72cb062e4dc3217e840aa311
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Thu Apr 1 14:40:08 2021 -0500

    rs6000: Debug support
    
    2021-04-01  Bill Schmidt  <wschmidt@linux.ibm.com>
    
    gcc/
            * config/rs6000/rs6000-call.c (rs6000_debug_type): New function.
            (def_builtin): Change debug formatting for easier parsing and
            include more information.
            (rs6000_init_builtins): Add dump of autogenerated builtins.
            (altivec_init_builtins): Dump __builtin_altivec_mask_for_load for
            completeness.

Diff:
---
 gcc/config/rs6000/rs6000-call.c | 193 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 189 insertions(+), 4 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index 28477683272..c9834105d91 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -8779,6 +8779,106 @@ rs6000_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
 
 /* Builtins.  */
 
+/* Debug utility to translate a type node to a single token.  */
+static
+const char *rs6000_debug_type (tree type)
+{
+  if (type == void_type_node)
+    return "void";
+  else if (type == long_integer_type_node)
+    return "long";
+  else if (type == long_unsigned_type_node)
+    return "ulong";
+  else if (type == long_long_integer_type_node)
+    return "longlong";
+  else if (type == long_long_unsigned_type_node)
+    return "ulonglong";
+  else if (type == bool_V16QI_type_node)
+    return "vbc";
+  else if (type == bool_V2DI_type_node)
+    return "vbll";
+  else if (type == bool_V4SI_type_node)
+    return "vbi";
+  else if (type == bool_V8HI_type_node)
+    return "vbs";
+  else if (type == bool_int_type_node)
+    return "bool";
+  else if (type == dfloat64_type_node)
+    return "_Decimal64";
+  else if (type == double_type_node)
+    return "double";
+  else if (type == intDI_type_node)
+    return "sll";
+  else if (type == intHI_type_node)
+    return "ss";
+  else if (type == ibm128_float_type_node)
+    return "__ibm128";
+  else if (type == opaque_V4SI_type_node)
+    return "opaque";
+  else if (POINTER_TYPE_P (type))
+    return "void*";
+  else if (type == intQI_type_node || type == char_type_node)
+    return "sc";
+  else if (type == dfloat32_type_node)
+    return "_Decimal32";
+  else if (type == float_type_node)
+    return "float";
+  else if (type == intSI_type_node || type == integer_type_node)
+    return "si";
+  else if (type == dfloat128_type_node)
+    return "_Decimal128";
+  else if (type == long_double_type_node)
+    return "longdouble";
+  else if (type == intTI_type_node)
+    return "sq";
+  else if (type == unsigned_intDI_type_node)
+    return "ull";
+  else if (type == unsigned_intHI_type_node)
+    return "us";
+  else if (type == unsigned_intQI_type_node)
+    return "uc";
+  else if (type == unsigned_intSI_type_node)
+    return "ui";
+  else if (type == unsigned_intTI_type_node)
+    return "uq";
+  else if (type == unsigned_V16QI_type_node)
+    return "vuc";
+  else if (type == unsigned_V1TI_type_node)
+    return "vuq";
+  else if (type == unsigned_V2DI_type_node)
+    return "vull";
+  else if (type == unsigned_V4SI_type_node)
+    return "vui";
+  else if (type == unsigned_V8HI_type_node)
+    return "vus";
+  else if (type == V16QI_type_node)
+    return "vsc";
+  else if (type == V1TI_type_node)
+    return "vsq";
+  else if (type == V2DF_type_node)
+    return "vd";
+  else if (type == V2DI_type_node)
+    return "vsll";
+  else if (type == V4SF_type_node)
+    return "vf";
+  else if (type == V4SI_type_node)
+    return "vsi";
+  else if (type == V8HI_type_node)
+    return "vss";
+  else if (type == pixel_V8HI_type_node)
+    return "vp";
+  else if (type == pcvoid_type_node)
+    return "voidc*";
+  else if (type == float128_type_node)
+    return "_Float128";
+  else if (type == vector_pair_type_node)
+    return "__vector_pair";
+  else if (type == vector_quad_type_node)
+    return "__vector_quad";
+  else
+    return "unknown";
+}
+
 static void
 def_builtin (const char *name, tree type, enum rs6000_builtins code)
 {
@@ -8807,7 +8907,7 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
       /* const function, function only depends on the inputs.  */
       TREE_READONLY (t) = 1;
       TREE_NOTHROW (t) = 1;
-      attr_string = ", const";
+      attr_string = "= const";
     }
   else if ((classify & RS6000_BTC_PURE) != 0)
     {
@@ -8815,7 +8915,7 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
 	 external state.  */
       DECL_PURE_P (t) = 1;
       TREE_NOTHROW (t) = 1;
-      attr_string = ", pure";
+      attr_string = "= pure";
     }
   else if ((classify & RS6000_BTC_FP) != 0)
     {
@@ -8829,12 +8929,12 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
 	{
 	  DECL_PURE_P (t) = 1;
 	  DECL_IS_NOVOPS (t) = 1;
-	  attr_string = ", fp, pure";
+	  attr_string = "= fp, pure";
 	}
       else
 	{
 	  TREE_READONLY (t) = 1;
-	  attr_string = ", fp, const";
+	  attr_string = "= fp, const";
 	}
     }
   else if ((classify & (RS6000_BTC_QUAD | RS6000_BTC_PAIR)) != 0)
@@ -8843,9 +8943,27 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
   else if ((classify & RS6000_BTC_ATTR_MASK) != 0)
     gcc_unreachable ();
 
+  if (TARGET_DEBUG_BUILTIN)
+    {
+      tree t = TREE_TYPE (type);
+      fprintf (stderr, "%s %s (", rs6000_debug_type (t), name);
+      t = TYPE_ARG_TYPES (type);
+      while (t && TREE_VALUE (t) != void_type_node)
+	{
+	  fprintf (stderr, "%s",
+		   rs6000_debug_type (TREE_VALUE (t)));
+	  t = TREE_CHAIN (t);
+	  if (t && TREE_VALUE (t) != void_type_node)
+	    fprintf (stderr, ", ");
+	}
+      fprintf (stderr, "); %s [%4d]\n", attr_string, (int)code);
+    }
+
+  /*
   if (TARGET_DEBUG_BUILTIN)
     fprintf (stderr, "rs6000_builtin, code = %4d, %s%s\n",
 	     (int)code, name, attr_string);
+  */
 }
 
 static const struct builtin_compatibility bdesc_compat[] =
@@ -15972,6 +16090,67 @@ rs6000_init_builtins (void)
     altivec_builtin_mask_for_load
       = rs6000_builtin_decls_x[RS6000_BIF_MASK_FOR_LOAD];
 
+  if (TARGET_DEBUG_BUILTIN)
+     {
+      fprintf (stderr, "\nAutogenerated built-in functions:\n\n");
+      for (int i = 1; i < (int) RS6000_BIF_MAX; i++)
+	{
+	  bif_enable e = rs6000_builtin_info_x[i].enable;
+	  if (e == ENB_P5 && !TARGET_POPCNTB)
+	    continue;
+	  if (e == ENB_P6 && !TARGET_CMPB)
+	    continue;
+	  if (e == ENB_ALTIVEC && !TARGET_ALTIVEC)
+	    continue;
+	  if (e == ENB_VSX && !TARGET_VSX)
+	    continue;
+	  if (e == ENB_P7 && !TARGET_POPCNTD)
+	    continue;
+	  if (e == ENB_P7_64 && (!TARGET_POPCNTD || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P8 && !TARGET_DIRECT_MOVE)
+	    continue;
+	  if (e == ENB_P8V && !TARGET_P8_VECTOR)
+	    continue;
+	  if (e == ENB_P9 && !TARGET_MODULO)
+	    continue;
+	  if (e == ENB_P9_64 && (!TARGET_MODULO || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P9V && !TARGET_P9_VECTOR)
+	    continue;
+	  if (e == ENB_IEEE128_HW && !TARGET_FLOAT128_HW)
+	    continue;
+	  if (e == ENB_DFP && !TARGET_DFP)
+	    continue;
+	  if (e == ENB_CRYPTO && !TARGET_CRYPTO)
+	    continue;
+	  if (e == ENB_HTM && !TARGET_HTM)
+	    continue;
+	  if (e == ENB_P10 && !TARGET_POWER10)
+	    continue;
+	  if (e == ENB_P10_64 && (!TARGET_POWER10 || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_MMA && !TARGET_MMA)
+	    continue;
+	  tree fntype = rs6000_builtin_info_x[i].fntype;
+	  tree t = TREE_TYPE (fntype);
+	  fprintf (stderr, "%s %s (", rs6000_debug_type (t),
+		   rs6000_builtin_info_x[i].bifname);
+	  t = TYPE_ARG_TYPES (fntype);
+	  while (t && TREE_VALUE (t) != void_type_node)
+	    {
+	      fprintf (stderr, "%s",
+		       rs6000_debug_type (TREE_VALUE (t)));
+	      t = TREE_CHAIN (t);
+	      if (t && TREE_VALUE (t) != void_type_node)
+		fprintf (stderr, ", ");
+	    }
+	  fprintf (stderr, "); %s [%4d]\n",
+		   rs6000_builtin_info_x[i].attr_string, (int) i);
+	}
+      fprintf (stderr, "\nEnd autogenerated built-in functions.\n\n\n");
+     }
+
   if (new_builtins_are_live)
     {
 #ifdef SUBTARGET_INIT_BUILTINS
@@ -16628,6 +16807,12 @@ altivec_init_builtins (void)
 			       ALTIVEC_BUILTIN_MASK_FOR_LOAD,
 			       BUILT_IN_MD, NULL, NULL_TREE);
   TREE_READONLY (decl) = 1;
+  if (TARGET_DEBUG_BUILTIN)
+    fprintf (stderr, "%s __builtin_altivec_mask_for_load (%s); [%4d]\n",
+	     rs6000_debug_type (TREE_TYPE (v16qi_ftype_pcvoid)),
+	     rs6000_debug_type (TREE_VALUE
+				(TYPE_ARG_TYPES (v16qi_ftype_pcvoid))),
+	     (int) ALTIVEC_BUILTIN_MASK_FOR_LOAD);
   /* Record the decl. Will be used by rs6000_builtin_mask_for_load.  */
   altivec_builtin_mask_for_load = decl;


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

* [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: Debug support
@ 2021-03-25 15:48 William Schmidt
  0 siblings, 0 replies; 7+ messages in thread
From: William Schmidt @ 2021-03-25 15:48 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:72495f8900317099aa528ef485960df989da3cdf

commit 72495f8900317099aa528ef485960df989da3cdf
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Fri Mar 5 16:24:33 2021 -0600

    rs6000: Debug support
    
    2021-03-05  Bill Schmidt  <wschmidt@linux.ibm.com>
    
    gcc/
            * config/rs6000/rs6000-call.c (rs6000_debug_type): New function.
            (def_builtin): Change debug formatting for easier parsing and
            include more information.
            (rs6000_init_builtins): Add dump of autogenerated builtins.
            (altivec_init_builtins): Dump __builtin_altivec_mask_for_load for
            completeness.

Diff:
---
 gcc/config/rs6000/rs6000-call.c | 189 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 185 insertions(+), 4 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index 28477683272..82f49f8b320 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -8779,6 +8779,102 @@ rs6000_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
 
 /* Builtins.  */
 
+/* Debug utility to translate a type node to a single token.  */
+static
+const char *rs6000_debug_type (tree type)
+{
+  if (type == void_type_node)
+    return "void";
+  else if (type == long_integer_type_node)
+    return "long";
+  else if (type == long_unsigned_type_node)
+    return "ulong";
+  else if (type == bool_V16QI_type_node)
+    return "vbc";
+  else if (type == bool_V2DI_type_node)
+    return "vbll";
+  else if (type == bool_V4SI_type_node)
+    return "vbi";
+  else if (type == bool_V8HI_type_node)
+    return "vbs";
+  else if (type == bool_int_type_node)
+    return "bool";
+  else if (type == dfloat64_type_node)
+    return "_Decimal64";
+  else if (type == double_type_node)
+    return "double";
+  else if (type == intDI_type_node)
+    return "sll";
+  else if (type == intHI_type_node)
+    return "ss";
+  else if (type == ibm128_float_type_node)
+    return "__ibm128";
+  else if (type == opaque_V4SI_type_node)
+    return "opaque";
+  else if (POINTER_TYPE_P (type))
+    return "void*";
+  else if (type == intQI_type_node || type == char_type_node)
+    return "sc";
+  else if (type == dfloat32_type_node)
+    return "_Decimal32";
+  else if (type == float_type_node)
+    return "float";
+  else if (type == intSI_type_node || type == integer_type_node)
+    return "si";
+  else if (type == dfloat128_type_node)
+    return "_Decimal128";
+  else if (type == long_double_type_node)
+    return "longdouble";
+  else if (type == intTI_type_node)
+    return "sq";
+  else if (type == unsigned_intDI_type_node)
+    return "ull";
+  else if (type == unsigned_intHI_type_node)
+    return "us";
+  else if (type == unsigned_intQI_type_node)
+    return "uc";
+  else if (type == unsigned_intSI_type_node)
+    return "ui";
+  else if (type == unsigned_intTI_type_node)
+    return "uq";
+  else if (type == unsigned_V16QI_type_node)
+    return "vuc";
+  else if (type == unsigned_V1TI_type_node)
+    return "vuq";
+  else if (type == unsigned_V2DI_type_node)
+    return "vull";
+  else if (type == unsigned_V4SI_type_node)
+    return "vui";
+  else if (type == unsigned_V8HI_type_node)
+    return "vus";
+  else if (type == V16QI_type_node)
+    return "vsc";
+  else if (type == V1TI_type_node)
+    return "vsq";
+  else if (type == V2DF_type_node)
+    return "vd";
+  else if (type == V2DI_type_node)
+    return "vsll";
+  else if (type == V4SF_type_node)
+    return "vf";
+  else if (type == V4SI_type_node)
+    return "vsi";
+  else if (type == V8HI_type_node)
+    return "vss";
+  else if (type == pixel_V8HI_type_node)
+    return "vp";
+  else if (type == pcvoid_type_node)
+    return "voidc*";
+  else if (type == float128_type_node)
+    return "_Float128";
+  else if (type == vector_pair_type_node)
+    return "__vector_pair";
+  else if (type == vector_quad_type_node)
+    return "__vector_quad";
+  else
+    return "unknown";
+}
+
 static void
 def_builtin (const char *name, tree type, enum rs6000_builtins code)
 {
@@ -8807,7 +8903,7 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
       /* const function, function only depends on the inputs.  */
       TREE_READONLY (t) = 1;
       TREE_NOTHROW (t) = 1;
-      attr_string = ", const";
+      attr_string = "= const";
     }
   else if ((classify & RS6000_BTC_PURE) != 0)
     {
@@ -8815,7 +8911,7 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
 	 external state.  */
       DECL_PURE_P (t) = 1;
       TREE_NOTHROW (t) = 1;
-      attr_string = ", pure";
+      attr_string = "= pure";
     }
   else if ((classify & RS6000_BTC_FP) != 0)
     {
@@ -8829,12 +8925,12 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
 	{
 	  DECL_PURE_P (t) = 1;
 	  DECL_IS_NOVOPS (t) = 1;
-	  attr_string = ", fp, pure";
+	  attr_string = "= fp, pure";
 	}
       else
 	{
 	  TREE_READONLY (t) = 1;
-	  attr_string = ", fp, const";
+	  attr_string = "= fp, const";
 	}
     }
   else if ((classify & (RS6000_BTC_QUAD | RS6000_BTC_PAIR)) != 0)
@@ -8843,9 +8939,27 @@ def_builtin (const char *name, tree type, enum rs6000_builtins code)
   else if ((classify & RS6000_BTC_ATTR_MASK) != 0)
     gcc_unreachable ();
 
+  if (TARGET_DEBUG_BUILTIN)
+    {
+      tree t = TREE_TYPE (type);
+      fprintf (stderr, "%s %s (", rs6000_debug_type (t), name);
+      t = TYPE_ARG_TYPES (type);
+      while (t && TREE_VALUE (t) != void_type_node)
+	{
+	  fprintf (stderr, "%s",
+		   rs6000_debug_type (TREE_VALUE (t)));
+	  t = TREE_CHAIN (t);
+	  if (t && TREE_VALUE (t) != void_type_node)
+	    fprintf (stderr, ", ");
+	}
+      fprintf (stderr, "); %s [%4d]\n", attr_string, (int)code);
+    }
+
+  /*
   if (TARGET_DEBUG_BUILTIN)
     fprintf (stderr, "rs6000_builtin, code = %4d, %s%s\n",
 	     (int)code, name, attr_string);
+  */
 }
 
 static const struct builtin_compatibility bdesc_compat[] =
@@ -15972,6 +16086,67 @@ rs6000_init_builtins (void)
     altivec_builtin_mask_for_load
       = rs6000_builtin_decls_x[RS6000_BIF_MASK_FOR_LOAD];
 
+  if (TARGET_DEBUG_BUILTIN)
+     {
+      fprintf (stderr, "\nAutogenerated built-in functions:\n\n");
+      for (int i = 1; i < (int) RS6000_BIF_MAX; i++)
+	{
+	  bif_enable e = rs6000_builtin_info_x[i].enable;
+	  if (e == ENB_P5 && !TARGET_POPCNTB)
+	    continue;
+	  if (e == ENB_P6 && !TARGET_CMPB)
+	    continue;
+	  if (e == ENB_ALTIVEC && !TARGET_ALTIVEC)
+	    continue;
+	  if (e == ENB_VSX && !TARGET_VSX)
+	    continue;
+	  if (e == ENB_P7 && !TARGET_POPCNTD)
+	    continue;
+	  if (e == ENB_P7_64 && (!TARGET_POPCNTD || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P8 && !TARGET_DIRECT_MOVE)
+	    continue;
+	  if (e == ENB_P8V && !TARGET_P8_VECTOR)
+	    continue;
+	  if (e == ENB_P9 && !TARGET_MODULO)
+	    continue;
+	  if (e == ENB_P9_64 && (!TARGET_MODULO || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_P9V && !TARGET_P9_VECTOR)
+	    continue;
+	  if (e == ENB_IEEE128_HW && !TARGET_FLOAT128_HW)
+	    continue;
+	  if (e == ENB_DFP && !TARGET_DFP)
+	    continue;
+	  if (e == ENB_CRYPTO && !TARGET_CRYPTO)
+	    continue;
+	  if (e == ENB_HTM && !TARGET_HTM)
+	    continue;
+	  if (e == ENB_P10 && !TARGET_POWER10)
+	    continue;
+	  if (e == ENB_P10_64 && (!TARGET_POWER10 || !TARGET_POWERPC64))
+	    continue;
+	  if (e == ENB_MMA && !TARGET_MMA)
+	    continue;
+	  tree fntype = rs6000_builtin_info_x[i].fntype;
+	  tree t = TREE_TYPE (fntype);
+	  fprintf (stderr, "%s %s (", rs6000_debug_type (t),
+		   rs6000_builtin_info_x[i].bifname);
+	  t = TYPE_ARG_TYPES (fntype);
+	  while (t && TREE_VALUE (t) != void_type_node)
+	    {
+	      fprintf (stderr, "%s",
+		       rs6000_debug_type (TREE_VALUE (t)));
+	      t = TREE_CHAIN (t);
+	      if (t && TREE_VALUE (t) != void_type_node)
+		fprintf (stderr, ", ");
+	    }
+	  fprintf (stderr, "); %s [%4d]\n",
+		   rs6000_builtin_info_x[i].attr_string, (int) i);
+	}
+      fprintf (stderr, "\nEnd autogenerated built-in functions.\n\n\n");
+     }
+
   if (new_builtins_are_live)
     {
 #ifdef SUBTARGET_INIT_BUILTINS
@@ -16628,6 +16803,12 @@ altivec_init_builtins (void)
 			       ALTIVEC_BUILTIN_MASK_FOR_LOAD,
 			       BUILT_IN_MD, NULL, NULL_TREE);
   TREE_READONLY (decl) = 1;
+  if (TARGET_DEBUG_BUILTIN)
+    fprintf (stderr, "%s __builtin_altivec_mask_for_load (%s); [%4d]\n",
+	     rs6000_debug_type (TREE_TYPE (v16qi_ftype_pcvoid)),
+	     rs6000_debug_type (TREE_VALUE
+				(TYPE_ARG_TYPES (v16qi_ftype_pcvoid))),
+	     (int) ALTIVEC_BUILTIN_MASK_FOR_LOAD);
   /* Record the decl. Will be used by rs6000_builtin_mask_for_load.  */
   altivec_builtin_mask_for_load = decl;


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

end of thread, other threads:[~2021-07-29 14:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-15 17:20 [gcc(refs/users/wschmidt/heads/builtins10)] rs6000: Debug support William Schmidt
  -- strict thread matches above, loose matches on Subject: below --
2021-07-29 14:47 William Schmidt
2021-06-25 16:19 William Schmidt
2021-04-26 20:52 William Schmidt
2021-04-02 22:13 William Schmidt
2021-04-01 19:51 William Schmidt
2021-03-25 15:48 William Schmidt

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).