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 2D1A43858297 for ; Wed, 21 Sep 2022 09:34:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2D1A43858297 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 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28L8HWHg024821; Wed, 21 Sep 2022 09:34:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=1qyLdNO3vl+fvJjjIpJOPfnkGQT0PmO8tEDZPQmmhr4=; b=swgkM4KovKrLs8xXTNrf7A8+UEgOFblQCfqewY6FQk0FDQHeB+x16S6z7GPFKYU3T23W ph6FoivkZIFsZ4ktoDJm5wORinKi5BB9vot5rWPoSVccjPT5YVfnB8/hGRpYvAQXr6/X HpWbtEt1W6XHnUPeA9R60oTqhJSTGe2lyPjBByPLnIeYkq2ohIjinnS58n5T3ZaLvVsH IzjlGW67LHJoa9ZDgmMcdvNgGmVGr63JIa26F2hA3T4TjMEKEujan86tpMsYDZ7TS3TA CK93hXHyR+7pBiCxKZP4xnHWTHaH5FnfYXDzNZRzczdO8synOhH49ElL+fcXaUPhmi8U 4w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jqxyp9yrc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Sep 2022 09:34:49 +0000 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 28L8K43B000762; Wed, 21 Sep 2022 09:34:49 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jqxyp9yq3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Sep 2022 09:34:49 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 28L9LPZa003294; Wed, 21 Sep 2022 09:34:46 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma03fra.de.ibm.com with ESMTP id 3jn5v8kqt2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Sep 2022 09:34:46 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 28L9Yhom50004252 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 21 Sep 2022 09:34:43 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 75AE8A405C; Wed, 21 Sep 2022 09:34:43 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B76C3A4054; Wed, 21 Sep 2022 09:34:41 +0000 (GMT) Received: from [9.197.244.166] (unknown [9.197.244.166]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 21 Sep 2022 09:34:41 +0000 (GMT) Message-ID: <6fa71d90-e694-3940-7f4b-49f046ab13c7@linux.ibm.com> Date: Wed, 21 Sep 2022 17:34:40 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH v6, rs6000] Implemented f[min/max]_optab by xs[min/max]dp [PR103605] Content-Language: en-US To: HAO CHEN GUI Cc: Segher Boessenkool , David , Peter Bergner , gcc-patches References: 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: m4yHf4bxDdehBOx-x72oo62ZApMTDDsF X-Proofpoint-ORIG-GUID: 9KqHHagKfZlbvBn8_kfHR3VeTb6ZsJt_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-21_04,2022-09-20_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 spamscore=0 bulkscore=0 adultscore=0 impostorscore=0 mlxlogscore=999 lowpriorityscore=0 malwarescore=0 suspectscore=0 priorityscore=1501 clxscore=1015 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209210064 X-Spam-Status: No, score=-14.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,NICE_REPLY_A,RCVD_IN_MSPIKE_H2,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 Haochen, on 2022/6/24 10:02, HAO CHEN GUI wrote: > Hi, > This patch implements optab f[min/max]_optab by xs[min/max]dp on rs6000. > Tests show that outputs of xs[min/max]dp are consistent with the standard > of C99 fmin/max. > > This patch also binds __builtin_vsx_xs[min/max]dp to fmin/max instead > of smin/max. So the builtins always generate xs[min/max]dp on all > platforms. > > Bootstrapped and tested on ppc64 Linux BE and LE with no regressions. > Is this okay for trunk? Any recommendations? Thanks a lot. > > ChangeLog > 2022-06-24 Haochen Gui > > gcc/ > PR target/103605 > * config/rs6000/rs6000.md (FMINMAX): New. > (minmax_op): New. > (f3): New pattern by UNSPEC_FMAX and UNSPEC_FMIN. Nit: here miss UNSPEC_FMAX and UNSPEC_FMIN. > * config/rs6000/rs6000-builtins.def (__builtin_vsx_xsmaxdp): Set > pattern to fmaxdf3. > (__builtin_vsx_xsmindp): Set pattern to fmindf3. > > gcc/testsuite/ > PR target/103605 > * gcc.dg/powerpc/pr103605.c: New. > > > patch.diff > diff --git a/gcc/config/rs6000/rs6000-builtins.def b/gcc/config/rs6000/rs6000-builtins.def > index f4a9f24bcc5..8b735493b40 100644 > --- a/gcc/config/rs6000/rs6000-builtins.def > +++ b/gcc/config/rs6000/rs6000-builtins.def > @@ -1613,10 +1613,10 @@ > XSCVSPDP vsx_xscvspdp {} > > const double __builtin_vsx_xsmaxdp (double, double); > - XSMAXDP smaxdf3 {} > + XSMAXDP fmaxdf3 {} > > const double __builtin_vsx_xsmindp (double, double); > - XSMINDP smindf3 {} > + XSMINDP fmindf3 {} > > const double __builtin_vsx_xsrdpi (double); > XSRDPI vsx_xsrdpi {} > diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md > index bf85baa5370..ae0dd98f0f9 100644 > --- a/gcc/config/rs6000/rs6000.md > +++ b/gcc/config/rs6000/rs6000.md > @@ -158,6 +158,8 @@ (define_c_enum "unspec" > UNSPEC_HASHCHK > UNSPEC_XXSPLTIDP_CONST > UNSPEC_XXSPLTIW_CONST > + UNSPEC_FMAX > + UNSPEC_FMIN > ]) > > ;; > @@ -5341,6 +5343,22 @@ (define_insn_and_split "*s3_fpr" > DONE; > }) > > + > +(define_int_iterator FMINMAX [UNSPEC_FMAX UNSPEC_FMIN]) > + > +(define_int_attr minmax_op [(UNSPEC_FMAX "max") > + (UNSPEC_FMIN "min")]) > + > +(define_insn "f3" > + [(set (match_operand:SFDF 0 "vsx_register_operand" "=wa") > + (unspec:SFDF [(match_operand:SFDF 1 "vsx_register_operand" "wa") > + (match_operand:SFDF 2 "vsx_register_operand" "wa")] > + FMINMAX))] > + "TARGET_VSX && !flag_finite_math_only" > + "xsdp %x0,%x1,%x2" > + [(set_attr "type" "fp")] > +) > + > (define_expand "movcc" > [(set (match_operand:GPR 0 "gpc_reg_operand") > (if_then_else:GPR (match_operand 1 "comparison_operator") > diff --git a/gcc/testsuite/gcc.target/powerpc/pr103605.c b/gcc/testsuite/gcc.target/powerpc/pr103605.c > new file mode 100644 > index 00000000000..1c938d40e61 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/powerpc/pr103605.c > @@ -0,0 +1,37 @@ > +/* { dg-do compile } */ Nit: This dg-do line isn't needed. OK with or without two nits fixed. Thanks! BR, Kewen