From patchwork Mon May 20 08:15:58 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: 1936961 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=sUqsMeGK; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; 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 [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 4VjVqc2mlSz20KF for ; Mon, 20 May 2024 18:20:12 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 71C473858D33 for ; Mon, 20 May 2024 08:20:10 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 228F83858D20 for ; Mon, 20 May 2024 08:19:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 228F83858D20 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 228F83858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716193174; cv=none; b=gFNeWOqiSJ7XDWeQ3eJO7meIlV6yBlN//MJa4oFi04/D1a02LqMrvJIC27dR/Y5j74Y15Y9CSNLRt4dU+wMamz4ERFhbCH6RnRz01y7tII/CYK6EHPOsimjTi62fysudHPyuABFGiTm/pDXRJS6UvafL24f9QHnOLx3BdCCtugs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716193174; c=relaxed/simple; bh=3q3sSQUdTKP9pncU70M/5icrDaehfI/Pjp8le8jb19U=; h=DKIM-Signature:Message-ID:Date:To:From:Subject:MIME-Version; b=TcPWE6AvQDyVKqU1mCKKQbvMFNRsuOCrElj63yuWZTT2Aub1c8R1ZxzxOMQtomhn7HWWxC5zXlUp276RQjvnuKgGnumhnUa2589f0ycMl3UxoGWDXaoauiounr0S61w/2Reuk0Kk3Q0yHd2GbpfUbZJTgrKde2OLZFbfFToBi2I= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44K7xZdq013560; Mon, 20 May 2024 08:19:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : to : cc : from : subject : content-type : content-transfer-encoding : mime-version; s=pp1; bh=Bhwi6qCUZ1g/7HxECAhZql1Ix5R7gvsjr6+KOfNwhg0=; b=sUqsMeGKx34IaReCsi7UBVq/CZLUeKSSG4FV9lxhqnuih9auXUDOJ7f8nJs0f1cHR3Xl 8wAhRdkZUnSk1JXUjJtftvVXcKQ57c1/HSUtAR6zeNwk7ktJfMgaa+kLA2z5NaNUISbN Gs3EH6ZqnF5AzzUdlBZTd428cOi0N57F/dUiNlH/NFngSs+kF2tF9nCLAcni6HRcEjAo /orBj9L/Y4I/aUkCY9H1UNKGCGTFhFHZq0uSLjrXY24H7PzBpEXW3xozZsFk5qEGNOxG 1nqL/o2wKSHFEjl7YFvoODkm2HTa8tKTJZw3cKgqFntniTXF9zQA2bT42uaJLPuO3w0X cA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3y80w908jc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 May 2024 08:16:08 +0000 Received: from m0353723.ppops.net (m0353723.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 44K8G82f005808; Mon, 20 May 2024 08:16:08 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 3y80w908j9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 May 2024 08:16:08 +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 44K6MrC8026462; Mon, 20 May 2024 08:16:07 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3y785m6k4g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 20 May 2024 08:16:07 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 44K8G1u748300378 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 20 May 2024 08:16:04 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E287A20040; Mon, 20 May 2024 08:16:01 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0760620049; Mon, 20 May 2024 08:15:59 +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:58 +0000 (GMT) Message-ID: Date: Mon, 20 May 2024 16:15:58 +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: [PATCHv2] Optab: add isnormal_optab for __builtin_isnormal X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: nyMPoTjFskHVrAHQ-f0JPKxRkjd0VTaX X-Proofpoint-GUID: q9r0yEVvEx-yBnZd0sQ81VILU995x-4r 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 priorityscore=1501 suspectscore=0 mlxscore=0 lowpriorityscore=0 impostorscore=0 phishscore=0 bulkscore=0 malwarescore=0 clxscore=1015 adultscore=0 spamscore=0 mlxlogscore=718 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405200068 X-Spam-Status: No, score=-12.4 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 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 document isnormal in md.texi. https://gcc.gnu.org/pipermail/gcc-patches/2024-April/649366.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 8ed70b3feea..b81b9dec18a 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -8562,6 +8562,11 @@ This pattern is not allowed to @code{FAIL}. Set operand 0 to nonzero if operand 1 is a finite floating-point number and to 0 otherwise. +@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. + @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")