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 4B67C3858D28 for ; Mon, 17 Jul 2023 19:20:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4B67C3858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=us.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=us.ibm.com Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36HJHEc7026218; Mon, 17 Jul 2023 19:20:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : mime-version : content-transfer-encoding; s=pp1; bh=nJYxPNeg+F4ZMvBI5XamPNDdzRA6YO0QLrt5Hcv+3UA=; b=R5+xRT5/jlLe3vXvYF9+zzS/NIhutekI9AfoIO9hPb6K7cD6IuxG06JIWiBysWjakIkf SZb30a9FfeRWjYBLjsaAavsB9hbvvJWkNvf+dbBcYiEet4TN7zZkf9E5pj+7jzdL2TLw luq0ZDBTGY3aKQEXrVqNk7MsQuInEZXlJgTV6hksDPBXk3hIWn2j4QvGPDuNrAzxD4w9 tOwvi4Nr8xB2w5WSWM+UBKKgrboWRLfarhBP4oM0wVVmXK3g/orDwhAJwpghl6PkC+Qr TLkPh4lGBsPKggEewVKeMBXUeY1YdovcWp+61D3bJE3jRi4ysS7FAAWWX0qHVYGfX6eU rA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rwbnvg281-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jul 2023 19:20:01 +0000 Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 36HJHn3i027441; Mon, 17 Jul 2023 19:20:01 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rwbnvg27c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jul 2023 19:20:01 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 36HDvV3g030043; Mon, 17 Jul 2023 19:20:00 GMT Received: from smtprelay07.dal12v.mail.ibm.com ([172.16.1.9]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3rv79jgt9e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jul 2023 19:20:00 +0000 Received: from smtpav04.wdc07v.mail.ibm.com (smtpav04.wdc07v.mail.ibm.com [10.39.53.231]) by smtprelay07.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 36HJJw9u32834274 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jul 2023 19:19:59 GMT Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AC39058050; Mon, 17 Jul 2023 19:19:58 +0000 (GMT) Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E055358052; Mon, 17 Jul 2023 19:19:57 +0000 (GMT) Received: from li-e362e14c-2378-11b2-a85c-87d605f3c641.ibm.com (unknown [9.61.185.149]) by smtpav04.wdc07v.mail.ibm.com (Postfix) with ESMTP; Mon, 17 Jul 2023 19:19:57 +0000 (GMT) Message-ID: <949827540816a434c5bac00f0714948638c37975.camel@us.ibm.com> Subject: [PATCH 1/2] rs6000, add argument to function find_instance From: Carl Love To: "Kewen.Lin" , Segher Boessenkool , David Edelsohn , gcc-patches@gcc.gnu.org Cc: Peter Bergner , cel@us.ibm.com Date: Mon, 17 Jul 2023 12:19:57 -0700 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 (3.28.5-18.el8) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ykYqSUij21vv5QfNVJD_SdA1KbL9ZiFm X-Proofpoint-ORIG-GUID: wSZIMoFgHOjzphaECeSmHCDhDsoSS7sV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-17_13,2023-07-13_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 adultscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 suspectscore=0 priorityscore=1501 mlxlogscore=999 phishscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307170174 X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: GCC maintainers: The rs6000 function find_instance assumes that it is called for built- ins with only two arguments. There is no checking for the actual number of aruguments used in the built-in. This patch adds an additional parameter to the function call containing the number of aruguments in the built-in. The function will now do the needed checks for all of the arguments. This fix is needed for the next patch in the series that fixes the vec_replace_unaligned built-in.c test. Please let me know if this patch is acceptable for mainline. Thanks. Carl -------------------------------------------- rs6000, add argument to function find_instance The function find_instance assumes it is called to check a built-in with only two arguments. Ths patch extends the function by adding a parameter specifying the number of buit-in arguments to check. gcc/ChangeLog: * config/rs6000/rs6000-c.cc (find_instance): Add new parameter that specifies the number of built-in arguments to check. (altivec_resolve_overloaded_builtin): Update calls to find_instance to pass the number of built-in argument to be checked. --- gcc/config/rs6000/rs6000-c.cc | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/gcc/config/rs6000/rs6000-c.cc b/gcc/config/rs6000/rs6000-c.cc index a353bca19ef..350987b851b 100644 --- a/gcc/config/rs6000/rs6000-c.cc +++ b/gcc/config/rs6000/rs6000-c.cc @@ -1679,7 +1679,7 @@ tree find_instance (bool *unsupported_builtin, ovlddata **instance, rs6000_gen_builtins instance_code, rs6000_gen_builtins fcode, - tree *types, tree *args) + tree *types, tree *args, int nargs) { while (*instance && (*instance)->bifid != instance_code) *instance = (*instance)->next; @@ -1691,17 +1691,28 @@ find_instance (bool *unsupported_builtin, ovlddata **instance, if (!inst->fntype) return error_mark_node; tree fntype = rs6000_builtin_info[inst->bifid].fntype; - tree parmtype0 = TREE_VALUE (TYPE_ARG_TYPES (fntype)); - tree parmtype1 = TREE_VALUE (TREE_CHAIN (TYPE_ARG_TYPES (fntype))); + tree argtype = TYPE_ARG_TYPES (fntype); + tree parmtype; + int args_compatible = true; - if (rs6000_builtin_type_compatible (types[0], parmtype0) - && rs6000_builtin_type_compatible (types[1], parmtype1)) + for (int i = 0; i bifid, false) != error_mark_node && rs6000_builtin_is_supported (inst->bifid)) { tree ret_type = TREE_TYPE (inst->fntype); - return altivec_build_resolved_builtin (args, 2, fntype, ret_type, + return altivec_build_resolved_builtin (args, nargs, fntype, ret_type, inst->bifid, fcode); } else @@ -1921,7 +1932,7 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, instance_code = RS6000_BIF_CMPB_32; tree call = find_instance (&unsupported_builtin, &instance, - instance_code, fcode, types, args); + instance_code, fcode, types, args, nargs); if (call != error_mark_node) return call; break; @@ -1958,7 +1969,7 @@ altivec_resolve_overloaded_builtin (location_t loc, tree fndecl, } tree call = find_instance (&unsupported_builtin, &instance, - instance_code, fcode, types, args); + instance_code, fcode, types, args, nargs); if (call != error_mark_node) return call; break; -- 2.37.2