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 C75473858D1E for ; Mon, 20 May 2024 08:15:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C75473858D1E 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 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C75473858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716192940; cv=none; b=oTKy93uSOCPJDXEiQB950cJRY7cLW9W66o2ZQ/SQP8cgkG9hgu4jubI8dk60ZnooFT08YA+tpxEZOZG07FQhIbth/fQkdNgF5MDogo4k/QkTAdTButO9YcZnFp/D2ImVF95kkSlddHCW/CnXvXuIwRCDu8SzomY5PG5uQAK0+bU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716192940; c=relaxed/simple; bh=qjkp0eziXuh6mN0Bv0aMmJ3Ete4O5RSLZ4QxXf/BZ/I=; h=DKIM-Signature:Message-ID:Date:To:From:Subject:MIME-Version; b=EWO7Die+FYht3v+VTx67HcYwnCexfpUluFnRL248jRzuwQ22Ai5lE2WWnu0MYlHdJ/RcEIcUIF8/FleQe1bhIgAWXxxjp1Kcc3Fz65gaHZBJ2j7A+eU5em8TQcsWGc7H316n2PCWpD5KtCRTVvvKRBSWKW4CTPIZW9sdb+WGn1I= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44K4tVam008792; Mon, 20 May 2024 08:15:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : to : from : cc : subject : content-type : content-transfer-encoding : mime-version; s=pp1; bh=+ybMoRZvWzyIrrmF+qsmegJq6idUyRtt+nTrbcr3nAw=; b=oiU0KPFwl8higzienymK0LZkZUHdniXqiQkAY+cjGeQszgtKmAl2/Xj8Gg8aoB4gS4tA UkLh9zNleYiNLMUswIbENrrkVCeBjc2Nx2RVoaHWAVu8NImONEq+4pEcFlp09gn9iuud GXBZ69odojBZrWoEtLePdIcMdH2SkwYMWEXpust/eHoCG6w24R+I9gXHI2NCmcbE6pzf gNqNp0GWD+N+MwhYk3kzng8y2f6zM2ISHHJPou7PgSEB0Dbj6AkhaF6FSVoVX8/MmBM/ rWwwcWhdMAuLPIcD2A1DdK8+TAw1R6lcy9py6d7NEb5TFUT3wlU85Fl/dncZCfoiA3mi 1A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3y7pdv9m23-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 May 2024 08:15:35 +0000 Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 44K8FZWg003847; Mon, 20 May 2024 08:15:35 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3y7pdv9m1y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 May 2024 08:15:35 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 44K7XRRt007424; Mon, 20 May 2024 08:15:34 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3y79c2p8bn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 May 2024 08:15:34 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 44K8FSkQ52429198 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 20 May 2024 08:15:30 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 70CC12004B; Mon, 20 May 2024 08:15:28 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 93C9E20040; Mon, 20 May 2024 08:15:25 +0000 (GMT) Received: from [9.66.72.72] (unknown [9.66.72.72]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 20 May 2024 08:15:25 +0000 (GMT) Message-ID: <37f328b1-ad76-4083-a85c-3fc0df574c72@linux.ibm.com> Date: Mon, 20 May 2024 16:15:24 +0800 User-Agent: Mozilla Thunderbird Content-Language: en-US To: gcc-patches From: HAO CHEN GUI Cc: Segher Boessenkool , David , "Kewen.Lin" , Peter Bergner , Andrew Pinski , Richard Biener Subject: [PATCHv2] Optab: add isfinite_optab for __builtin_isfinite Content-Type: text/plain; charset=UTF-8 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: qEJ0M_DugYkWSsOyGeHZNNb1yH8w9zAP X-Proofpoint-GUID: u6nsHft1VbmK3Ak_mexiJxZTlltDWscQ 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.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-20_04,2024-05-17_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=720 spamscore=0 phishscore=0 malwarescore=0 adultscore=0 priorityscore=1501 mlxscore=0 suspectscore=0 lowpriorityscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405200067 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,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, This patch adds an optab for __builtin_isfinite. The finite check can be implemented on rs6000 by a single instruction. It needs an optab to be expanded to the certain sequence of instructions. The subsequent patches will implement the expand on rs6000. Compared to previous version, the main change is to document isfinite in md.texi. https://gcc.gnu.org/pipermail/gcc-patches/2024-April/649339.html Bootstrapped and tested on x86 and powerpc64-linux BE and LE with no regressions. Is this OK for trunk? Thanks Gui Haochen ChangeLog optab: Add isfinite_optab for isfinite builtin gcc/ * builtins.cc (interclass_mathfn_icode): Set optab to isfinite_optab for isfinite builtin. * optabs.def (isfinite_optab): New. * doc/md.texi (isfinite): Document. patch.diff diff --git a/gcc/builtins.cc b/gcc/builtins.cc index f8d94c4b435..b8432f84020 100644 --- a/gcc/builtins.cc +++ b/gcc/builtins.cc @@ -2459,8 +2459,9 @@ interclass_mathfn_icode (tree arg, tree fndecl) errno_set = true; builtin_optab = ilogb_optab; break; CASE_FLT_FN (BUILT_IN_ISINF): builtin_optab = isinf_optab; break; - case BUILT_IN_ISNORMAL: case BUILT_IN_ISFINITE: + builtin_optab = isfinite_optab; break; + case BUILT_IN_ISNORMAL: CASE_FLT_FN (BUILT_IN_FINITE): case BUILT_IN_FINITED32: case BUILT_IN_FINITED64: diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index 5730bda80dc..8ed70b3feea 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -8557,6 +8557,11 @@ operand 2, greater than operand 2 or is unordered with operand 2. This pattern is not allowed to @code{FAIL}. +@cindex @code{isfinite@var{m}2} instruction pattern +@item @samp{isfinite@var{m}2} +Set operand 0 to nonzero if operand 1 is a finite floating-point +number and to 0 otherwise. + @end table @end ifset diff --git a/gcc/optabs.def b/gcc/optabs.def index ad14f9328b9..dcd77315c2a 100644 --- a/gcc/optabs.def +++ b/gcc/optabs.def @@ -352,6 +352,7 @@ OPTAB_D (fmod_optab, "fmod$a3") OPTAB_D (hypot_optab, "hypot$a3") OPTAB_D (ilogb_optab, "ilogb$a2") OPTAB_D (isinf_optab, "isinf$a2") +OPTAB_D (isfinite_optab, "isfinite$a2") OPTAB_D (issignaling_optab, "issignaling$a2") OPTAB_D (ldexp_optab, "ldexp$a3") OPTAB_D (log10_optab, "log10$a2")