From patchwork Mon Mar 1 17:51:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raphael M Zinsly X-Patchwork-Id: 1445722 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=Yn3i3Wi2; dkim-atps=neutral Received: from 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dq7B43Czvz9sR4 for ; Tue, 2 Mar 2021 04:51:56 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 48FDF393A435; Mon, 1 Mar 2021 17:51:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 48FDF393A435 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1614621114; bh=dpez5ODDvM10z3FpL9aUdQjE/mheiYOIUWO9TKlVKw0=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Yn3i3Wi2m2kfJIpFpVK1xoFPp19d4WxVFT/VqHevtHaMDd6Gz0t2fVKeYV0u1PbGn mJxUsYT8/tD1BvhJZ2adRLZAzwsHpgJxvnSiYZ3RX+2fon+BeuSX0N7gEgre7ijPxM 7ml78bPekXaSsrYHeLBFZQLVgwPO/h/a09mMpY3M= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id E64193938C1C for ; Mon, 1 Mar 2021 17:51:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E64193938C1C Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 121HWaZC017805 for ; Mon, 1 Mar 2021 12:51:51 -0500 Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0a-001b2d01.pphosted.com with ESMTP id 3712hyx9ga-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 01 Mar 2021 12:51:51 -0500 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 121HkVKj015875 for ; Mon, 1 Mar 2021 17:51:51 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma02dal.us.ibm.com with ESMTP id 3710sqa9gn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 01 Mar 2021 17:51:50 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 121HpnSF11927972 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 1 Mar 2021 17:51:49 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4EE67C6055; Mon, 1 Mar 2021 17:51:49 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BFEE5C605A; Mon, 1 Mar 2021 17:51:48 +0000 (GMT) Received: from localhost (unknown [9.160.75.103]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Mon, 1 Mar 2021 17:51:48 +0000 (GMT) To: libc-alpha@sourceware.org Subject: [PATCH v2 2/3] powerpc: Add optimized llogb* for POWER9 Date: Mon, 1 Mar 2021 14:51:39 -0300 Message-Id: <20210301175140.29109-2-rzinsly@linux.ibm.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210301175140.29109-1-rzinsly@linux.ibm.com> References: <20210301175140.29109-1-rzinsly@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-03-01_12:2021-03-01, 2021-03-01 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 lowpriorityscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 mlxlogscore=879 impostorscore=0 clxscore=1015 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2103010140 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Raphael Moreira Zinsly via Libc-alpha From: Raphael M Zinsly Reply-To: Raphael Moreira Zinsly Cc: murphyp@linux.ibm.com, tuliom@linux.ibm.com, Raphael Moreira Zinsly Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Changes since v1: - Check if the correct GCC version is used. --8<--- The POWER9 builtins used to improve the ilogb* functions can be used in the llogb* functions as well. --- .../powerpc64/le/fpu/w_llogb_template.c | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/w_llogb_template.c diff --git a/sysdeps/powerpc/powerpc64/le/fpu/w_llogb_template.c b/sysdeps/powerpc/powerpc64/le/fpu/w_llogb_template.c new file mode 100644 index 0000000000..4c1642274f --- /dev/null +++ b/sysdeps/powerpc/powerpc64/le/fpu/w_llogb_template.c @@ -0,0 +1,40 @@ +/* The builtins used are only available with GCC 8.0 or newer. */ +#if defined _ARCH_PWR9 && __GNUC_PREREQ (8, 0) +#include +#include +#include +#include +#include + +long int +M_DECL_FUNC (__llogb) (FLOAT x) +{ + int r; + /* Check for exceptional cases. */ + if (! M_SUF(__builtin_test_dc_ilogb) (x, 0x7f)) + r = M_SUF (__builtin_ilogb) (x); + else + /* Fallback to the generic ilogb if x is NaN, Inf or subnormal. */ + r = M_SUF (__ieee754_ilogb) (x); + long int lr = r; + if (__glibc_unlikely (r == FP_ILOGB0) + || __glibc_unlikely (r == FP_ILOGBNAN) + || __glibc_unlikely (r == INT_MAX)) + { +#if LONG_MAX != INT_MAX + if (r == FP_ILOGB0) + lr = FP_LLOGB0; + else if (r == FP_ILOGBNAN) + lr = FP_LLOGBNAN; + else + lr = LONG_MAX; +#endif + __set_errno (EDOM); + __feraiseexcept (FE_INVALID); + } + return lr; +} +declare_mgen_alias (__llogb, llogb) +#else +#include +#endif