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 822B33858D20 for ; Thu, 25 May 2023 05:28:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 822B33858D20 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 (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34P4mGbn027091; Thu, 25 May 2023 05:28:44 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=rFnj1zRMEmqcmxa2Ku/0pQnXf8CzsFTHdoaKlILufEU=; b=X9F6Xgyp/jo35FuucOhkZJAdx+hHp/HndmAPwVFfoSm1+YXgUP7tGzjWm2Slj4rSp77M HyXzquu9vPQpzxUCJPuMvaFgubyDfDcuvrIvQQLH7PZ+YHDODeEXSbs4pKOq6bEr8Qb9 jTytXr/STNAsmXPDTrcKtRxcCrl4N1IhoHVfxwSMTOMlaEGXjaajK17LWtmqVYUJdJgP Cf2PaOjz1Jv8A+e/F6c2HlHOpVW4iPjXuohizsRRaYonU+sACZOTDlsVqFUcvr0D7qBN LCDl1QzL7tns3mXTF0f6IOwXulnekg6TsjptilPUkdTJPwfyVbsPVNH7UJUrlDaKWvnk cg== 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 3qt0ykgt74-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 May 2023 05:28:44 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 34P5Pb8D032539; Thu, 25 May 2023 05:28:42 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma03fra.de.ibm.com (PPS) with ESMTPS id 3qppe09uvp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 May 2023 05:28:42 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 34P5SeG822741738 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 May 2023 05:28:40 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 663CB20043; Thu, 25 May 2023 05:28:40 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A37DB20040; Thu, 25 May 2023 05:28:38 +0000 (GMT) Received: from [9.177.2.126] (unknown [9.177.2.126]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 25 May 2023 05:28:38 +0000 (GMT) Message-ID: <2fab487a-df28-0a5b-dba8-bed417e039bb@linux.ibm.com> Date: Thu, 25 May 2023 13:28:36 +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 v2] rs6000: Add buildin for mffscrn instructions Content-Language: en-US To: Carl Love Cc: Segher Boessenkool , gcc-patches@gcc.gnu.org, Peter Bergner References: <4f1af7ba04999d0258354b8e6794621ee303ec53.camel@us.ibm.com> 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: HWbY7gaHIrRcgaRyu6zJB4x4km19S4q7 X-Proofpoint-ORIG-GUID: HWbY7gaHIrRcgaRyu6zJB4x4km19S4q7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_02,2023-05-24_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 mlxlogscore=913 phishscore=0 bulkscore=0 spamscore=0 priorityscore=1501 suspectscore=0 malwarescore=0 impostorscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2304280000 definitions=main-2305250039 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,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 List-Id: on 2023/5/24 23:20, Carl Love wrote: > On Wed, 2023-05-24 at 13:32 +0800, Kewen.Lin wrote: >> on 2023/5/24 06:30, Peter Bergner wrote: >>> On 5/23/23 12:24 AM, Kewen.Lin wrote: >>>> on 2023/5/23 01:31, Carl Love wrote: >>>>> The builtins were requested for use in GLibC. As of version >>>>> 2.31 they >>>>> were added as inline asm. They requested a builtin so the asm >>>>> could be >>>>> removed. >>>> >>>> So IMHO we also want the similar support for mffscrn, that is to >>>> make >>>> use of mffscrn and mffscrni on Power9 and later, but falls back >>>> to >>>> __builtin_set_fpscr_rn + mffs similar on older platforms. >>> >>> So __builtin_set_fpscr_rn everything we want (sets the RN bits) and >>> uses mffscrn/mffscrni on P9 and later and uses older insns on pre- >>> P9. >>> The only problem is we don't return the current FPSCR bits, as the >>> bif >>> is defined to return void. >> >> Yes. >> >>> Crazy idea, but could we extend the built-in >>> with an overload that returns the FPSCR bits? >> >> So you agree that we should make this proposed new bif handle pre-P9 >> just >> like some other existing bifs. :) I think extending it is good and >> doable, >> but the only concern here is the bif name "__builtin_set_fpscr_rn", >> which >> matches the existing behavior (only set rounding) but doesn't match >> the >> proposed extending behavior (set rounding and get some env bits >> back). >> Maybe it's not a big deal if the documentation clarify it well. > > Extending the builtin to pre Power 9 is straight forward and I agree > would make good sense to do. > > I am a bit concerned on how to extend __builtin_set_fpscr_rn to add the > new functionality. Peter suggests overloading the builtin to either > return void or returns FPSCR bits. It is my understanding that the > return value for a given builtin had to be the same, i.e. you can't > overload the return value. Maybe you can with Bill's new > infrastructure? I recall having problems trying to overload the return > value in the past and Bill said you couldn't do it. I play with this > and see if I can overload the return value. Your understanding on that we fail to overload this for just different return types is correct. But previously I interpreted the extending proposal as to extend void __builtin_set_fpscr_rn (int); to void __builtin_set_fpscr_rn (int, double*); The related address taken and store here can be optimized out normally. BR, Kewen