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 21C5B3858D1E for ; Mon, 19 Jun 2023 18:36:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 21C5B3858D1E 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 (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35JIM1sW032221; Mon, 19 Jun 2023 18:36:56 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=JU8NWPpnypTW3+s/jyz5bhJ532DwGCu7OHpmdYuV/9Q=; b=isse5SxISyygcd2Fq3sggrlbIvO7216fGOmsV1fDsAGifoY/ss+hU0lJsbvfPE5wkDke 2KgHmrgMxnnEQyMH4mnQG9gmeHvewlHfdR9rhUXjD4EvX/sGWRcGuSpgsQPHSnAKoAGi /SP6DOuGKVBds8VNbwy5grL1plQSagADdDkJJCjbwkGm6mLeWJFGwsu+BFCWStU4Ub/V vtPAokLmH70zDqee/BdWgumKuJy67cgpWPAANtxYxtW0kOyz8swsz3y5kN06aW7i75nq Zop4WAGGlkU+4lFmv6nXKTLagYSxNtVsv1ykknDSHWIadzlkgOjQpBQyVXJLf1/UIUxs 1w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rav81g82h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Jun 2023 18:36:56 +0000 Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 35JIaOpD012712; Mon, 19 Jun 2023 18:36:55 GMT Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rav81g81p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Jun 2023 18:36:55 +0000 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35JGFsPG010307; Mon, 19 Jun 2023 18:36:55 GMT Received: from smtprelay03.dal12v.mail.ibm.com ([9.208.130.98]) by ppma04dal.us.ibm.com (PPS) with ESMTPS id 3r94f6acjd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Jun 2023 18:36:55 +0000 Received: from smtpav05.dal12v.mail.ibm.com (smtpav05.dal12v.mail.ibm.com [10.241.53.104]) by smtprelay03.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35JIarbj58392908 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Jun 2023 18:36:53 GMT Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4F75E58052; Mon, 19 Jun 2023 18:36:53 +0000 (GMT) Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C6B4258056; Mon, 19 Jun 2023 18:36:52 +0000 (GMT) Received: from li-e362e14c-2378-11b2-a85c-87d605f3c641.ibm.com (unknown [9.61.18.149]) by smtpav05.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 19 Jun 2023 18:36:52 +0000 (GMT) Message-ID: Subject: Re: [PATCH ver 5] rs6000: Add builtins for IEEE 128-bit floating point values From: Carl Love To: "Kewen.Lin" , cel@us.ibm.com Cc: Peter Bergner , dje.gcc@gmail.com, gcc-patches@gcc.gnu.org, Segher Boessenkool Date: Mon, 19 Jun 2023 11:36:52 -0700 In-Reply-To: References: <4af2fbd155c4d2dbbf06335c390bc26efb1b37fd.camel@us.ibm.com> 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-ORIG-GUID: Pj1P8H2OaQecbrcfKdr9WhqoX3xPcU1m X-Proofpoint-GUID: fYk7m8z9Sm2QxjANBIEn6PMVjkolgmX4 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-06-19_11,2023-06-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 phishscore=0 mlxscore=0 clxscore=1015 mlxlogscore=999 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306190171 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,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: Kewen: On Mon, 2023-06-19 at 14:08 +0800, Kewen.Lin wrote: > > > Hi Carl, > > on 2023/6/17 01:57, Carl Love wrote: > > overloaded instance. Update comments. > > * config/rs6000/rs6000-overload.def > > (__builtin_vec_scalar_insert_exp): Add new overload definition > > with > > vector arguments. > > (scalar_extract_exp_to_vec, scalar_extract_sig_to_vec): New > > overloaded definitions. > > * config/vsx.md (V2DI_DI): New mode iterator. > > Missing an entry for DI_to_TI. Opps, missed that. Sorry, fixed. > > > > > > > const signed long long __builtin_vsx_scalar_extract_expq > > (_Float128); > > - VSEEQP xsxexpqp_kf {} > > + VSEEQP xsxexpqp_kf_di {} > > + > > + vull __builtin_vsx_scalar_extract_exp_to_vec (_Float128); > > + VSEEXPKF xsxexpqp_kf_v2di {} > > As I pointed out previously, the related id is VSEEQP, since both of > them Oops, I guess I forgot to change that. Sorry. > have kf in their names, having KF in its id doesn't look good IMHO. > How about VSEEQPV instead of VSEEXPKF? It's also consistent with > what > we use for VSIEQP. Yup, makes sense, changed to VSEEQPV. > > > > > const signed __int128 __builtin_vsx_scalar_extract_sigq > > (_Float128); > > - VSESQP xsxsigqp_kf {} > > + VSESQP xsxsigqp_kf_ti {} > > + > > + vuq __builtin_vsx_scalar_extract_sig_to_vec (_Float128); > > + VSESIGKF xsxsigqp_kf_v1ti {} > > Similar to the above, s/VSESIGKF/VSESQPV/ Changed to VSESQPV. > > > > > const _Float128 __builtin_vsx_scalar_insert_exp_q (unsigned > > __int128, \ > > unsigned long > > long); > > - VSIEQP xsiexpqp_kf {} > > + VSIEQP xsiexpqp_kf_di {} > > > > const _Float128 __builtin_vsx_scalar_insert_exp_qp (_Float128, \ > > unsigned > > long long); > > VSIEQPF xsiexpqpf_kf {} > > > > + const _Float128 __builtin_vsx_scalar_insert_exp_vqp (vuq, vull); > > + VSIEQPV xsiexpqp_kf_v2di {} > > + > > const signed int __builtin_vsx_scalar_test_data_class_qp > > (_Float128, \ > > const > > int<7>); > > VSTDCQP xststdcqp_kf {} > > diff --git a/gcc/config/rs6000/rs6000-c.cc > > b/gcc/config/rs6000/rs6000-c.cc > > index 8555174d36e..11060f697db 100644 > > --- a/gcc/config/rs6000/rs6000-c.cc > > +++ b/gcc/config/rs6000/rs6000-c.cc > > @@ -1929,11 +1929,15 @@ altivec_resolve_overloaded_builtin > > (location_t loc, tree fndecl, > > 128-bit variant of built-in function. */ > > if (GET_MODE_PRECISION (arg1_mode) > 64) > > { > > - /* If first argument is of float variety, choose variant > > - that expects __ieee128 argument. Otherwise, expect > > - __int128 argument. */ > > + /* If first argument is of float variety, choose the > > variant that > > + expects __ieee128 argument. If the first argument is > > vector > > + int, choose the variant that expects vector unsigned > > + __int128 argument. Otherwise, expect scalar __int128 > > argument. > > + */ > > if (GET_MODE_CLASS (arg1_mode) == MODE_FLOAT) > > instance_code = RS6000_BIF_VSIEQPF; > > + else if (GET_MODE_CLASS (arg1_mode) == MODE_VECTOR_INT) > > + instance_code = RS6000_BIF_VSIEQPV; > > else > > instance_code = RS6000_BIF_VSIEQP; > > } > > diff --git a/gcc/config/rs6000/rs6000-overload.def > > b/gcc/config/rs6000/rs6000-overload.def > > index c582490c084..05a5ca6a04d 100644 > > --- a/gcc/config/rs6000/rs6000-overload.def > > +++ b/gcc/config/rs6000/rs6000-overload.def > > @@ -4515,6 +4515,18 @@ > > VSIEQP > > _Float128 __builtin_vec_scalar_insert_exp (_Float128, unsigned > > long long); > > VSIEQPF > > + _Float128 __builtin_vec_scalar_insert_exp (vuq, vull); > > + VSIEQPV > > + > > +[VEC_VSEEV, scalar_extract_exp_to_vec, \ > > + __builtin_vec_scalar_extract_exp_to_vector] > > + vull __builtin_vec_scalar_extract_exp_to_vector (_Float128); > > + VSEEXPKF > > + > > Need to update if the above changes. changed > > > +[VEC_VSESV, scalar_extract_sig_to_vec, \ > > + __builtin_vec_scalar_extract_sig_to_vector] > > + vuq __builtin_vec_scalar_extract_sig_to_vector (_Float128); > > + VSESIGKF > > > > Ditto. changed > > > > > diff --git a/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract- > > exp-8.c b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp- > > 8.c > > new file mode 100644 > > index 00000000000..e24e09012d9 > > --- /dev/null > > +++ b/gcc/testsuite/gcc.target/powerpc/bfp/scalar-extract-exp-8.c > > @@ -0,0 +1,58 @@ > > +/* { dg-do run { target { powerpc*-*-* } } } */ > > +/* { dg-require-effective-target lp64 } */ > > +/* { dg-require-effective-target p9vector_hw } */ > > +/* { dg-options "-mdejagnu-cpu=power9 -save-temps" } */ > > + > > +#include > > +#include > > + > > +#if DEBUG > > +#include > > +#endif > > + > > +vector unsigned long long int > > +get_exponents (__ieee128 *p) > > +{ > > + __ieee128 source = *p; > > + > > + return scalar_extract_exp_to_vec (source); > > +} > > + > > +int > > +main () > > +{ > > + vector unsigned long long int result, exp_result; > > + union conv128_t > > + { > > + __ieee128 val_ieee128; > > + __int128 val_int128; > > + } source; > > + > > +#ifdef _BIG_ENDIAN > > + exp_result[1] = 0x0ULL; > > + exp_result[0] = 0x1234ULL; > > +#else > > + exp_result[0] = 0x0ULL; > > + exp_result[1] = 0x1234ULL; > > +#endif > > + source.val_int128 = 0x923456789ABCDEF0ULL; > > + source.val_int128 = (source.val_int128 << 64) | > > 0x123456789ABCDEFULL; > > + > > + result = get_exponents (&source.val_ieee128); > > + > > + if ((result[0] != exp_result[0]) || (result[1] != > > exp_result[1])) > > +#if DEBUG > > + { > > + printf("result[0] = 0x%llx; exp_result[0] = 0x%llx\n", > > + result[0], exp_result[0]); > > + printf("result[1] = 0x%llx; exp_result[1] = 0x%llx\n", > > + result[1], exp_result[1]); > > + } > > +#else > > + abort(); > > +#endif > > + return 0; > > +} > > + > > +/* check that the expected extract exponent instruction is > > generated. */ > > Nit nit: it's test case, so nobody cares it, but it's better to use > "Check" > instead of "check", if you don't mind, could you update this along > with the > other updates? (and for the other two cases) Fixed in all three test program files. Carl