From patchwork Tue May 28 06:36:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: HAO CHEN GUI X-Patchwork-Id: 1940243 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VpN9S2y9zz20Q9 for ; Tue, 28 May 2024 16:37:32 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8C6D9387085C for ; Tue, 28 May 2024 06:37:30 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 967C638708B1 for ; Tue, 28 May 2024 06:37:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 967C638708B1 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 967C638708B1 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=1716878231; cv=none; b=pVi/5aAbW+a2/E+JiJKTh2xBOwAkxiIW//VpQESsjDIdI11bhgODovoYhZHwrXbYFSMcajx3F3zmJkusXAoEXY2OWtxibvMRYGVpWmKc4qhDaGXBH6XQGdtqQKQP2c+uy9DnnlTWon4Y+t/9SU6K3I+FcTJM0IvcAvgpLUYtrPw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716878231; c=relaxed/simple; bh=ZDYsGfv+AuloiZBwcCjOs9kq+kKOZOg0Fv2kreM33Ds=; h=DKIM-Signature:Message-ID:Date:To:From:Subject:MIME-Version; b=eQsjnZ8JjXcSoSZ1K5cnfUWYbKzRmOJO3qG9pro074b5s0/QcHuLicBFScYUjFHs0U3ITEwMv8KMdoT5D15zy6T9y/7TCG/7dm2bb/H7hFNupuPdXK+uWAqWfu/KjbGreP1GQFUwtmZxoJUDGn6jiTpp51WnTrkzGGUaGwTMeSk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44S6AdFt029641; Tue, 28 May 2024 06:37:06 GMT DKIM-Signature: =?UTF-8?Q?v=3D1; _a=3Drsa-sha256; _c=3Drelaxed/relaxed; _d=3Dibm.com; _h=3Dcc?= =?utf-8?q?=3Acontent-transfer-encoding=3Acontent-ty?= =?utf-8?q?pe=3Adate=3Afrom=3Amessage-id=3Amime-version=3Asubject=3Ato=3B_s?= =?utf-8?q?=3Dpp1=3B_bh=3DqHD0gsqmvLPXDHv/UfWgW0/TrwvLuDgehPM0pgIpKls=3D=3B_?= =?utf-8?q?b=3DCuglJHrQT7DJiz+rruGt9v1OeQtBIPDB/0pVikSsB8c9sECnxpGWHGqIgPQDx?= =?utf-8?q?KyGxh3c_awf/Hl84Mi3qSsFyLdY3CFG4Thk6ko8M3zmp/gyBflfJGAvzUnah90u0P?= =?utf-8?q?/iYBXaAF1uB_JmDQAxbTvOMNYFdFD14uYatFz2sp24oEaQgUQP6cj1k2OenKyI/Yn?= =?utf-8?q?/Xh3BYc03ltWzzo_XJuEerOV+kpvU/34uxwTgxcjXSPyg4YK7ZWyUQz2HLqmpj4NA?= =?utf-8?q?AnAMEhovag0j9atpO3Z_BQwM1c5zSyvKazt8u+1+5YY/tFW5uWGx0EGf+IIde3h4X?= =?utf-8?q?on+BgiBbdoR1mJT5uRRGY3j_rg=3D=3D_?= Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yd8yyr5xu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 May 2024 06:37:06 +0000 Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 44S6b5iV008887; Tue, 28 May 2024 06:37:06 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yd8yyr5xr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 May 2024 06:37:05 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 44S6ZR65032649; Tue, 28 May 2024 06:37:04 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3ybutm55df-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 May 2024 06:37:04 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 44S6awcm41353588 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 May 2024 06:37:00 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ADCF220094; Tue, 28 May 2024 06:36:58 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AE18B2008F; Tue, 28 May 2024 06:36:56 +0000 (GMT) Received: from [9.200.103.244] (unknown [9.200.103.244]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 28 May 2024 06:36:56 +0000 (GMT) Message-ID: <759552ae-4e22-4c63-85b9-1941869e2161@linux.ibm.com> Date: Tue, 28 May 2024 14:36:56 +0800 User-Agent: Mozilla Thunderbird Content-Language: en-US To: gcc-patches Cc: Segher Boessenkool , David , "Kewen.Lin" , Peter Bergner , Andrew Pinski , Richard Biener From: HAO CHEN GUI Subject: [PATCHv4] Optab: add isnormal_optab for __builtin_isnormal X-TM-AS-GCONF: 00 X-Proofpoint-GUID: XLtXjQdNmNalfZB6wf2cgwA8s7oZO5Ib X-Proofpoint-ORIG-GUID: h_AJjez83htq012MK8FbFNQmLc-Ifs5N 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.12.28.16 definitions=2024-05-28_04,2024-05-27_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 suspectscore=0 phishscore=0 clxscore=1015 mlxscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 spamscore=0 bulkscore=0 mlxlogscore=763 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405280047 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00, DKIM_INVALID, DKIM_SIGNED, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_MSPIKE_H4, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Hi, This patch adds an optab for __builtin_isnormal. The normal 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 specify acceptable input and output modes for the optab. https://gcc.gnu.org/pipermail/gcc-patches/2024-May/652814.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 isnormal_optab for isnormal builtin gcc/ * builtins.cc (interclass_mathfn_icode): Set optab to isnormal_optab for isnormal builtin. * optabs.def (isnormal_optab): New. * doc/md.texi (isnormal): Document. patch.diff diff --git a/gcc/builtins.cc b/gcc/builtins.cc index b8432f84020..ccd57fce522 100644 --- a/gcc/builtins.cc +++ b/gcc/builtins.cc @@ -2462,6 +2462,7 @@ interclass_mathfn_icode (tree arg, tree fndecl) case BUILT_IN_ISFINITE: builtin_optab = isfinite_optab; break; case BUILT_IN_ISNORMAL: + builtin_optab = isnormal_optab; break; 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 7be0c75baf9..491cd09c620 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -8563,6 +8563,12 @@ Set operand 0 to nonzero if operand 1 is a finite floating point number and to 0 otherwise. Input mode should be a scalar floating point mode and output mode should be @code{SImode}. +@cindex @code{isnormal@var{m}2} instruction pattern +@item @samp{isnormal@var{m}2} +Set operand 0 to nonzero if operand 1 is a normal floating point +number and to 0 otherwise. Input mode should be a scalar floating +point mode and return mode should be @code{SImode}. + @end table @end ifset diff --git a/gcc/optabs.def b/gcc/optabs.def index dcd77315c2a..3c401fc0b4c 100644 --- a/gcc/optabs.def +++ b/gcc/optabs.def @@ -353,6 +353,7 @@ 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 (isnormal_optab, "isnormal$a2") OPTAB_D (issignaling_optab, "issignaling$a2") OPTAB_D (ldexp_optab, "ldexp$a3") OPTAB_D (log10_optab, "log10$a2")