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 B817C384B83A for ; Mon, 30 May 2022 09:56:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B817C384B83A Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24U9u8xJ015910; Mon, 30 May 2022 09:56:44 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gcs0ebfvs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 May 2022 09:56:44 +0000 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24U9oHnG023611; Mon, 30 May 2022 09:56:44 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gcs0ebfv7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 May 2022 09:56:43 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24U9piDh014731; Mon, 30 May 2022 09:56:41 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma06fra.de.ibm.com with ESMTP id 3gbcb7hva3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 May 2022 09:56:41 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24U9gIOs55836992 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 30 May 2022 09:42:18 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 621D611C050; Mon, 30 May 2022 09:56:38 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2406E11C04C; Mon, 30 May 2022 09:56:36 +0000 (GMT) Received: from [9.197.252.204] (unknown [9.197.252.204]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 30 May 2022 09:56:35 +0000 (GMT) Message-ID: <73136d0c-5798-42b7-61ed-25629349e394@linux.ibm.com> Date: Mon, 30 May 2022 17:56:34 +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 v3, 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: <6c315e9c-f86b-5704-feea-73e434ecffee@linux.ibm.com> From: "Kewen.Lin" In-Reply-To: <6c315e9c-f86b-5704-feea-73e434ecffee@linux.ibm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: YJDvfBqYucC8x0LfEqasV7trE6l1GWqA X-Proofpoint-GUID: UHPkH5JMwBM-BhT-iXEU9nW0dI86O8VZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-30_03,2022-05-27_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 priorityscore=1501 spamscore=0 adultscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2205300050 X-Spam-Status: No, score=-11.9 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, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2022 09:56:47 -0000 Hi Haochen, on 2022/5/18 16:52, 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-05-18 Haochen Gui > > gcc/ > PR target/103605 > * rs6000.md (FMINMAX): New. > (minmax_op): New. > (f3): New pattern by UNSPEC_FMAX and UNSPEC_FMIN. > * rs6000-builtins.def (__builtin_vsx_xsmaxdp): Set pattern to fmaxdf3. > (__builtin_vsx_xsmindp): Set pattern to fmindf3. > These changelog entries look wrong to me, they miss the relative path names. * config/rs6000/rs6000-builtins.def ... * config/rs6000/rs6000.md ... > gcc/testsuite/ > PR target/103605 > * gcc.dg/pr103605.c: New. ... and wrong path here. * gcc.target/powerpc/pr103605.c: New test. OK with the changelog above fixed. Thanks! BR, Kewen > > 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..197de0838ee 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" > +"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..e43ac40c2d1 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/powerpc/pr103605.c > @@ -0,0 +1,37 @@ > +/* { dg-do compile } */ > +/* { dg-require-effective-target powerpc_vsx_ok } */ > +/* { dg-options "-O1 -mvsx" } */ > +/* { dg-final { scan-assembler-times {\mxsmaxdp\M} 3 } } */ > +/* { dg-final { scan-assembler-times {\mxsmindp\M} 3 } } */ > + > +#include > + > +double test1 (double d0, double d1) > +{ > + return fmin (d0, d1); > +} > + > +float test2 (float d0, float d1) > +{ > + return fmin (d0, d1); > +} > + > +double test3 (double d0, double d1) > +{ > + return fmax (d0, d1); > +} > + > +float test4 (float d0, float d1) > +{ > + return fmax (d0, d1); > +} > + > +double test5 (double d0, double d1) > +{ > + return __builtin_vsx_xsmindp (d0, d1); > +} > + > +double test6 (double d0, double d1) > +{ > + return __builtin_vsx_xsmaxdp (d0, d1); > +}