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 A2F003858C48 for ; Fri, 24 May 2024 15:19:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A2F003858C48 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 A2F003858C48 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716563990; cv=none; b=ublOSAtnP7QhmC0oxfcnp2ldrjqX2Fuy/z6UyPq7B+ZZ934LzuDF/zxAQjaLvNWqgTfhJjwY/QgTIUaRrb+oiDW58KzJqqYP1NZePcdzFtSWPb/l1MS0b4rIuai6V+BSVBnru0PlnsMEjOcfKwizqQlpGbfdEi3z1xdciaZ0KsY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716563990; c=relaxed/simple; bh=9zEXyp+DeXZAQYlgLj2fTS5vbPYDiHMFq6ZrusAZqbg=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=Ntcs6/JaCJSCxgNEh4L95bLuTMLgjM2mO/b+rpRfUqFpesVUSm7zB9lJ2IyIs9ZTpu2z/xlsDKpFtASHBkVmdZZjrrTsPQhHZ7HB98vXadRfYzWoVoEtupTpzhSz40vP88ekIHpR0PtsZpT7tq8IZNDVZdDXaKi9mgCiqTWm9oU= ARC-Authentication-Results: i=1; server2.sourceware.org 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 44OFHRM2001466; Fri, 24 May 2024 15:19:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=pbnmNdU+W6xbZj9ehTVJ0PdH27beeT3EjSgDEWbqCIM=; b=sHg27Vwv/Hlf+GUATB+wqofftBYDNtHRhPigZ/lOa5X+dBOHCbswQZT6sw69dhSjJfYS 71i1dCiWXthy+Y4tCsL2TU49sZAqE54CIWqFK/RKuBdWdsxw8qbumCx2sPX/EaA2gEJz 9qR113JSw2q6Gnajjx5gQs2iFp03DTELoz+Cb1DNLdYXiy2HX/qPjc6NfawYzngZGKXL RCXXTpf0kPBrJkmKmzEYVpCfNw0wUC7+iGTkXQL+GlIleqpWBBRp6xwianaY8vHbontm CINAa73KwdUyMlihJRm0b4VEM4G3SV3FO/OVx6r1O5u4AFk3aV4d54C7tRvSj3OPHTQY hw== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yawd6r0be-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 May 2024 15:19:47 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 44OEUfAY007412; Fri, 24 May 2024 15:19:46 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3y79c3gx3p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 May 2024 15:19:46 +0000 Received: from smtpav02.dal12v.mail.ibm.com (smtpav02.dal12v.mail.ibm.com [10.241.53.101]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 44OFJhZE47317454 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 May 2024 15:19:45 GMT Received: from smtpav02.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 74B4958065; Fri, 24 May 2024 15:19:43 +0000 (GMT) Received: from smtpav02.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C46395805C; Fri, 24 May 2024 15:19:42 +0000 (GMT) Received: from [9.67.70.111] (unknown [9.67.70.111]) by smtpav02.dal12v.mail.ibm.com (Postfix) with ESMTP; Fri, 24 May 2024 15:19:42 +0000 (GMT) Message-ID: <088c27dd-ea4a-49ca-979d-596efe78daf8@linux.ibm.com> Date: Fri, 24 May 2024 08:19:42 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 12/13] rs6000, remove __builtin_vsx_xvcmpeqsp built-in To: gcc-patches@gcc.gnu.org, Carl Love , "Kewen.Lin" , Segher Boessenkool , "bergner@linux.ibm.com" References: <6378d560-df55-4b75-be7b-93dc6b85d81a@linux.ibm.com> <7bbff7c6-706f-42ae-af37-b08a4f927c50@linux.ibm.com> <56c7ea70-7dff-def3-2fb8-a84ac8936f61@linux.ibm.com> <580ef386-5aaf-4328-b76f-08c4f310dcb6@linux.ibm.com> Content-Language: en-US From: Carl Love In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: BqXJLrwsfWFiLU3jWQPy6kEa2sQn1wcx X-Proofpoint-ORIG-GUID: BqXJLrwsfWFiLU3jWQPy6kEa2sQn1wcx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-24_04,2024-05-24_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 clxscore=1015 adultscore=0 malwarescore=0 phishscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405240106 X-Spam-Status: No, score=-9.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_MSPIKE_H4,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 List-Id: Kewen: On 5/24/24 03:43, Kewen.Lin wrote: > Hi, > > on 2024/5/24 02:21, Carl Love wrote: >> >> >> On 5/13/24 22:37, Kewen.Lin wrote: >>> Hi, >>> >>> on 2024/4/20 05:18, Carl Love wrote: >>>> rs6000, remove __builtin_vsx_xvcmpeqsp built-in >>>> >>>> The built-in __builtin_vsx_xvcmpeqsp is a duplicate of the overloaded >>>> vec_cmpeq built-in. The built-in is undocumented. The built-in and >>>> the test cases are removed. >>>> >>>> gcc/ChangeLog: >>>> * config/rs6000/rs6000-builtins.def (__builtin_vsx_xvcmpeqsp): >>>> Remove built-in definition. >>>> >>> >>> Ah, you separated this __builtin_vsx_xvcmpeqsp from the one for >>> __builtin_vsx_xvcmpeqsp_p, it's fine, please ignore the comments for >>> considering this __builtin_vsx_xvcmpeqsp in my previous reply to 11/13. >>> >>> >>>> gcc/testsuite/ChangeLog: >>>> * vsx-builtin-3.c (do_cmp): Remove test case for >>>> __builtin_vsx_xvcmpeqsp. >>>> --- >>>> gcc/config/rs6000/rs6000-builtins.def | 3 --- >>>> gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c | 2 -- >>>> 2 files changed, 5 deletions(-) >>>> >>>> diff --git a/gcc/config/rs6000/rs6000-builtins.def b/gcc/config/rs6000/rs6000-builtins.def >>>> index 2f6149edd5f..19d05b8043a 100644 >>>> --- a/gcc/config/rs6000/rs6000-builtins.def >>>> +++ b/gcc/config/rs6000/rs6000-builtins.def >>>> @@ -1613,9 +1613,6 @@ >>>> 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 {} >>>> >>>> diff --git a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c >>>> index 35ea31b2616..245893dc0e3 100644 >>>> --- a/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c >>>> +++ b/gcc/testsuite/gcc.target/powerpc/vsx-builtin-3.c >>>> @@ -27,7 +27,6 @@ >>>> /* { dg-final { scan-assembler "xvcmpeqdp" } } */ >>>> /* { dg-final { scan-assembler "xvcmpgtdp" } } */ >>>> /* { dg-final { scan-assembler "xvcmpgedp" } } */ >>>> -/* { dg-final { scan-assembler "xvcmpeqsp" } } */ >>>> /* { dg-final { scan-assembler "xvcmpgtsp" } } */ >>>> /* { dg-final { scan-assembler "xvcmpgesp" } } */ >>>> /* { dg-final { scan-assembler "xxsldwi" } } */ >>>> @@ -112,7 +111,6 @@ int do_cmp (void) >>>> 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++; >>>> return i; >>> >>> As the other in this patch series, I prefer to change it with >>> vec_cmpeq here, OK for trunk with this tweaked (also keep the >>> scan there), thanks! >> >> When I went to change the test case I noticed that __builtin_vsx_xvcmpeqsp and vec_cmpeq both return a vector where the element is all ones if the comparison is True and zeros if False. However, the return type for __builtin_vsx_xvcmpeqsp is vector floats but vec_cmpeq returns vector bool. >> > > Ah, so they are not equivalent from prototype perspective. > >> The PVIPR says the vec_cmpeq built-in returns a value where each bit in the vector element is a 1 if the comparison is equal and 0 otherwise. However, the documented result is a vector bool int for the floating point comparison. The return value for __builtin_vsx_xvcmpeqsp was vector float. > > IMHO PVIPR prototype (returning vector bool) makes more sense, > it does match better with what the result holds. Yes, I tend to agree. I think the user would use be likely using the test so they could create a mask to selectively replace vector elements. A bool type make more sense in that case. > >> >> So, the "bit values" returned are the same but not of the same type. So technically vec_cmpeq is not a drop in replacement for __builtin_vsx_xvcmpeqsp. Given that, perhaps we should not be removing __builtin_vsx_xvcmpeqsp? >> >> The testcase has to be changed from: >> f[i][0] = __builtin_vsx_xvcmpeqsp (f[i][1], f[i][2]); i++; >> bi[i][0] = vec_cmpeq (f[i][1], f[i][2]); i++; > > For the test case change, I'd expect that it can work with: > > - f[i][0] = __builtin_vsx_xvcmpeqsp (f[i][1], f[i][2]); i++; > + f[i][0] = (vector float) vec_cmpeq (f[i][1], f[i][2]); i++; Yes, that does work. > >> >> I am thinking we should drop this patch from the series, i.e. don't remove __builtin_vsx_xvcmpeqsp. Thoughts? >> > > Since __builtin_vsx_xvcmpeqsp is an undocumented built-in, I don't > expect users to use it, even there is someone, IMHO vector bool is > a better fit. In case someone actually wants the vector non-bool > type, he/she can just add an explicit conversion. So I'm inclined > to remove the vsx_xvcmpeqsp, users should try to use PVIPR built-ins > as possible as they can. But I'm also fine for holding on this, as > there are some other related built-ins cmp* (cmpge,cmpgt...), we > can re-visit and handle them together later. My preference would be to skip this for now and then come back later with a new patch to address all of the various comparisons for both float and double. Carl