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 5C61F385F015 for ; Thu, 25 Aug 2022 19:23:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5C61F385F015 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 (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27PJEN19028190; Thu, 25 Aug 2022 19:23:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=pp1; bh=EYVsKsP9kfoNb5/YEiR+ZQKUxRZI6xMj3EGSlVSghAg=; b=Rw21JURQw1MfRq3eo8eFb1BReRvFL02gQmdV64WeW0sCmtnWLOZfnIiX2IPUuiJu4iEt +OOMvC0hsSwt2dChahrzUPJUh5COabsNz5GJebVtN0Pb+KcwPkJ3YpSqhCeOieb3cJic q9Z+GMxQegDC5Nrr001qFYgkC7a7lN5VDNCnPXUKGlji7kAgd3+N/HnckjZuJWV3sT0n hZvaB5ROEca7S/F5KB2bP4UPE+XilziA7jwUh1YoWaGiApLCdqHq3dKrIk1kdmkOzCEf LQvxztLuyox1faTHiCA1G8GE1wapB64XOq9MYIR5xlKcNVrc8tyjY/TNTJuEFgashRmW 4A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3j6f2d09qt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Aug 2022 19:23:16 +0000 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 27PJEN0T028246; Thu, 25 Aug 2022 19:23:16 GMT Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3j6f2d09qf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Aug 2022 19:23:16 +0000 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 27PJ6GQO005584; Thu, 25 Aug 2022 19:23:15 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma02wdc.us.ibm.com with ESMTP id 3j2q8ahf0e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Aug 2022 19:23:15 +0000 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 27PJNEMJ43319732 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Aug 2022 19:23:14 GMT Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 56543BE053; Thu, 25 Aug 2022 19:24:39 +0000 (GMT) Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D67A3BE051; Thu, 25 Aug 2022 19:24:38 +0000 (GMT) Received: from toto.the-meissners.org (unknown [9.160.69.146]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTPS; Thu, 25 Aug 2022 19:24:38 +0000 (GMT) Date: Thu, 25 Aug 2022 15:23:12 -0400 From: Michael Meissner To: Jakub Jelinek Cc: Richard Biener , "Joseph S. Myers" , Jeff Law , gcc-patches@gcc.gnu.org, FX Subject: Re: [PATCH] Implement __builtin_issignaling Message-ID: Mail-Followup-To: Michael Meissner , Jakub Jelinek , Richard Biener , "Joseph S. Myers" , Jeff Law , gcc-patches@gcc.gnu.org, FX References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: qOJqlfXs5U3ZX3znouGjXcf4U7Tl8j95 X-Proofpoint-GUID: FXnxtybnBG1WSFnb7S_SSBZ9KjCsyrmz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-25_08,2022-08-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 spamscore=0 priorityscore=1501 phishscore=0 malwarescore=0 mlxscore=0 mlxlogscore=689 adultscore=0 suspectscore=0 clxscore=1011 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208250073 X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,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 Mon, Aug 15, 2022 at 12:12:02PM +0200, Jakub Jelinek via Gcc-patches wrote: > Hi! > > The following patch implements a new builtin, __builtin_issignaling, > which can be used to implement the ISO/IEC TS 18661-1 issignaling > macro. I haven't looked in detail at the patch, but from the description I think it needs a way for machine dependent parts to optimize this for a given mode when various switches are used. For example on the PowerPC (and at least older AMD processors) it can often times be expensive to move data from a floating point register to a GPR register to do the masking operation. I implemented special purpose recognizers a few years ago to speed up the SFmode math library to recognize when the glibc tests were being done. If the machine has a faster way to implement it, it should be allowed to do this. On some of the PowerPC's, I might want to generate code like (note, I might have some of the tests backwards, but the idea is test if the value is a NaN, and if it is a NaN, look at the signalling bit. Otherwise return 0: if (__builtin_isnan (x)) { long long mantissa = return ~((mantissa >> 52) & 1); } else { return 0; } That way it doesn't have to do a direct move to a GPR register to do the extraction in general. For SFmode/DFmode, you should be able to optimize it to something like to avoid any explicit jumps on a power10 (note, I may have some of the tests/shifts wrong, but that is the general method you could use): static int inline is_signalling_nan (double value) { int exponent = __builtin_vec_scalar_extract_exp (value); long long mantissa = __builtin_vec_scalar_extract_sig (value); return (mantissa >> 52) & (exponent == 0); } -- Michael Meissner, IBM PO Box 98, Ayer, Massachusetts, USA, 01432 email: meissner@linux.ibm.com