From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 47FC43858D1E for ; Tue, 14 May 2024 07:00:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 47FC43858D1E 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 47FC43858D1E 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=1715670031; cv=none; b=NJzCBZm55OBfqPGE2vg071mWn20dWCU04m+9hTCH9sUcSheXCKJYgZ3FBWXTF+GAYGO4K6X6l7vm9fqPQGcQYZXPrVMHfRMNbcZ7GChGf8h1GbnobcIG1v7JNq2scTZbZybry2PzC8ec8t3Un6zSw8yAb0FbjJglhGuquV7JiJs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715670031; c=relaxed/simple; bh=f1i7aae/4sT3YjJCZoThNnxWsWsn2OSjGkDMSdtX+b8=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=LiYjBU50R1fcQr4b9tGNIwXlfTbZ4hiINccNMpbzkLI4K+uby61ynr8QADVxpFLRCPp9edRCGZ+LyB/n8EAB5llnjxG/Tnpf5LLvIGPQCiIGhg+p/DSzMlOQJTsfb8FvKkpDawkpcLZpdmQPSDbm6P6pYIFCbAk06jDXnofjfrM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44E6m4Kv015670; Tue, 14 May 2024 07:00:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : references : cc : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=oESt4XNsSjZZg3ZjsMZJbhQF+4pN6HRqNZosa0MRNeI=; b=tVZQLV2lYEeT9sq5P4wKeoTzIaGGnjsPII23QXF7d8ldK8HfXMFcJoFh6BarDft+cCTn R1uQImoGSNeCDgJl+F9U4/hgtV20OAb45g/AyQjxAEMMrSH622u64eIsW0dk5wyq/Hba BAmHsXAvRrqfa2bDgRoJkWX+0o2Q4IGxBznIk7Qk/7jciYowuV5rIWCwMstuGUykVH/L m3gU0d0mFuhzPXqKPYI0VYNHGf+nD47Qk5IYldzndaqsOhQhiyZAxdlbzt89O8vCEXpR q1HssNacHss0BnaOb3tyhqBLCB6ytZbcLEk+KI6bhr5PSaN5DJmSdm2HVqeFgrCj5B11 8g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3y430mr1ar-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 May 2024 07:00:28 +0000 Received: from m0353723.ppops.net (m0353723.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 44E70Rsx001456; Tue, 14 May 2024 07:00:28 GMT 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 3y430mr1ap-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 May 2024 07:00:27 +0000 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 44E4fV4l002288; Tue, 14 May 2024 07:00:27 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3y2m0p4073-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 14 May 2024 07:00:27 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 44E70LC834275724 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 May 2024 07:00:23 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 734BB2004D; Tue, 14 May 2024 07:00:21 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DB9D62004B; Tue, 14 May 2024 07:00:19 +0000 (GMT) Received: from [9.200.158.244] (unknown [9.200.158.244]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 14 May 2024 07:00:19 +0000 (GMT) Message-ID: Date: Tue, 14 May 2024 15:00:18 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH 3/13] rs6000, fix error in unsigned vector float to unsigned int built-in definitions Content-Language: en-US To: Carl Love References: <6378d560-df55-4b75-be7b-93dc6b85d81a@linux.ibm.com> Cc: gcc-patches@gcc.gnu.org, "bergner@linux.ibm.com" , Segher Boessenkool , David Edelsohn From: "Kewen.Lin" In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 3zOc9os2W2t--Qk5FHyCYIeE-ZjG5U2I X-Proofpoint-ORIG-GUID: NNaRzV-KCqJcGzL15fiOpNGbfIa3Y_d7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-14_02,2024-05-10_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 bulkscore=0 mlxscore=0 spamscore=0 suspectscore=0 adultscore=0 phishscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405140047 X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,NICE_REPLY_A,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: Hi, on 2024/4/20 05:17, Carl Love wrote: > rs6000, fix error in unsigned vector float to unsigned int built-in definitions > > The built-ins __builtin_vsx_vunsigned_v2df and__builtin_vsx_vunsigned_v4sf > are supposed to take a vector of floats and return a vector of unsigned > long long ints. The definitions are using the signed version of the Sorry for nitpicking, here __builtin_vsx_vunsigned_v2df takes vector of doubles and returns vector of unsigned long long ints while __builtin_vsx_vunsigned_v4sf takes vector of floats and returns vector of unsigned ints. > instructions not the unsigned version of the instruction. The results > should also be unsigned. The builtins are used by the overloaded > vec_unsigned builtin which has an unsigned result. > > Similarly the built-ins __builtin_vsx_vunsignede_v2df and > __builtin_vsx_vunsignedo_v2df are supposed to retun an unsigned result. Nit: s/retun/return/ > If the floating point argument is negative, the unsigned result is zero. > The built-ins are used in the overloaded built-in vec_unsignede and > vec_unsignedo respectively. > > Add a test cases for a negative floating point arguments for each of the > above built-ins. > > gcc/ChangeLog: > * config/rs6000/rs6000-builtins.def (__builtin_vsx_vunsigned_v2df, > __builtin_vsx_vunsigned_v4sf, __builtin_vsx_vunsignede_v2df, > __builtin_vsx_vunsignedo_v2df): Change the result type to unsigned. > > gcc/testsuite/ChangeLog: > * gcc.target/powerpc/builtins-3-runnable.c: Add tests for > vec_unsignede and vec_unsignedo with negative arguments. > --- > gcc/config/rs6000/rs6000-builtins.def | 12 +++++----- > .../gcc.target/powerpc/builtins-3-runnable.c | 23 ++++++++++++++++--- > 2 files changed, 26 insertions(+), 9 deletions(-) > > diff --git a/gcc/config/rs6000/rs6000-builtins.def b/gcc/config/rs6000/rs6000-builtins.def > index c6d2ea1bc39..bf9a0ae22fc 100644 > --- a/gcc/config/rs6000/rs6000-builtins.def > +++ b/gcc/config/rs6000/rs6000-builtins.def > @@ -1580,16 +1580,16 @@ > const vsi __builtin_vsx_vsignedo_v2df (vd); > VEC_VSIGNEDO_V2DF vsignedo_v2df {} > > - const vsll __builtin_vsx_vunsigned_v2df (vd); > - VEC_VUNSIGNED_V2DF vsx_xvcvdpsxds {} > + const vull __builtin_vsx_vunsigned_v2df (vd); > + VEC_VUNSIGNED_V2DF vsx_xvcvdpuxds {} > > - const vsi __builtin_vsx_vunsigned_v4sf (vf); > - VEC_VUNSIGNED_V4SF vsx_xvcvspsxws {} > + const vui __builtin_vsx_vunsigned_v4sf (vf); > + VEC_VUNSIGNED_V4SF vsx_xvcvspuxws {} > > - const vsi __builtin_vsx_vunsignede_v2df (vd); > + const vui __builtin_vsx_vunsignede_v2df (vd); > VEC_VUNSIGNEDE_V2DF vunsignede_v2df {} > > - const vsi __builtin_vsx_vunsignedo_v2df (vd); > + const vui __builtin_vsx_vunsignedo_v2df (vd); > VEC_VUNSIGNEDO_V2DF vunsignedo_v2df {} > > const vf __builtin_vsx_xscvdpsp (double); > diff --git a/gcc/testsuite/gcc.target/powerpc/builtins-3-runnable.c b/gcc/testsuite/gcc.target/powerpc/builtins-3-runnable.c > index 0231a1fd086..6d4fe84c8a1 100644 > --- a/gcc/testsuite/gcc.target/powerpc/builtins-3-runnable.c > +++ b/gcc/testsuite/gcc.target/powerpc/builtins-3-runnable.c > @@ -313,6 +313,15 @@ int main() > test_unsigned_int_result (ALL, vec_uns_int_result, > vec_uns_int_expected); > > + /* Convert single precision float to unsigned int. Negative > + arguments > + */ > + vec_flt0 = (vector float){-14.930, -834.49, -3.3, -5.4}; > + vec_uns_int_expected = (vector unsigned int){0, 0, 0, 0}; > + vec_uns_int_result = vec_unsigned (vec_flt0); > + test_unsigned_int_result (ALL, vec_uns_int_result, > + vec_uns_int_expected); > + > /* Convert double precision float to long long unsigned int */ > vec_dble0 = (vector double){124.930, 8134.49}; > vec_ll_uns_int_expected = (vector long long unsigned int){124, 8134}; > @@ -321,9 +330,9 @@ int main() > vec_ll_uns_int_expected); Nit: Similar coverage on negative for vector double can be added here. BR, Kewen > > /* Convert double precision vector float to vector unsigned int, > - even words */ > - vec_dble0 = (vector double){3124.930, 8234.49}; > - vec_uns_int_expected = (vector unsigned int){3124, 0, 8234, 0}; > + even words. Negative arguments */ > + vec_dble0 = (vector double){-124.930, -234.49}; > + vec_uns_int_expected = (vector unsigned int){0, 0, 0, 0}; > vec_uns_int_result = vec_unsignede (vec_dble0); > test_unsigned_int_result (EVEN, vec_uns_int_result, > vec_uns_int_expected); > @@ -335,5 +344,13 @@ int main() > vec_uns_int_result = vec_unsignedo (vec_dble0); > test_unsigned_int_result (ODD, vec_uns_int_result, > vec_uns_int_expected); > + > + /* Convert double precision vector float to vector unsigned int, > + odd words. Negative arguments. */ > + vec_dble0 = (vector double){-924.930, -1234.49}; > + vec_uns_int_expected = (vector unsigned int){0, 0, 0, 0}; > + vec_uns_int_result = vec_unsignedo (vec_dble0); > + test_unsigned_int_result (ODD, vec_uns_int_result, > + vec_uns_int_expected); > } >