From patchwork Wed May 29 06:36:41 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: 1940958 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=LM4jBHJW; 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 4Vq0kT2yt8z20Pc for ; Wed, 29 May 2024 17:04:49 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A15BC3870C17 for ; Wed, 29 May 2024 07:04:47 +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 7894E3870C03 for ; Wed, 29 May 2024 07:04:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7894E3870C03 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 7894E3870C03 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=1716966267; cv=none; b=od3FC0h2vuusGNCTVwoBJltor0PebEx6OJ0vK17EXZ9Iq4SVwnZLAcvhdmmGa+wtHdi0zyvs1Vh2/UTg0tQVd40rK/NsreCIDm9gh4yh/y8yMsRhkro/USnK5P8AOKxVMpaQhPhA50l/qLhQ3fMcOFtYXg7RO9FlEmWpXNeRLzk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716966267; c=relaxed/simple; bh=iiy2igxhiSRoG8LobqHppN1XNe0VETRwHc6AoIotx3U=; h=DKIM-Signature:Message-ID:Date:To:From:Subject:MIME-Version; b=NUGCGGsPwjPNgQPEf2C46fcpcKPc+5/kdtfSiugCI2ptG+qjoNR+0Zgf/dMPlDQN5v+mYEnueqxDYd0Y8nQLYeKoYlaHO6Q2JzEPXIRn/YmFq/dmKi6eAfS0Jfda+1zOBSt51tOgW7JQLnwE2bGhLusf0Ui1OiAlorbLfVq8LHo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44T6sPUJ025169; Wed, 29 May 2024 07:04:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc : content-transfer-encoding : content-type : date : from : message-id : mime-version : subject : to; s=pp1; bh=haXBhAsmK1xS/IqSsF0hRYpnQtySWdn8Nza4VI51zsw=; b=LM4jBHJWedw2Iec8qbl/etm2GLjliC4E+Ix40Y9wzSDT1VmkBfYZKatgCHzoF/X1m0+c f+2Eh7BYmSUJ7lRBbjMRC0BFNaIbOMbQKe8OyCQKxBtvZTnQ5rY+51AB77XMW1b0SKrm 3fKNw7CNKLVLD3jOsU+Ara5UojVoIZKeht7/4soWPHnQAAZGLiV+gPIZFlNQ6KaKKdwT JWrBFD/3diW8Hn2oN5Q5vz3DCUAx47NL3CD+zjM0eMGcoEKUhzVvwCMD3ZfUDhMOypiH Y2llzL0iECb+VerMLamZTRjz5D7ccz9iSkXKNP5ZbTJ+eUX/MnD0HsLRQ57zjI+xWHeL CA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ydyfxr12q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 May 2024 07:04:21 +0000 Received: from m0353722.ppops.net (m0353722.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 44T74LL3009357; Wed, 29 May 2024 07:04:21 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ydyfxr12b-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 May 2024 07:04:21 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 44T46nTb002371; Wed, 29 May 2024 06:36:51 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3ydpb0jacb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 May 2024 06:36:51 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 44T6ajTj18940414 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 May 2024 06:36:47 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A58FE2004D; Wed, 29 May 2024 06:36:45 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6EB0E20040; Wed, 29 May 2024 06:36:43 +0000 (GMT) Received: from [9.200.103.244] (unknown [9.200.103.244]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 29 May 2024 06:36:43 +0000 (GMT) Message-ID: <1a0ffcad-f455-472c-90b7-0c712896837f@linux.ibm.com> Date: Wed, 29 May 2024 14:36:41 +0800 User-Agent: Mozilla Thunderbird Content-Language: en-US To: gcc-patches Cc: Segher Boessenkool , David , "Kewen.Lin" , Peter Bergner , Andrew Pinski , Richard Biener , Richard Sandiford From: HAO CHEN GUI Subject: [PATCHv5] Optab: add isnormal_optab for __builtin_isnormal X-TM-AS-GCONF: 00 X-Proofpoint-GUID: -Vs04MVFCjCVuRiSedUInW-SoDInjGgx X-Proofpoint-ORIG-GUID: PO7XnqxWeAfo9wRDpEgTlZZyNyehqvnj 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_14,2024-05-28_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 adultscore=0 malwarescore=0 suspectscore=0 mlxlogscore=606 impostorscore=0 priorityscore=1501 bulkscore=0 mlxscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405290044 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, 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 return value of the optab should be either 0 or 1. https://gcc.gnu.org/pipermail/gcc-patches/2024-May/652865.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 53e9d210541..89ba56abf17 100644 --- a/gcc/builtins.cc +++ b/gcc/builtins.cc @@ -2463,6 +2463,8 @@ interclass_mathfn_icode (tree arg, tree fndecl) 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 3eb4216141e..4fd7da095fe 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -8563,6 +8563,12 @@ Return 1 if operand 1 is a finite floating point number and 0 otherwise. @var{m} is a scalar floating point mode. Operand 0 has mode @code{SImode}, and operand 1 has mode @var{m}. +@cindex @code{isnormal@var{m}2} instruction pattern +@item @samp{isnormal@var{m}2} +Return 1 if operand 1 is a normal floating point number and 0 +otherwise. @var{m} is a scalar floating point mode. Operand 0 +has mode @code{SImode}, and operand 1 has mode @var{m}. + @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")