From patchwork Wed Jul 17 15:52:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Carl Love X-Patchwork-Id: 1961671 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=oH+7eKAM; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WPL6t3nPzz1xqc for ; Thu, 18 Jul 2024 01:52:34 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 60099385DDE9 for ; Wed, 17 Jul 2024 15:52:32 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id CCD123858430 for ; Wed, 17 Jul 2024 15:52:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CCD123858430 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CCD123858430 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721231531; cv=none; b=uII2GbiJfcVSunYntY3KdyyF0nH+SHRqcOLOczlAlx5v+F2qtTmGjs5Lc0ywfDV/OEPErCSCNkoh9a+iGwxzjg4QmYN9YSmaOKaJpwDCy/BpFzyo0yZI8+nBzhE8LiTDR3eyZoBLJvXBWH5Yc4ktrOcdc1iK4Wbk852ZZ5LkLi0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721231531; c=relaxed/simple; bh=fBPNC90KtlzblwFOMXywxIP6Uqc07hg9Oi210BAgNqQ=; h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject; b=ahwp5XsIWrJWA8KblUVBEgNgjbrLVjYIB/jG3htE5NIB0ObYqgDPkHTd0Vz+mN7/+hO1EyKiBL4FN7beprDw2uvNVdcBntVCsnO0VdWtkGzeQzZIAdEBNxg7AjI4L3MB3ljHPNnhHJJcWSxhtLb1w2FRG+wNQdXOE+3nL7dLDkA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46HEp4c1010776; Wed, 17 Jul 2024 15:52:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h= message-id:date:mime-version:to:from:subject:content-type :content-transfer-encoding; s=pp1; bh=1qafvdGYnGYYKsl3HTg7fdad0G TvVyzhnptW9S/9gn8=; b=oH+7eKAMrl/KA8zp+WvjkQUSAkjSaerWs9GjKovzYx RMr/4jwHzlxBgeiPFYC5bnpykamHQaNnxh21jCyO/TbIySxufai08JiuWt1PxJDd BSTzc63ViBgT0Y3jbq3r2W5nfUo3qZHMp8sorWwA03LFBQ8HZV2LWt3TsAMsYKRF 9cpHWhY5qlReHYWF3wLmiD9fU4g3eDe5vNNYDv1b2/d7btwSZouKOFeSTmraAmyz N899QoqJTfqZQwTwm7UFTxsbjtgeBWnP/+3veUNsbgKRZWa6QsrBoSpGrXa3fCuV v7QCNwqqDNDM5Z7YS4UbtntfLF7UumdVKTJAfF3iJr/A== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 40e4ru9qac-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Jul 2024 15:52:08 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 46HDxlQJ028853; Wed, 17 Jul 2024 15:52:07 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([172.16.1.74]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 40dwkmvy87-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Jul 2024 15:52:07 +0000 Received: from smtpav05.wdc07v.mail.ibm.com (smtpav05.wdc07v.mail.ibm.com [10.39.53.232]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 46HFq48455640380 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Jul 2024 15:52:06 GMT Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 65AC558053; Wed, 17 Jul 2024 15:52:04 +0000 (GMT) Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7B6F658059; Wed, 17 Jul 2024 15:52:03 +0000 (GMT) Received: from [9.67.33.210] (unknown [9.67.33.210]) by smtpav05.wdc07v.mail.ibm.com (Postfix) with ESMTP; Wed, 17 Jul 2024 15:52:03 +0000 (GMT) Message-ID: <00b637b5-eb0e-4f22-b655-7b4dd49fb0f6@linux.ibm.com> Date: Wed, 17 Jul 2024 08:52:02 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: gcc-patches@gcc.gnu.org, Kewen , Peter Bergner , segher , cel From: Carl Love Subject: [PATCH] rs6000, remove __builtin_vsx_xvcmp* built-ins X-TM-AS-GCONF: 00 X-Proofpoint-GUID: lZZpmngtf8NI9s5yw3k-UEP5zt6MbIJx X-Proofpoint-ORIG-GUID: lZZpmngtf8NI9s5yw3k-UEP5zt6MbIJx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-17_11,2024-07-17_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 mlxscore=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 adultscore=0 priorityscore=1501 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2407110000 definitions=main-2407170118 X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, KAM_SHORT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org GCC maintainers: The following patch removes the three __builtin_vsx_xvcmp[eq|ge|gt]sp  builtins as they similar to the overloaded vec_cmp[eq|ge|gt] built-ins.  The difference is the overloaded built-ins return a vector of boolean or a vector of long long booleans where as the removed built-ins returned a vector of floats or vector of doubles. The tests for __builtin_vsx_xvcmp[eq|ge|gt]sp and __builtin_vsx_xvcmp[eq|ge|gt]dp are updated to use the overloaded vec_cmp[eq|ge|gt] built-in with the required changes for the return type.  Note __builtin_vsx_xvcmp[eq|ge|gt]dp are used internally. The patches have been tested on a Power 10 LE system with no regressions. Please let me know if the patch is acceptable for mainline.  Thanks.                                                            Carl --------------------------------------------------------------------------------- rs6000, remove __builtin_vsx_xvcmp* built-ins This patch removes the built-ins:  __builtin_vsx_xvcmpeqsp, __builtin_vsx_xvcmpgesp,  __builtin_vsx_xvcmpgtsp. which are similar to the overloaded vec_cmpeq, vec_cmpgt and vec_cmpge built-ins. The difference is that the overloaded built-ins return a vector of booleans or a vector of long long boolean depending if the inputs were a vector of floats or a vector of doubles.  The removed built-ins returned a vector of floats or vector of double for the vector float and vector double inputs respectively. The __builtin_vsx_xvcmpeqdp, __builtin_vsx_xvcmpgedp and __builtin_vsx_xvcmpgtdp are not removed as they are used by the overloaded vec_cmpeq, vec_cmpgt and vec_cmpge built-ins. The test cases for the __builtin_vsx_xvcmpeqsp, __builtin_vsx_xvcmpgesp, __builtin_vsx_xvcmpgtsp, __builtin_vsx_xvcmpeqdp, __builtin_vsx_xvcmpgedp and __builtin_vsx_xvcmpgtdp  are changed to use the overloaded vec_cmpeq, vec_cmpgt, vec_cmpge built-ins.  Use of the overloaded built-ins requires the result to be stored in a vector of boolean of the appropriate size or the result must be cast to the return type used by the original __builtin_vsx_xvcmp* built-ins. ---  gcc/config/rs6000/rs6000-builtins.def         | 10 -------  .../gcc.target/powerpc/vsx-builtin-3.c        | 28 ++++++++++++++-----  2 files changed, 21 insertions(+), 17 deletions(-) +  bi[i][0] = vec_cmpgt (f[i][1], f[i][2]); i++; +  bi[i][0] = vec_cmpge (f[i][1], f[i][2]); i++;    return i;  } diff --git a/gcc/config/rs6000/rs6000-builtins.def b/gcc/config/rs6000/rs6000-builtins.def index 77eb0f7e406..896d9686ac6 100644 --- a/gcc/config/rs6000/rs6000-builtins.def +++ b/gcc/config/rs6000/rs6000-builtins.def @@ -1579,30 +1579,20 @@    const signed int __builtin_vsx_xvcmpeqdp_p (signed int, vd, vd);      XVCMPEQDP_P vector_eq_v2df_p {pred} -  const vf __builtin_vsx_xvcmpeqsp (vf, vf); -    XVCMPEQSP vector_eqv4sf {} -    const vd __builtin_vsx_xvcmpgedp (vd, vd);      XVCMPGEDP vector_gev2df {}    const signed int __builtin_vsx_xvcmpgedp_p (signed int, vd, vd);      XVCMPGEDP_P vector_ge_v2df_p {pred} -  const vf __builtin_vsx_xvcmpgesp (vf, vf); -    XVCMPGESP vector_gev4sf {} -    const signed int __builtin_vsx_xvcmpgesp_p (signed int, vf, vf);      XVCMPGESP_P vector_ge_v4sf_p {pred}    const vd __builtin_vsx_xvcmpgtdp (vd, vd);      XVCMPGTDP vector_gtv2df {} -    const signed int __builtin_vsx_xvcmpgtdp_p (signed int, vd, vd);      XVCMPGTDP_P vector_gt_v2df_p {pred} -  const vf __builtin_vsx_xvcmpgtsp (vf, vf); -    XVCMPGTSP vector_gtv4sf {} -    const signed int __builtin_vsx_xvcmpgtsp_p (signed int, vf, vf);      XVCMPGTSP_P vector_gt_v4sf_p {pred} diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c index 60f91aad23c..d67f97c8011 100644 --- a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c @@ -156,13 +156,27 @@ int do_cmp (void)  {    int i = 0; -  d[i][0] = __builtin_vsx_xvcmpeqdp (d[i][1], d[i][2]); i++; -  d[i][0] = __builtin_vsx_xvcmpgtdp (d[i][1], d[i][2]); i++; -  d[i][0] = __builtin_vsx_xvcmpgedp (d[i][1], d[i][2]); i++; - -  f[i][0] = __builtin_vsx_xvcmpeqsp (f[i][1], f[i][2]); i++; -  f[i][0] = __builtin_vsx_xvcmpgtsp (f[i][1], f[i][2]); i++; -  f[i][0] = __builtin_vsx_xvcmpgesp (f[i][1], f[i][2]); i++; +  /* The __builtin_vsx_xvcmp[gt|ge|eq]dp and __builtin_vsx_xvcmp[gt|ge|eq]sp +     have been removed in favor of the overloaded vec_cmpeq, vec_cmpgt and +     vec_cmpge built-ins.  The __builtin_vsx_xvcmp* builtins returned a vector +     result of the same type as the arguments.  The vec_cmp* built-ins return +     a vector of boolenas of the same size as the arguments. Thus the result +     assignment must be to a boolean or cast to a boolean.  Test both cases. +  */ + +  d[i][0] = (vector double) vec_cmpeq (d[i][1], d[i][2]); i++; +  d[i][0] = (vector double) vec_cmpgt (d[i][1], d[i][2]); i++; +  d[i][0] = (vector double) vec_cmpge (d[i][1], d[i][2]); i++; +  bl[i][0] = vec_cmpeq (d[i][1], d[i][2]); i++; +  bl[i][0] = vec_cmpgt (d[i][1], d[i][2]); i++; +  bl[i][0] = vec_cmpge (d[i][1], d[i][2]); i++; + +  f[i][0] = (vector float) vec_cmpeq (f[i][1], f[i][2]); i++; +  f[i][0] = (vector float) vec_cmpgt (f[i][1], f[i][2]); i++; +  f[i][0] = (vector float) vec_cmpge (f[i][1], f[i][2]); i++; +  bi[i][0] = vec_cmpeq (f[i][1], f[i][2]); i++;