From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 760D93983C44 for ; Tue, 27 Jul 2021 21:07:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 760D93983C44 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16RL3krd022930; Tue, 27 Jul 2021 17:07:28 -0400 Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0a-001b2d01.pphosted.com with ESMTP id 3a2sepgm9n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jul 2021 17:07:28 -0400 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 16RL2PFU027011; Tue, 27 Jul 2021 21:07:27 GMT Received: from b03cxnp07027.gho.boulder.ibm.com (b03cxnp07027.gho.boulder.ibm.com [9.17.130.14]) by ppma04dal.us.ibm.com with ESMTP id 3a235ndeuc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jul 2021 21:07:27 +0000 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp07027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 16RL7PJo33882442 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Jul 2021 21:07:25 GMT Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 80E6D6E06D; Tue, 27 Jul 2021 21:07:25 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 41D336E056; Tue, 27 Jul 2021 21:07:24 +0000 (GMT) Received: from lexx (unknown [9.171.17.235]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 27 Jul 2021 21:07:23 +0000 (GMT) Message-ID: Subject: Re: [PATCH 52/55] rs6000: Debug support From: will schmidt To: Bill Schmidt , gcc-patches@gcc.gnu.org Cc: segher@kernel.crashing.org Date: Tue, 27 Jul 2021 16:07:22 -0500 In-Reply-To: <45258f83249345b1faf49554a6f4a7940983f822.1623941442.git.wschmidt@linux.ibm.com> References: <45258f83249345b1faf49554a6f4a7940983f822.1623941442.git.wschmidt@linux.ibm.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-10.el7) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 4fbMo1sj_L2JpBpe14W_uUJCS06vzrtP X-Proofpoint-GUID: 4fbMo1sj_L2JpBpe14W_uUJCS06vzrtP X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-07-27_14:2021-07-27, 2021-07-27 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 adultscore=0 mlxlogscore=999 mlxscore=0 priorityscore=1501 spamscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2107270119 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 21:07:31 -0000 On Thu, 2021-06-17 at 10:19 -0500, Bill Schmidt via Gcc-patches wrote: > 2021-04-01 Bill Schmidt > > 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. > --- > 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"; I'd be strongly tempted to rearrange the order and put V16 after V8 in the list. Similar to the order you previously used in rs6000_expand_new_builtin(). Same comment elsewhere. > + 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"; > +} > + Ok > 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"; > } > } Ok > 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); > + */ Could probably just drop that chunk, instead of commenting it out. > } > > 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"); > + } > + ok > 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; > lgtm, Thanks -Will