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 01AEA3858C74 for ; Wed, 27 Sep 2023 05:08:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 01AEA3858C74 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 (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38R57dMv016220; Wed, 27 Sep 2023 05:08:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : from : subject : to : cc : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pp1; bh=JEXesN2g+c+URMINDvRprMOLshX0llzEPhdwCymsEuE=; b=IPG1/Rl3K+d71+FsSLKmAjjpDK2e8gD3J5e7kV+IMksqJ8jADWBN57yTQ5TLpQj9TWE9 5T/Nj3X6dj6ipC7TKActTuCA5DatMEuAZeaYEp62dBieL4H+B1I/Ck7BfD595/FeX487 Lv301YkmFpVcvGFoYwiIPl77LWQbD08JJdMOTH2jkFduDk2GBRf9Oqq8aX+GdroZA7k+ uFuLDw77HOup0ueEdVn322DoObqTI93fQg8uoZcm4TqohVzoW/05klj33Aylzw080wro kIU+vG0VeDtuJJ2V9+xrVLxsDpWATTDmLkfAZv+9jPyHa6a+LnGhfH2fBRp0I5FXehbb Gg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3tcdkr8dct-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Sep 2023 05:08:34 +0000 Received: from m0353726.ppops.net (m0353726.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 38R57oll017488; Wed, 27 Sep 2023 05:08:34 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3tcdkr8dck-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Sep 2023 05:08:34 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 38R4NlX2030753; Wed, 27 Sep 2023 05:08:33 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3tacjk0h0c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Sep 2023 05:08:33 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 38R58UFN44040522 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Sep 2023 05:08:30 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3E16B20040; Wed, 27 Sep 2023 05:08:30 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EFACE2004B; Wed, 27 Sep 2023 05:08:27 +0000 (GMT) Received: from [9.177.71.47] (unknown [9.177.71.47]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 27 Sep 2023 05:08:27 +0000 (GMT) Message-ID: <52b43e43-cb27-0aed-bd08-02cfd74ee268@linux.ibm.com> Date: Wed, 27 Sep 2023 13:08:26 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 From: "Kewen.Lin" Subject: Re: [PATCH-2v3, rs6000] Implement 32bit inline lrint [PR88558] To: HAO CHEN GUI Cc: Segher Boessenkool , David , Peter Bergner , gcc-patches References: <77605bb5-c8c9-275d-f180-7c9bf13cf34e@linux.ibm.com> Content-Language: en-US In-Reply-To: <77605bb5-c8c9-275d-f180-7c9bf13cf34e@linux.ibm.com> Content-Type: text/plain; charset=UTF-8 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 2tCJJIERyGzWMvGqNv5Q3xWFPYUXIXAD X-Proofpoint-ORIG-GUID: PRPtHxcnXfzHGuvcgm_oSZJINdibXW1V Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-27_01,2023-09-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0 spamscore=0 bulkscore=0 malwarescore=0 mlxlogscore=999 lowpriorityscore=0 adultscore=0 clxscore=1015 impostorscore=0 phishscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309270041 X-Spam-Status: No, score=-12.0 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 2023/9/25 10:05, HAO CHEN GUI wrote: > Hi, > This patch implements 32bit inline lrint by "fctiw". It depends on > the patch1 to do SImode move from FP registers on P7. > > Compared to last version, the main change is to add some test cases. > https://gcc.gnu.org/pipermail/gcc-patches/2023-September/629187.html > > Bootstrapped and tested on powerpc64-linux BE and LE with no regressions. > This patch is ok for trunk, thanks! BR, Kewen > Thanks > Gui Haochen > > ChangeLog > rs6000: support 32bit inline lrint > > gcc/ > PR target/88558 > * config/rs6000/rs6000.md (lrintdi2): Remove TARGET_FPRND > from insn condition. > (lrintsi2): New insn pattern for 32bit lrint. > > gcc/testsuite/ > PR target/106769 > * gcc.target/powerpc/pr88558.h: New. > * gcc.target/powerpc/pr88558-p7.c: New. > * gcc.target/powerpc/pr88558-p8.c: New. > > patch.diff > diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md > index ac5d29a2cf8..a41898e0e08 100644 > --- a/gcc/config/rs6000/rs6000.md > +++ b/gcc/config/rs6000/rs6000.md > @@ -6655,10 +6655,18 @@ (define_insn "lrintdi2" > [(set (match_operand:DI 0 "gpc_reg_operand" "=d") > (unspec:DI [(match_operand:SFDF 1 "gpc_reg_operand" "")] > UNSPEC_FCTID))] > - "TARGET_HARD_FLOAT && TARGET_FPRND" > + "TARGET_HARD_FLOAT" > "fctid %0,%1" > [(set_attr "type" "fp")]) > > +(define_insn "lrintsi2" > + [(set (match_operand:SI 0 "gpc_reg_operand" "=d") > + (unspec:SI [(match_operand:SFDF 1 "gpc_reg_operand" "")] > + UNSPEC_FCTIW))] > + "TARGET_HARD_FLOAT && TARGET_POPCNTD" > + "fctiw %0,%1" > + [(set_attr "type" "fp")]) > + > (define_insn "btrunc2" > [(set (match_operand:SFDF 0 "gpc_reg_operand" "=d,wa") > (unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "d,wa")] > diff --git a/gcc/testsuite/gcc.target/powerpc/pr88558-p7.c b/gcc/testsuite/gcc.target/powerpc/pr88558-p7.c > new file mode 100644 > index 00000000000..3932656c5fd > --- /dev/null > +++ b/gcc/testsuite/gcc.target/powerpc/pr88558-p7.c > @@ -0,0 +1,13 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -fno-math-errno -mdejagnu-cpu=power7" } */ > + > +/* -fno-math-errno is required to make {i,l,ll}rint{,f} inlined */ > + > +#include "pr88558.h" > + > +/* { dg-final { scan-assembler-times {\mfctid\M} 4 { target lp64 } } } */ > +/* { dg-final { scan-assembler-times {\mfctid\M} 2 { target ilp32 } } } */ > +/* { dg-final { scan-assembler-times {\mfctiw\M} 2 { target lp64 } } } */ > +/* { dg-final { scan-assembler-times {\mfctiw\M} 4 { target ilp32 } } } */ > +/* { dg-final { scan-assembler-times {\mstfiwx\M} 2 { target lp64 } } } */ > +/* { dg-final { scan-assembler-times {\mstfiwx\M} 4 { target ilp32 } } } */ > diff --git a/gcc/testsuite/gcc.target/powerpc/pr88558-p8.c b/gcc/testsuite/gcc.target/powerpc/pr88558-p8.c > new file mode 100644 > index 00000000000..1afc8fd4f0d > --- /dev/null > +++ b/gcc/testsuite/gcc.target/powerpc/pr88558-p8.c > @@ -0,0 +1,14 @@ > +/* { dg-do compile } */ > +/* { dg-require-effective-target powerpc_p8vector_ok } */ > +/* { dg-options "-O2 -fno-math-errno -mdejagnu-cpu=power8" } */ > + > +/* -fno-math-errno is required to make {i,l,ll}rint{,f} inlined */ > + > +#include "pr88558.h" > + > +/* { dg-final { scan-assembler-times {\mfctid\M} 4 { target lp64 } } } */ > +/* { dg-final { scan-assembler-times {\mfctid\M} 2 { target ilp32 } } } */ > +/* { dg-final { scan-assembler-times {\mfctiw\M} 2 { target lp64 } } } */ > +/* { dg-final { scan-assembler-times {\mfctiw\M} 4 { target ilp32 } } } */ > +/* { dg-final { scan-assembler-times {\mmfvsrwz\M} 2 { target lp64 } } } */ > +/* { dg-final { scan-assembler-times {\mmfvsrwz\M} 4 { target ilp32 } } } */ > diff --git a/gcc/testsuite/gcc.target/powerpc/pr88558.h b/gcc/testsuite/gcc.target/powerpc/pr88558.h > new file mode 100644 > index 00000000000..9c604faadd1 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/powerpc/pr88558.h > @@ -0,0 +1,29 @@ > +long int test1 (double a) > +{ > + return __builtin_lrint (a); > +} > + > +long long test2 (double a) > +{ > + return __builtin_llrint (a); > +} > + > +int test3 (double a) > +{ > + return __builtin_irint (a); > +} > + > +long int test4 (float a) > +{ > + return __builtin_lrintf (a); > +} > + > +long long test5 (float a) > +{ > + return __builtin_llrintf (a); > +} > + > +int test6 (float a) > +{ > + return __builtin_irintf (a); > +}