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 E6B783858D35 for ; Fri, 30 Jun 2023 03:14:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E6B783858D35 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 (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35U2lNld015777; Fri, 30 Jun 2023 03:14:58 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=8IMxmA+Y0wbXm0C7irqAeMdqs0J21R0km10wJpB7PW0=; b=pRYR8XL4dX1+iQAm14zGaIJvnNyypsEEzUQQxtO0b/xSEPEkIVhfUNmfpJVnp67ic/pd HcdzzPG8qlQmu437gL7QVYaq8WOfUobudvSnxJs7kwZOfDOS7BtC39sydjQZGvCUtMl4 3t944RYprhhfQtZo8Hihv9/s45AfVmcH4GXGsBfwpdqm6lNV3HNR/IdGPLXG0oiqIKDO XxfVCfr7QQyIUbcic0+0pJ44GxXGFJfoCa6EG0j65bhxklgnKiDA1uIlXJW3evl1s7nL Lc/CkWyehpzFSXT30k80c65KgEFbIY6Kwtz8Y6UNHOcZ9JQ11cNAhRBj3l9KvBa7QLa+ +g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rhpjugmnw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 30 Jun 2023 03:14:57 +0000 Received: from m0353724.ppops.net (m0353724.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 35U3AwP0029339; Fri, 30 Jun 2023 03:14:57 GMT Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rhpjugmns-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 30 Jun 2023 03:14:57 +0000 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35TNCRgn025209; Fri, 30 Jun 2023 03:14:56 GMT Received: from smtprelay03.wdc07v.mail.ibm.com ([9.208.129.113]) by ppma04wdc.us.ibm.com (PPS) with ESMTPS id 3rdr4666y9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 30 Jun 2023 03:14:56 +0000 Received: from smtpav01.dal12v.mail.ibm.com (smtpav01.dal12v.mail.ibm.com [10.241.53.100]) by smtprelay03.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35U3EsGg8323828 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 30 Jun 2023 03:14:54 GMT Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8128458120; Fri, 30 Jun 2023 03:14:54 +0000 (GMT) Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1A9ED58124; Fri, 30 Jun 2023 03:14:54 +0000 (GMT) Received: from [9.61.31.25] (unknown [9.61.31.25]) by smtpav01.dal12v.mail.ibm.com (Postfix) with ESMTP; Fri, 30 Jun 2023 03:14:53 +0000 (GMT) Message-ID: <6ca847d8-0459-489b-d3c2-9b33748738aa@linux.ibm.com> Date: Thu, 29 Jun 2023 22:14:47 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH] rs6000, __builtin_set_fpscr_rn add retrun value Content-Language: en-US To: "Kewen.Lin" , Carl Love Cc: Segher Boessenkool , dje.gcc@gmail.com, gcc-patches@gcc.gnu.org References: <42d27e659f56f16796c6bfab0799616bbdf6046a.camel@us.ibm.com> From: Peter Bergner In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: P42cP8DvoxxYr9wUMZ61dXu2swPrXVci X-Proofpoint-ORIG-GUID: JrdLybLvaJTC58rfu_npAmD356CDl6ts 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-29_10,2023-06-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxscore=0 phishscore=0 mlxlogscore=763 suspectscore=0 impostorscore=0 bulkscore=0 lowpriorityscore=0 adultscore=0 spamscore=0 clxscore=1015 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306300024 X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,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 6/29/23 4:13 AM, Kewen.Lin wrote: > on 2023/6/19 23:57, Carl Love wrote: >> The following patch changes the return type of the >> __builtin_set_fpscr_rn builtin from void to double. The return value >> is the current value of the various FPSCR fields DRN, VE, OE, UE, ZE, >> XE, NI, RN bit positions when the builtin is called. The builtin then >> updated the RN field with the new value provided as an argument to the >> builtin. The patch adds new testcases to test_fpscr_rn_builtin.c to >> check that the builtin returns the current value of the FPSCR fields >> and then updates the RN field. > > But this patch also introduces one more overloading instance with argument > type double, I had a check on glibc usage of mffscrn/mffscrni, I don't > think it's necessary to add this new instance, as it takes the given > rounding mode as integral type. I agree with Ke Wen, I don't know why there is an extra overloaded instance. I assumed we'd have just the one we had before, except now its return type is double and not void. That said, we need to announce to users that the return type has changed, so new code compiled with a new GCC can get the new return value, but if that new code is compiled with an old GCC (still has void return type), it knows it needs to use some other method to get the FPSCR value, if it needs it. We normally do that with a predefine macro (#define ...) that the user can test for in their code, ala: #ifdef __SET_FPSCR_RN_RETURNS_FPSCR__ /* Or whatever name. */ ret = __builtin_set_fpscr_rn (......); #else __builtin_set_fpscr_rn (......); ret = ; #endif We add those predefined macros in rs6000-c.cc:rs6000_target_modify_macros() and it should be gated via the same conditions that the built-in itself is enabled. Look at my addition of the __TM_FENCE__ macro that let the user know our HTM insn patterns were fixed to now act as memory barriers. Peter