From patchwork Mon May 4 22:23:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. Murphy" X-Patchwork-Id: 38912 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 77C873938C05; Mon, 4 May 2020 22:24:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 77C873938C05 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1588631042; bh=aTHhd39bU019AynzJcySAo+sdByDQO7fUArbmNDwjI0=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=mwM0lmaE/K01yyZpLPWznI+LOYTarA94n6cs7s9IovAL4dhAJpjNrcdh0GYMEE9Vv 2H73/uH39LhVubJ3BsA5qSideWgczU9Vnycv4TQSoy0G3r5e6MtK03jv9jBwAQ3JCL 7GQG3+ExMacS/D90GT8+Kf+sk3C9ji7/294JRkkE= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id AF21F3851C32 for ; Mon, 4 May 2020 22:23:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AF21F3851C32 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 044M1J9F143443 for ; Mon, 4 May 2020 18:23:56 -0400 Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0b-001b2d01.pphosted.com with ESMTP id 30s2g27538-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 04 May 2020 18:23:56 -0400 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 044MKtds000843 for ; Mon, 4 May 2020 22:23:55 GMT Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by ppma02wdc.us.ibm.com with ESMTP id 30s0g6c4ch-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 04 May 2020 22:23:55 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 044MNsoj58982746 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 4 May 2020 22:23:55 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E038B7805C for ; Mon, 4 May 2020 22:23:54 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8115E7805F for ; Mon, 4 May 2020 22:23:54 +0000 (GMT) Received: from brokenarrow.ibmuc.com (unknown [9.85.137.49]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP for ; Mon, 4 May 2020 22:23:54 +0000 (GMT) To: libc-alpha@sourceware.org Subject: [PATCH 1/4] ldbl-128: refactor nexttoward alias using new macro Date: Mon, 4 May 2020 17:23:50 -0500 Message-Id: X-Mailer: git-send-email 2.21.1 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-05-04_11:2020-05-04, 2020-05-04 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 suspectscore=4 bulkscore=0 priorityscore=1501 spamscore=0 lowpriorityscore=0 adultscore=0 phishscore=0 mlxlogscore=927 clxscore=1015 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2005040169 X-Spam-Status: No, score=-20.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, 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: "Paul E. Murphy via Libc-alpha" From: "Paul E. Murphy" Reply-To: "Paul E. Murphy" Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" A new macro, libm_alias_exclusive_ldouble, is added to expose an aliased symbol which should only be defined for the long double type. This enables a more controlled mechanism to define aliases when long double may be aliased from _Float128, and the removal of the almost trivial s_nextafterf128.c sitting in ldbl-128ibm-compat. --- sysdeps/generic/libm-alias-ldouble.h | 6 ++++++ sysdeps/ieee754/float128/float128_private.h | 4 ++++ sysdeps/ieee754/ldbl-128/s_nextafterl.c | 3 +-- .../ldbl-128ibm-compat/libm-alias-float128.h | 5 +++++ .../ldbl-128ibm-compat/s_nextafterf128.c | 20 ------------------- 5 files changed, 16 insertions(+), 22 deletions(-) delete mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/s_nextafterf128.c diff --git a/sysdeps/generic/libm-alias-ldouble.h b/sysdeps/generic/libm-alias-ldouble.h index 724a121792..8cd454dc9b 100644 --- a/sysdeps/generic/libm-alias-ldouble.h +++ b/sysdeps/generic/libm-alias-ldouble.h @@ -62,4 +62,10 @@ /* Likewise, but without the R suffix. */ #define libm_alias_ldouble(from, to) libm_alias_ldouble_r (from, to, ) +/* Generate symbols which are defined for long double types, but are + not defined for _FloatX types. e.g nextafterl and nexttowardl. */ +#define libm_alias_exclusive_ldouble(from, to) \ + strong_alias (from ## l, __ ## to ## l) \ + weak_alias (__ ## to ## l, to ## l) + #endif diff --git a/sysdeps/ieee754/float128/float128_private.h b/sysdeps/ieee754/float128/float128_private.h index f97463d9dc..5e5f9cc009 100644 --- a/sysdeps/ieee754/float128/float128_private.h +++ b/sysdeps/ieee754/float128/float128_private.h @@ -128,6 +128,10 @@ #include +/* Define here to allow float128 to ldbl redirects to redefine. */ +#undef libm_alias_exclusive_ldouble +#define libm_alias_exclusive_ldouble(from, to) + #include #undef libm_alias_ldouble_r #define libm_alias_ldouble_r(from, to, r) libm_alias_float128_r (from, to, r) diff --git a/sysdeps/ieee754/ldbl-128/s_nextafterl.c b/sysdeps/ieee754/ldbl-128/s_nextafterl.c index 60fdae648f..8d4abacb0d 100644 --- a/sysdeps/ieee754/ldbl-128/s_nextafterl.c +++ b/sysdeps/ieee754/ldbl-128/s_nextafterl.c @@ -84,5 +84,4 @@ _Float128 __nextafterl(_Float128 x, _Float128 y) return x; } libm_alias_ldouble (__nextafter, nextafter) -strong_alias (__nextafterl, __nexttowardl) -weak_alias (__nextafterl, nexttowardl) +libm_alias_exclusive_ldouble (__nextafter, nexttoward) diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/libm-alias-float128.h b/sysdeps/ieee754/ldbl-128ibm-compat/libm-alias-float128.h index 48c6f9e729..66d2771291 100644 --- a/sysdeps/ieee754/ldbl-128ibm-compat/libm-alias-float128.h +++ b/sysdeps/ieee754/ldbl-128ibm-compat/libm-alias-float128.h @@ -61,4 +61,9 @@ /* Likewise, but without the R suffix. */ #define libm_alias_float128(from, to) libm_alias_float128_r (from, to, ) +/* Generate symbols for exclusive ldouble symbols not defined for _Float128. */ +#undef libm_alias_exclusive_ldouble +#define libm_alias_exclusive_ldouble(from, to) \ + libm_alias_float128_other_r_ldbl(from, to,) + #endif diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/s_nextafterf128.c b/sysdeps/ieee754/ldbl-128ibm-compat/s_nextafterf128.c deleted file mode 100644 index cc30ae02d7..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm-compat/s_nextafterf128.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Provide nexttowardl and nextafterl implementations for IEEE long double. - Copyright (C) 2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ -#include "../float128/s_nextafterf128.c" - -strong_alias (__nextafterieee128, __nexttowardieee128) From patchwork Mon May 4 22:23:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. Murphy" X-Patchwork-Id: 38911 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DE0CE3897836; Mon, 4 May 2020 22:24:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DE0CE3897836 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1588631041; bh=fb0SjZZH4+XgZGtlL8MXN/iDNxbR69CYP+AgY0Mc9ig=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=TKSY/WmlAIDV8BU7khykREurFLzKdQR1KbVunf8SZPUqFfjDmszmsageaohovgY+y y4ufezgYmJLO0n+97s7S42P8ezbFA7ODJSzlU1zFy3rEXCyfo3NYEjB3JpTCwCGObJ PZwCPixIghlMW/Gvon5+CTt8Djt6yBZYyKW1msjA= 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 C75313893671 for ; Mon, 4 May 2020 22:23:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C75313893671 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 044M39ur153853 for ; Mon, 4 May 2020 18:23:57 -0400 Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com with ESMTP id 30sp8j5khk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 04 May 2020 18:23:57 -0400 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 044MNQxE006050 for ; Mon, 4 May 2020 22:23:56 GMT Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by ppma03wdc.us.ibm.com with ESMTP id 30s0g6m4df-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 04 May 2020 22:23:56 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 044MNtWf19726746 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 4 May 2020 22:23:55 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 850ED78068 for ; Mon, 4 May 2020 22:23:55 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 213C278063 for ; Mon, 4 May 2020 22:23:55 +0000 (GMT) Received: from brokenarrow.ibmuc.com (unknown [9.85.137.49]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP for ; Mon, 4 May 2020 22:23:54 +0000 (GMT) To: libc-alpha@sourceware.org Subject: [PATCH 2/4] powerpc64le: refactor e_sqrtf128.c Date: Mon, 4 May 2020 17:23:51 -0500 Message-Id: <6a73737db700dca0aea859a34e1df95a42d25b28.1588628261.git.murphyp@linux.vnet.ibm.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: References: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-05-04_11:2020-05-04, 2020-05-04 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 malwarescore=0 suspectscore=0 priorityscore=1501 spamscore=0 clxscore=1015 mlxscore=0 lowpriorityscore=0 mlxlogscore=999 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2005040169 X-Spam-Status: No, score=-20.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, 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: "Paul E. Murphy via Libc-alpha" From: "Paul E. Murphy" Reply-To: "Paul E. Murphy" Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Combine both implementations into a single file to allow building twice with appropriate multiarch support when possible. Likewise, this maintains the existing optimal behavior when building with a power9 or newer cpu. --- sysdeps/powerpc/powerpc64/le/fpu/e_sqrtf128.c | 8 +++- .../powerpc64/le/power9/fpu/e_sqrtf128.c | 38 ------------------- 2 files changed, 7 insertions(+), 39 deletions(-) delete mode 100644 sysdeps/powerpc/powerpc64/le/power9/fpu/e_sqrtf128.c diff --git a/sysdeps/powerpc/powerpc64/le/fpu/e_sqrtf128.c b/sysdeps/powerpc/powerpc64/le/fpu/e_sqrtf128.c index 950bdad54a..fac8def02a 100644 --- a/sysdeps/powerpc/powerpc64/le/fpu/e_sqrtf128.c +++ b/sysdeps/powerpc/powerpc64/le/fpu/e_sqrtf128.c @@ -26,6 +26,7 @@ License along with the GNU C Library; if not, see . */ +#include #include #include @@ -42,16 +43,21 @@ __float128 __ieee754_sqrtf128 (__float128 a) { + __float128 r; + /* For multiarch builds, this will be built twice. */ +#ifndef _ARCH_PWR9 FP_DECL_EX; FP_DECL_Q (A); FP_DECL_Q (R); - __float128 r; FP_INIT_ROUNDMODE; FP_UNPACK_Q (A, a); FP_SQRT_Q (R, A); FP_PACK_Q (r, R); FP_HANDLE_EXCEPTIONS; +#else + asm ("xssqrtqp %0,%1" : "=v" (r) : "v" (a)); +#endif return r; } libm_alias_finite (__ieee754_sqrtf128, __sqrtf128) diff --git a/sysdeps/powerpc/powerpc64/le/power9/fpu/e_sqrtf128.c b/sysdeps/powerpc/powerpc64/le/power9/fpu/e_sqrtf128.c deleted file mode 100644 index 232fc773c3..0000000000 --- a/sysdeps/powerpc/powerpc64/le/power9/fpu/e_sqrtf128.c +++ /dev/null @@ -1,38 +0,0 @@ -/* POWER9 sqrt for _Float128 - Return sqrt(a) - Copyright (C) 2017-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file into - combinations with other programs, and to distribute those - combinations without any restriction coming from the use of this - file. (The Lesser General Public License restrictions do apply in - other respects; for example, they cover modification of the file, - and distribution when not linked into a combine executable.) - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include - -__float128 -__ieee754_sqrtf128 (__float128 a) -{ - __float128 z; - asm ("xssqrtqp %0,%1" : "=v" (z) : "v" (a)); - return z; -} -libm_alias_finite (__ieee754_sqrtf128, __sqrtf128) From patchwork Mon May 4 22:23:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. Murphy" X-Patchwork-Id: 38913 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0813B3851C32; Mon, 4 May 2020 22:24:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0813B3851C32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1588631043; bh=M3YE59uo8cxExd6a8oj0GhL6jQp7WnadjiCzs24dL54=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=FHEFt+0A/Au8ellWGS32qEsm/TWakir9voLbkd+HarvU2GMGH8bLA0Lv/PP3XN/je zp414xVbBO99QPye21Y46iQxzyN98pdkybaYEnbEvpd2XwD5C0XM9vNCNPrvHIPmZV 0/yZU0HylLGZ2nixdzfgvBbUDGb5v/1briajuEic= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 199B63894E52 for ; Mon, 4 May 2020 22:23:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 199B63894E52 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 044M3H0g009107 for ; Mon, 4 May 2020 18:23:58 -0400 Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0a-001b2d01.pphosted.com with ESMTP id 30s4gua574-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 04 May 2020 18:23:58 -0400 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 044MKuwQ001846 for ; Mon, 4 May 2020 22:23:57 GMT Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by ppma04dal.us.ibm.com with ESMTP id 30s0g6h6mq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 04 May 2020 22:23:57 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 044MNtUQ30212566 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 4 May 2020 22:23:55 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 274987805C for ; Mon, 4 May 2020 22:23:56 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C429178060 for ; Mon, 4 May 2020 22:23:55 +0000 (GMT) Received: from brokenarrow.ibmuc.com (unknown [9.85.137.49]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP for ; Mon, 4 May 2020 22:23:55 +0000 (GMT) To: libc-alpha@sourceware.org Subject: [PATCH 3/4] powerpc64le: refactor fmaf128 Date: Mon, 4 May 2020 17:23:52 -0500 Message-Id: <5c075c3c7211661595f66463f992475efbeac8c4.1588628261.git.murphyp@linux.vnet.ibm.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: References: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-05-04_11:2020-05-04, 2020-05-04 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 lowpriorityscore=0 mlxlogscore=999 clxscore=1015 bulkscore=0 mlxscore=0 priorityscore=1501 malwarescore=0 phishscore=0 spamscore=0 impostorscore=0 suspectscore=1 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2005040172 X-Spam-Status: No, score=-20.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_NUMSUBJECT, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, 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: "Paul E. Murphy via Libc-alpha" From: "Paul E. Murphy" Reply-To: "Paul E. Murphy" Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Use the compiler hint to determine if this can be inlined. This should work for any supported GCC which inlines fma. Likewise, it prepares for a more generic multiarch _Float128 implementation of libm. --- .../powerpc64/le/fpu/multiarch/s_fmaf128-power9.c | 2 +- .../powerpc64/le/fpu/multiarch/s_fmaf128-ppc64.c | 2 +- .../powerpc64/le/{power9 => }/fpu/s_fmaf128.c | 13 ++++++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) rename sysdeps/powerpc/powerpc64/le/{power9 => }/fpu/s_fmaf128.c (89%) diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/s_fmaf128-power9.c b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/s_fmaf128-power9.c index 8df77ceade..98d4107429 100644 --- a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/s_fmaf128-power9.c +++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/s_fmaf128-power9.c @@ -23,4 +23,4 @@ #define __fmaf128 __fmaf128_power9 -#include +#include diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/s_fmaf128-ppc64.c b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/s_fmaf128-ppc64.c index ab0c4d03a8..405e287ff3 100644 --- a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/s_fmaf128-ppc64.c +++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/s_fmaf128-ppc64.c @@ -23,4 +23,4 @@ #define __fmaf128 __fmaf128_ppc64 -#include +#include diff --git a/sysdeps/powerpc/powerpc64/le/power9/fpu/s_fmaf128.c b/sysdeps/powerpc/powerpc64/le/fpu/s_fmaf128.c similarity index 89% rename from sysdeps/powerpc/powerpc64/le/power9/fpu/s_fmaf128.c rename to sysdeps/powerpc/powerpc64/le/fpu/s_fmaf128.c index f02e810fb9..e0173fff4e 100644 --- a/sysdeps/powerpc/powerpc64/le/power9/fpu/s_fmaf128.c +++ b/sysdeps/powerpc/powerpc64/le/fpu/s_fmaf128.c @@ -25,12 +25,19 @@ License along with the GNU C Library; if not, see . */ +#ifdef __FP_FAST_FMAF128 +#include #include -__float128 -__fmaf128 (__float128 x, __float128 y, __float128 z) +_Float128 +__fmaf128 (_Float128 x, _Float128 y, _Float128 z) { return x * y + z; } - libm_alias_float128 (__fma, fma) + +#else + +#include + +#endif From patchwork Mon May 4 22:23:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. Murphy" X-Patchwork-Id: 38914 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3072E3897824; Mon, 4 May 2020 22:24:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3072E3897824 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1588631046; bh=kjdix8Dr9BGrmKF1y40+AVQ4GidqiG9Ha2K2X0wF4nw=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=mYSDtX+4LY/R/4aY7alkV+OkoMWohtMC3S4ti4QxM2mp312nJoDuEJDl0BRK/McPx OXnM96UllqBlHkGaCXF0ZNq843dWJs/HGOBbF1nLls70lEevA5JrmKsyOo0HkkWUP3 6PxORuDXrZGEBGwcLjVbs3RBS2WhIB003h+k9X9I= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 75B193897824 for ; Mon, 4 May 2020 22:23:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 75B193897824 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 044M1sh9028446 for ; Mon, 4 May 2020 18:23:59 -0400 Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0a-001b2d01.pphosted.com with ESMTP id 30s4v7bw22-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 04 May 2020 18:23:58 -0400 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 044MKuK5009763 for ; Mon, 4 May 2020 22:23:58 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma04wdc.us.ibm.com with ESMTP id 30s0g6m309-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 04 May 2020 22:23:58 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 044MNuMj12255564 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 4 May 2020 22:23:56 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1920A7805C for ; Mon, 4 May 2020 22:23:57 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5CC7078060 for ; Mon, 4 May 2020 22:23:56 +0000 (GMT) Received: from brokenarrow.ibmuc.com (unknown [9.85.137.49]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP for ; Mon, 4 May 2020 22:23:56 +0000 (GMT) To: libc-alpha@sourceware.org Subject: [PATCH 4/4] powerpc64le: ifunc (almost) all *f128 routines in multiarch mode Date: Mon, 4 May 2020 17:23:53 -0500 Message-Id: <85f946d6be11c064d5da352b245a9cbb28d0a639.1588628261.git.murphyp@linux.vnet.ibm.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: References: MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-05-04_11:2020-05-04, 2020-05-04 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 suspectscore=0 adultscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 mlxscore=0 mlxlogscore=999 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2005040169 X-Spam-Status: No, score=-20.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, 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: "Paul E. Murphy via Libc-alpha" From: "Paul E. Murphy" Reply-To: "Paul E. Murphy" Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Programatically generate simple wrappers for most libm *f128 objects and a set of ifunc objects to unify them. A second set of implementation files are generated which simply include the first implementation encountered along the search path. This usually works, excepting when a wrapper is overriden and makefile search order slightly diverges from include order. A set of additional headers are included which primarily rely on asm redirects to rename, and less frequently macro renames where an asm redirect is not possible. These intercept several common headers to install redirect and disable macros at specific times. This works surprisingly well. Notably, some ugliness occurs when header inclusion must be coerced at certain times before turning off aliasing and plt bypass wrappers. Notably, the only special case is s_significandf128.c. It is doubly special as exists to support ldouble redirects, and exposes subtle difference between makefile rules and search path orders. Commentary is inlined. Admittedly, this makes shared maintenance a tiny bit more difficult, but lays groundwork for supporting more optimized float128 routines which very overtly assume a soft-fp runtime. Changes to internal float128 API should fail at compile time, thus build-many-glibcs.py should readily catch any divergence. Finally, don't build this support if requested CPU is newer than power8. --- .../powerpc64/le/fpu/multiarch/Makefile | 103 +++++++++- .../le/fpu/multiarch/float128-ifunc-macros.h | 71 +++++++ .../multiarch/float128-ifunc-redirects-mp.h | 68 +++++++ .../fpu/multiarch/float128-ifunc-redirects.h | 40 ++++ .../le/fpu/multiarch/float128-ifunc.c | 63 ++++++ .../le/fpu/multiarch/float128-ifunc.h | 183 ++++++++++++++++++ .../le/fpu/multiarch/float128_private.h | 136 +++++++++++++ .../fpu/multiarch/math-type-macros-float128.h | 129 ++++++++++++ .../powerpc64/le/fpu/multiarch/math_private.h | 14 ++ .../le/fpu/multiarch/s_fmaf128-power9.c | 26 --- .../le/fpu/multiarch/s_fmaf128-ppc64.c | 26 --- .../powerpc64/le/fpu/multiarch/s_fmaf128.c | 36 ---- .../le/fpu/multiarch/w_sqrtf128-power9.c | 35 ---- .../le/fpu/multiarch/w_sqrtf128-ppc64le.c | 35 ---- .../powerpc64/le/fpu/multiarch/w_sqrtf128.c | 31 --- 15 files changed, 801 insertions(+), 195 deletions(-) create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc-macros.h create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc-redirects-mp.h create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc-redirects.h create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc.c create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc.h create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128_private.h create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/multiarch/math-type-macros-float128.h create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/multiarch/math_private.h delete mode 100644 sysdeps/powerpc/powerpc64/le/fpu/multiarch/s_fmaf128-power9.c delete mode 100644 sysdeps/powerpc/powerpc64/le/fpu/multiarch/s_fmaf128-ppc64.c delete mode 100644 sysdeps/powerpc/powerpc64/le/fpu/multiarch/s_fmaf128.c delete mode 100644 sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128-power9.c delete mode 100644 sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128-ppc64le.c delete mode 100644 sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128.c diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile index 8747b02127..c79fc497cf 100644 --- a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile +++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile @@ -1,10 +1,101 @@ ifeq ($(subdir),math) -libm-sysdep_routines += s_fmaf128-ppc64 s_fmaf128-power9 \ - w_sqrtf128-power9 w_sqrtf128-ppc64le +# Only enable this for generic (P8 or older) multiarch builds +ifeq ($(cflags-cpu),"") +do_f128_multiarch = yes +else ifneq ($(filter %power8,$(cflags-cpu)),) +do_f128_multiarch = yes +endif +ifeq ($(do_f128_multiarch),yes) + +gen-libm-all-f128-ifunc-calls = \ + $(strip $(subst F,$(type-float128-suffix),$(libm-calls)) \ + $(foreach f,$(libm-narrow-fns),$(subst F,$(f),$(libm-narrow-types-float128-yes))) \ + $(type-float128-routines)) + +# Some functions are not trivial to ifunc today without some extensive refactoring. +# totalorder{,mag} have no benefit to native IEEE support and have complex versioning requirements. +# Likewise, tables require no special treatment. +gen-libm-f128-no-ifunc-calls := s_totalorderf128 s_totalordermagf128 t_sincosf128 +gen-libm-f128-ifunc-calls = $(filter-out $(gen-libm-f128-no-ifunc-calls),$(gen-libm-all-f128-ifunc-calls)) + +f128-march-routines-p9 = $(addsuffix -power9,$(gen-libm-f128-ifunc-calls)) +f128-march-routines-ifunc = $(addsuffix -ifunc,$(gen-libm-f128-ifunc-calls)) +f128-march-routines = $(f128-march-routines-p9) $(f128-march-routines-ifunc) +f128-march-cpus = power9 + +libm-routines += $(f128-march-routines) float128-ifunc +generated += $(f128-march-routines) + +# These can't be easily IFUNC'ed today. +CPPFLAGS-s_totalorderf128.c += -D_F128_DISABLE_IFUNC +CPPFLAGS-s_totalordermagf128.c += -D_F128_DISABLE_IFUNC +CPPFLAGS-float128-ifunc.c += -D_F128_DISABLE_IFUNC + +CFLAGS-float128-ifunc.c += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS) + +# Copy special CFLAGS for some functions +CFLAGS-m_modff128-power9.c += -fsignaling-nans + +# Generate wrapper objects for each machine, +# and a separate ifunc wrapper. Likewise substitute +# m_%.c files should include s_%.c to match common libm rules. +$(objpfx)gen-float128-ifuncs.stmp: Makefile + $(make-target-directory) + for gcall in $(gen-libm-f128-ifunc-calls); do \ + ifile="$${gcall}"; \ + if [ $${gcall##m_} != $${gcall} ]; then \ + ifile="s_$${gcall##m_}"; \ + fi; \ + for cpu in $(f128-march-cpus); do \ + file=$(objpfx)$${gcall}-$${cpu}.c; \ + ( \ + echo "#include <$${ifile}.c>"; \ + ) > $${file}; \ + done; \ + \ + name="$${gcall##?_}"; \ + pfx="$${gcall%%_*}"; \ + R=""; \ + r=""; \ + if [ $${gcall##m_} != $${gcall} ]; then \ + pfx="s"; \ + fi; \ + if [ $${#pfx} != 1 ]; then \ + pfx=""; \ + else \ + pfx="_$${pfx}"; \ + fi; \ + if [ $${name%%_r} != $${name} ]; then \ + R="_R"; \ + r="_r"; \ + name="$${name%%_r}"; \ + fi; \ + name="$${name%%f128}"; \ + decl="DECL_ALIAS$${pfx}_$${name}$${r}"; \ + declc="DECL_ALIAS$${R}$${pfx}"; \ + ( \ + echo "#include "; \ + echo "#ifndef $${decl}"; \ + echo "# define $${decl}(f) $${declc} (f)"; \ + echo "#endif"; \ + echo "$${decl} ($${name});"; \ + ) > $(objpfx)$${gcall}-ifunc.c; \ + done; \ + echo > $(@) + +$(foreach f,$(f128-march-routines),$(objpfx)$(f).c): $(objpfx)gen-float128-ifuncs.stmp + +include $(o-iterator) +define o-iterator-doit +$(foreach f,$(f128-march-routines-p9),$(objpfx)$(f)$(o)): sysdep-CFLAGS += -mcpu=power9 $$(type-float128-CFLAGS) $$(no-gnu-attributes-CFLAGS) +endef +object-suffixes-left := $(all-object-suffixes) +include $(o-iterator) + +else -CFLAGS-s_fmaf128-ppc64.c += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS) -CFLAGS-s_fmaf128-power9.c += $(type-float128-CFLAGS) -mcpu=power9 $(no-gnu-attribute-CFLAGS) +# Minimum CPU is more than POWER9, this support is not needed. +math-CPPFLAGS += -D_F128_DISABLE_IFUNC -CFLAGS-w_sqrtf128-ppc64le.c += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS) -CFLAGS-w_sqrtf128-power9.c += $(type-float128-CFLAGS) -mcpu=power9 $(no-gnu-attribute-CFLAGS) +endif # do_f128_multiarch endif diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc-macros.h b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc-macros.h new file mode 100644 index 0000000000..4a42646d61 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc-macros.h @@ -0,0 +1,71 @@ +/* _Float128 aliasing macro support for ifunc generation on PPC. + Copyright (C) 2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _FLOAT128_IFUNC_MACROS_PPC64LE +#define _FLOAT128_IFUNC_MACROS_PPC64LE 1 + +/* Bring in the various alias providing headers, and disable + those used for _Float128. We will carefully supply these + in a more controlled mannder via float128-ifunc.c */ +#include +#include +#include + +#undef libm_alias_float32_float128 +#undef libm_alias_float64_float128 +#undef libm_alias_float64x_float128 +#undef libm_alias_float128_r +#undef libm_alias_finite +#undef libm_alias_exclusive_ldouble +#undef libm_alias_float128_other_r_ldbl +#undef declare_mgen_finite_alias +#undef declare_mgen_alias +#undef declare_mgen_alias_r + +#define libm_alias_finite(from, to) +#define libm_alias_float128_r(from, to, r) +#define libm_alias_float32_float128(func) +#define libm_alias_float64_float128(func) +#define libm_alias_float64x_float128(func) +#define libm_alias_exclusive_ldouble(from, to) +#define libm_alias_float128_other_r_ldbl(from, to, r) +#define declare_mgen_finite_alias(from, to) +#define declare_mgen_alias(from, to) +#define declare_mgen_alias_r(from, to) + +/* Likewise, no need for most hidden symbols. Disable these + to avoid complications. */ +#undef mathx_hidden_def +#define mathx_hidden_def(func) +#undef libm_hidden_def +#define libm_hidden_def(func) +#undef libm_hidden_proto +#define libm_hidden_proto(f) + +/* And some shared helper macros. */ +#ifndef _ARCH_PWR9 +#define F128_REDIR_PFX_R(func, pfx, r) extern __typeof(func ## r) func ## r __asm( #pfx #func "_power8" #r ); +#define F128_SFX_APPEND(x) x ## _power8 +#else +#define F128_REDIR_PFX_R(func, pfx, r) extern __typeof(func ## r) func ## r __asm( #pfx #func "_power9" #r ); +#define F128_SFX_APPEND(x) x ## _power9 +#endif +#define F128_REDIR_R(func,r) F128_REDIR_PFX_R (func, , r) +#define F128_REDIR(func) F128_REDIR_R (func, ) + +#endif /* _FLOAT128_IFUNC_MACROS_PPC64LE */ diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc-redirects-mp.h b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc-redirects-mp.h new file mode 100644 index 0000000000..fd13bd15df --- /dev/null +++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc-redirects-mp.h @@ -0,0 +1,68 @@ +/* _Float128 multiarch redirects shared with math_private.h + Copyright (C) 2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifdef _ARCH_PWR9 +# define MA_VARIANT "_power9" +#else +# define MA_VARIANT "_power8" +#endif +#define F128_MP_REDIR_R(f, r) extern __typeof (f ## r) f ## r asm (#f MA_VARIANT #r); +#define F128_MP_REDIR(f) F128_MP_REDIR_R (f,) + +F128_MP_REDIR (__ieee754_acosf128) +F128_MP_REDIR (__ieee754_acoshf128) +F128_MP_REDIR (__ieee754_asinf128) +F128_MP_REDIR (__ieee754_atan2f128) +F128_MP_REDIR (__ieee754_atanhf128) +F128_MP_REDIR (__ieee754_coshf128) +F128_MP_REDIR (__ieee754_expf128) +F128_MP_REDIR (__ieee754_exp10f128) +F128_MP_REDIR (__ieee754_exp2f128) +F128_MP_REDIR (__ieee754_fmodf128) +F128_MP_REDIR (__ieee754_gammaf128) +F128_MP_REDIR_R (__ieee754_gammaf128, _r) +F128_MP_REDIR (__ieee754_hypotf128) +F128_MP_REDIR (__ieee754_j0f128) +F128_MP_REDIR (__ieee754_j1f128) +F128_MP_REDIR (__ieee754_jnf128) +F128_MP_REDIR (__ieee754_lgammaf128) +F128_MP_REDIR_R (__ieee754_lgammaf128, _r) +F128_MP_REDIR (__ieee754_logf128) +F128_MP_REDIR (__ieee754_log10f128) +F128_MP_REDIR (__ieee754_log2f128) +F128_MP_REDIR (__ieee754_powf128) +F128_MP_REDIR (__ieee754_remainderf128) +F128_MP_REDIR (__ieee754_sinhf128) +F128_MP_REDIR (__ieee754_sqrtf128) +F128_MP_REDIR (__ieee754_y0f128) +F128_MP_REDIR (__ieee754_y1f128) +F128_MP_REDIR (__ieee754_ynf128) +F128_MP_REDIR (__ieee754_scalbf128) +F128_MP_REDIR (__ieee754_ilogbf128) +F128_MP_REDIR (__ieee754_rem_pio2f128) +F128_MP_REDIR (__kernel_sinf128) +F128_MP_REDIR (__kernel_cosf128) +F128_MP_REDIR (__kernel_tanf128) +F128_MP_REDIR (__kernel_sincosf128) +F128_MP_REDIR (__kernel_rem_pio2f128) +F128_MP_REDIR (__x2y2m1f128) +F128_MP_REDIR (__gamma_productf128) +F128_MP_REDIR (__lgamma_negf128) + +#undef F128_MP_REDIR +#undef F128_MP_REDIR_R diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc-redirects.h b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc-redirects.h new file mode 100644 index 0000000000..88b71558b0 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc-redirects.h @@ -0,0 +1,40 @@ +/* _Float128 redirects for ppc64le multiarch env. + Copyright (C) 2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _FLOAT128_IFUNC_REDIRECTS +#define _FLOAT128_IFUNC_REDIRECTS 1 + +#include + +F128_REDIR_PFX_R (sqrtf128, __,); +F128_REDIR_PFX_R (rintf128, __,); +F128_REDIR_PFX_R (ceilf128, __,); +F128_REDIR_PFX_R (floorf128, __,); +F128_REDIR_PFX_R (truncf128, __,); +F128_REDIR_PFX_R (roundf128, __,); +F128_REDIR_PFX_R (fabsf128, __,); +F128_REDIR (__issignalingf128) + +extern __typeof (ldexpf128) F128_SFX_APPEND (__ldexpf128); + +#define __isinff128 F128_SFX_APPEND (__isinff128) +#define __isnanf128 F128_SFX_APPEND (__isnanf128) +#define __finitef128 F128_SFX_APPEND (__finitef128) +#define __ldexpf128 F128_SFX_APPEND (__ldexpf128) + +#endif /* _FLOAT128_IFUNC_REDIRECTS */ diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc.c b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc.c new file mode 100644 index 0000000000..114d748b07 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc.c @@ -0,0 +1,63 @@ +/* _Float128 ifunc definitions for compat symbols. + Copyright (C) 2017-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +#if SHLIB_COMPAT (libm, GLIBC_2_15, GLIBC_2_31) + +/* __gammaf128_r is a special case. This prototype keeps compat macro simple. */ +extern _Float128 gammaf128_r (_Float128 x, int *signamp); + +#define MAKE_IFUNC_COMPAT_R(func,r) \ + extern __typeof(func ## r) __ieee754_ ## func ## _power8 ## r; \ + extern __typeof(func ## r) __ieee754_ ## func ## _power9 ## r; \ + extern __typeof(func ## r) __ieee754_ ## func ## r; \ + _F128_IFUNC(__ieee754_ ## func, r); \ + compat_symbol (libm, __ieee754_ ## func ## r, __ ## func ## r ## _finite, FIRST_VERSION_libm___ ## func ## r ## _finite); +#else +#define MAKE_IFUNC_COMPAT_R(func,r) +#endif + +#define MAKE_IFUNC_COMPAT(func) MAKE_IFUNC_COMPAT_R(func,) + +MAKE_IFUNC_COMPAT (acosf128) +MAKE_IFUNC_COMPAT (acoshf128) +MAKE_IFUNC_COMPAT (asinf128) +MAKE_IFUNC_COMPAT (atan2f128) +MAKE_IFUNC_COMPAT (atanhf128) +MAKE_IFUNC_COMPAT (coshf128) +MAKE_IFUNC_COMPAT (exp10f128) +MAKE_IFUNC_COMPAT (exp2f128) +MAKE_IFUNC_COMPAT (expf128) +MAKE_IFUNC_COMPAT (fmodf128) +MAKE_IFUNC_COMPAT_R (gammaf128, _r) +MAKE_IFUNC_COMPAT (hypotf128) +MAKE_IFUNC_COMPAT (j0f128) +MAKE_IFUNC_COMPAT (j1f128) +MAKE_IFUNC_COMPAT (jnf128) +MAKE_IFUNC_COMPAT_R (lgammaf128, _r) +MAKE_IFUNC_COMPAT (log10f128) +MAKE_IFUNC_COMPAT (log2f128) +MAKE_IFUNC_COMPAT (logf128) +MAKE_IFUNC_COMPAT (powf128) +MAKE_IFUNC_COMPAT (remainderf128) +MAKE_IFUNC_COMPAT (sinhf128) +MAKE_IFUNC_COMPAT (sqrtf128) +MAKE_IFUNC_COMPAT (y0f128) +MAKE_IFUNC_COMPAT (y1f128) +MAKE_IFUNC_COMPAT (ynf128) diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc.h b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc.h new file mode 100644 index 0000000000..923e095179 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc.h @@ -0,0 +1,183 @@ +/* _Float128 ifunc symboling macros. + Copyright (C) 2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* These cause conflicts when aliasing. Hide their definitions. */ +#define f32addf64x __hide_f32addf64x +#define f32subf64x __hide_f32subf64x +#define f32mulf64x __hide_f32mulf64x +#define f32divf64x __hide_f32divf64x +#define f32xaddf64x __hide_f32xaddf64x +#define f32xsubf64x __hide_f32xsubf64x +#define f32xmulf64x __hide_f32xmulf64x +#define f32xdivf64x __hide_f32xdivf64x +#define f32xaddf128 __hide_f32xaddf128 +#define f32xsubf128 __hide_f32xsubf128 +#define f32xmulf128 __hide_f32xmulf128 +#define f32xdivf128 __hide_f32xdivf128 +#define f32addf64 __hide_f32addf64 +#define f32subf64 __hide_f32subf64 +#define f32mulf64 __hide_f32mulf64 +#define f32divf64 __hide_f32divf64 +#define f64addf64x __hide_f64addf64x +#define f64subf64x __hide_f64subf64x +#define f64mulf64x __hide_f64mulf64x +#define f64divf64x __hide_f64divf64x + +/* We want the real prototypes. */ +#include +#include +#include +#include +#include "init-arch.h" + +#undef f32addf64x +#undef f32subf64x +#undef f32mulf64x +#undef f32divf64x +#undef f32xaddf64x +#undef f32xsubf64x +#undef f32xmulf64x +#undef f32xdivf64x +#undef f32xaddf128 +#undef f32xsubf128 +#undef f32xmulf128 +#undef f32xdivf128 +#undef f32addf64 +#undef f32subf64 +#undef f32mulf64 +#undef f32divf64 +#undef f64addf64x +#undef f64subf64x +#undef f64mulf64x +#undef f64divf64x + +#include +#include + +#define MAKE_IMPL_IFUNC2(func, pfx1, pfx2, r) \ + extern __typeof (pfx1 ## func ## f128 ## r) pfx2 ## func ## f128_power8 ## r; \ + extern __typeof (pfx1 ## func ## f128 ## r) pfx2 ## func ## f128_power9 ## r; \ + _F128_IFUNC2 (__ ## func ## f128, pfx2 ## func ## f128, r); + +#define MAKE_IMPL_IFUNC(func, pfx1, r) MAKE_IMPL_IFUNC2(func,pfx1,__,r) + +#define _F128_IFUNC2(func, from, r) \ + libc_ifunc (func ## r, (hwcap2 & PPC_FEATURE2_HAS_IEEE128) \ + ? from ## _power9 ## r : from ## _power8 ## r) + +#define _F128_IFUNC(func, r) _F128_IFUNC2(func, func, r) + +#define _libm_alias_narrow(func, size) \ + extern __typeof (f ## size ## func ## f128) __f ## size ## func ## f128; \ + MAKE_IMPL_IFUNC (f ## size ## func,,) \ + libm_alias_float ## size ## _float128 (func) + +#define _libm_alias_float32_float128(func) _libm_alias_narrow (func, 32) +#define _libm_alias_float64_float128(func) _libm_alias_narrow (func, 64) +#define _libm_alias_float64x_float128(func) _libm_alias_narrow (func, 64x) + +#define MAKE_IFUNCP_WRAP_R(w,func,r) \ + extern __typeof (func ## f128 ## r) __ ## func ## f128 ## r; \ + MAKE_IMPL_IFUNC2 (func,__,__ ## w, r) \ + weak_alias (__ ## func ## f128 ## r, func ## f128 ## r); \ + libm_alias_float128_other_r (__ ## func, func, r); + +#define MAKE_IFUNCP_R(func,r) MAKE_IFUNCP_WRAP_R (,func,r) + + +/* Generic aliasing functions */ +#define DECL_ALIAS(f) MAKE_IFUNCP_R (f,) +#define DECL_ALIAS_s(f) MAKE_IFUNCP_R (f,) +#define DECL_ALIAS_w(f) MAKE_IFUNCP_R (f,) +#define DECL_ALIAS_e(f) +#define DECL_ALIAS_k(f) +#define DECL_ALIAS_R_w(f) MAKE_IFUNCP_R (f, _r) +#define DECL_ALIAS_R_e(f) + +/* Handle expanding/narrowing functions specially. */ +#define DECL_ALIAS_s_f32add(x) _libm_alias_float32_float128 (add) +#define DECL_ALIAS_s_f64add(x) _libm_alias_float64_float128 (add) +#define DECL_ALIAS_s_f64xadd(x) _libm_alias_float64x_float128 (add) +#define DECL_ALIAS_s_f32sub(x) _libm_alias_float32_float128 (sub) +#define DECL_ALIAS_s_f64sub(x) _libm_alias_float64_float128 (sub) +#define DECL_ALIAS_s_f64xsub(x) _libm_alias_float64x_float128 (sub) +#define DECL_ALIAS_s_f32mul(x) _libm_alias_float32_float128 (mul) +#define DECL_ALIAS_s_f64mul(x) _libm_alias_float64_float128 (mul) +#define DECL_ALIAS_s_f64xmul(x) _libm_alias_float64x_float128 (mul) +#define DECL_ALIAS_s_f32div(x) _libm_alias_float32_float128 (div) +#define DECL_ALIAS_s_f64div(x) _libm_alias_float64_float128 (div) +#define DECL_ALIAS_s_f64xdiv(x) _libm_alias_float64x_float128 (div) + +/* These are fallback support for classification functions. */ +#define DECL_ALIAS_s_isinf(x) MAKE_IMPL_IFUNC (x, __,) +#define DECL_ALIAS_s_isnan(x) MAKE_IMPL_IFUNC (x, __,) +#define DECL_ALIAS_s_issignaling(x) MAKE_IMPL_IFUNC (x, __,) +#define DECL_ALIAS_s_iseqsig(x) MAKE_IMPL_IFUNC (x, __,) +#define DECL_ALIAS_s_signbit(x) MAKE_IMPL_IFUNC (x, __,) +#define DECL_ALIAS_s_finite(x) MAKE_IMPL_IFUNC (x, __,) +#define DECL_ALIAS_s_fpclassify(x) MAKE_IMPL_IFUNC (x, __,) + +/* This doesn't have a public strong implementatation alias. */ +extern __typeof (canonicalizef128) __canonicalizef128; + +/* No symbols in these helper/wrapped objects. */ +#define DECL_ALIAS_lgamma_neg(x) +#define DECL_ALIAS_lgamma_product(x) +#define DECL_ALIAS_gamma_product(x) +#define DECL_ALIAS_x2y2m1(x) +#define DECL_ALIAS_s_log1p(x) +#define DECL_ALIAS_s_scalbln(x) +#define DECL_ALIAS_s_scalbn(x) + +/* Ensure the wrapper functions get exposed via IFUNC, not the + wrappee (e.g __w_log1pf128_power8 instead of __log1pf128_power8. */ +#define DECL_ALIAS_w_log1p(x) MAKE_IFUNCP_WRAP_R(w_,x,) +#define DECL_ALIAS_w_scalbln(x) MAKE_IFUNCP_WRAP_R(w_,x,) + +/* Expose ldouble only redirected symbols. */ +#define DECL_LDOUBLE_ALIAS(func, RTYPE, ARGS) \ + extern RTYPE func ARGS; \ + extern __typeof (func) func ## _power8; \ + extern __typeof (func) func ## _power9; \ + _F128_IFUNC ( func,) + +/* These are declared in their respective jX objects. */ +#define DECL_ALIAS_w_j0(f) MAKE_IFUNCP_R (f,) MAKE_IFUNCP_R (y0,) +#define DECL_ALIAS_w_j1(f) MAKE_IFUNCP_R (f,) MAKE_IFUNCP_R (y1,) +#define DECL_ALIAS_w_jn(f) MAKE_IFUNCP_R (f,) MAKE_IFUNCP_R (yn,) + +#define DECL_ALIAS_s_erf(f) MAKE_IFUNCP_R (f,) MAKE_IFUNCP_R (erfc,) + +/* scalbnf128 is an alias of ldexpf128. */ +#define DECL_ALIAS_s_ldexp(f) MAKE_IFUNCP_R (f,) MAKE_IFUNCP_WRAP_R (wrap_, scalbn,) + +/* Handle the special case functions which exist only to support ldouble == ieee128. */ +#define DECL_ALIAS_s_nexttoward(x) \ + DECL_LDOUBLE_ALIAS (__nexttowardf_to_ieee128, float, (float, _Float128)) \ + DECL_LDOUBLE_ALIAS (__nexttoward_to_ieee128, double, (double, _Float128)) + +#define DECL_ALIAS_w_scalb(x) \ + DECL_LDOUBLE_ALIAS (__scalbf128,_Float128, (_Float128, _Float128)) \ + libm_alias_exclusive_ldouble (__scalb, scalb) + +#define DECL_ALIAS_s_significand(x) \ + DECL_LDOUBLE_ALIAS (__significandieee128, _Float128, (_Float128)) + +#define DECL_ALIAS_s_nextafter(f) \ + MAKE_IFUNCP_R (f,) \ + libm_alias_exclusive_ldouble (__nextafter, nexttoward) diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128_private.h b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128_private.h new file mode 100644 index 0000000000..df4fdbf4fd --- /dev/null +++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128_private.h @@ -0,0 +1,136 @@ +/* _Float128 overrides for float128 in ppc64le multiarch env. + Copyright (C) 2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _FLOAT128_PRIVATE_PPC64LE +#define _FLOAT128_PRIVATE_PPC64LE 1 + +#if IS_IN(libc) || defined(_F128_DISABLE_IFUNC) +/* multiarch is not supported. Do nothing and pass through. */ +#include_next +#else + +/* Include fenv.h now before turning off PLT bypass tricks. At + minimum fereaiseexcept is used today. */ +#include + +/* Likewise, the PLT bypass trick uses the same trick to rename + as we do. Only one asm-rename is allowed. Only fenv.h + functions require this today, so we include them above. */ +#undef libm_hidden_def +#define libm_hidden_def(func) +#undef libm_hidden_proto +#define libm_hidden_proto(f) +#undef hidden_proto +#define hidden_proto(f) + +/* Always disable redirects. We supply these uniquely later on. */ +#undef NO_MATH_REDIRECT +#define NO_MATH_REDIRECT +#include +#undef NO_MATH_REDIRECT + +#include_next + +#include + +/* Declare these now, as they otherwise are not. */ +extern __typeof (cosf128) __ieee754_cosf128; +extern __typeof (asinhf128) __ieee754_asinhf128; + +F128_REDIR (__ieee754_asinhf128) +F128_REDIR (__ieee754_cosf128) +F128_REDIR (__asinhf128) +F128_REDIR (__atanf128) +F128_REDIR (__cbrtf128) +F128_REDIR (__ceilf128) +F128_REDIR (__copysignf128) +F128_REDIR (__cosf128) +F128_REDIR (__erfcf128) +F128_REDIR (__erff128) +F128_REDIR (__expf128) +F128_REDIR (__expm1f128) +F128_REDIR (__fabsf128) +F128_REDIR (__fdimf128) +F128_REDIR (__finitef128) +F128_REDIR (__floorf128) +F128_REDIR (__fmaf128) +F128_REDIR (__fmaxf128) +F128_REDIR (__fminf128) +F128_REDIR (__fpclassifyf128) +F128_REDIR (__frexpf128) +F128_REDIR (__getpayloadf128) +F128_REDIR (__isinff128) +F128_REDIR (__isnanf128) +F128_REDIR (__ldexpf128) +F128_REDIR (__llrintf128) +F128_REDIR (__llroundf128) +F128_REDIR (__log1pf128) +F128_REDIR (__logbf128) +F128_REDIR (__logf128) +F128_REDIR (__lrintf128) +F128_REDIR (__lroundf128) +F128_REDIR (__modff128) +F128_REDIR (__nearbyintf128) +F128_REDIR (__nextafterf128) +F128_REDIR (__nextdownf128) +F128_REDIR (__nextupf128) +F128_REDIR (__remquof128) +F128_REDIR (__rintf128) +F128_REDIR (__roundevenf128) +F128_REDIR (__roundf128) +F128_REDIR (__scalblnf128) +F128_REDIR (__scalbnf128) +F128_REDIR (__signbitf128) +F128_REDIR (__sincosf128) +F128_REDIR (__sinf128) +F128_REDIR (__sqrtf128) +F128_REDIR (__tanhf128) +F128_REDIR (__tanf128) +F128_REDIR (__truncf128) +F128_REDIR (__lgamma_productf128) +F128_REDIR (__mpn_extract_float128) +F128_REDIR (__fromfpxf128); +F128_REDIR (__ufromfpxf128); +F128_REDIR (__fromfpf128); +F128_REDIR (__ufromfpf128); + +#include + +/* Redirect tricks don't work with these, so instead macro-rename. */ +#define __nexttoward_to_ieee128 F128_SFX_APPEND (__nexttoward_to_ieee128) +#define __nexttowardf_to_ieee128 F128_SFX_APPEND (__nexttowardf_to_ieee128) +#define __f32divf128 F128_SFX_APPEND (__f32divf128) +#define __f32mulf128 F128_SFX_APPEND (__f32mulf128) +#define __f32addf128 F128_SFX_APPEND (__f32addf128) +#define __f32subf128 F128_SFX_APPEND (__f32subf128) +#define __f64divf128 F128_SFX_APPEND (__f64divf128) +#define __f64mulf128 F128_SFX_APPEND (__f64mulf128) +#define __f64addf128 F128_SFX_APPEND (__f64addf128) +#define __f64subf128 F128_SFX_APPEND (__f64subf128) +#define __f64xdivf128 F128_SFX_APPEND (__f64xdivf128) +#define __f64xmulf128 F128_SFX_APPEND (__f64xmulf128) +#define __f64xaddf128 F128_SFX_APPEND (__f64xaddf128) +#define __f64xsubf128 F128_SFX_APPEND (__f64xsubf128) +#define __setpayloadf128 F128_SFX_APPEND (__setpayloadf128) +#define __setpayloadsigf128 F128_SFX_APPEND (__setpayloadsigf128) + +#include + +#endif /* !(IS_IN(libc) || defined(_F128_DISABLE_IFUNC) */ + +#endif /* _FLOAT128_PRIVATE_PPC64LE */ diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/math-type-macros-float128.h b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/math-type-macros-float128.h new file mode 100644 index 0000000000..77a35fe5dd --- /dev/null +++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/math-type-macros-float128.h @@ -0,0 +1,129 @@ +/* _Float128 overrides for float128 in ppc64le multiarch env. + Copyright (C) 2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _MATH_TYPE_MACROS_FLOAT128_PPC64_MULTI +#define _MATH_TYPE_MACROS_FLOAT128_PPC64_MULTI 1 + +#include_next + +#if !IS_IN(libc) && !defined(_F128_DISABLE_IFUNC) + +/* Include fenv.h now before turning off PLT bypass. At + minimum fereaiseexcept is used today. */ +#include + +#include + +#undef NO_MATH_REDIRECT +#define NO_MATH_REDIRECT +#include +#undef NO_MATH_REDIRECT + +#include + +/* This is easier than trying to coerce bits/mathcalls.h */ +#define F128_C_REDIR(f) F128_REDIR (__c ## f ## f128); \ + F128_REDIR (__ ## f ## f128); \ + +#define F128_TRIG_REDIR(f) F128_C_REDIR (a ## f); \ + F128_C_REDIR (a ## f ## h); \ + F128_C_REDIR (f); \ + F128_C_REDIR (f ## h); + +F128_TRIG_REDIR (cos) +F128_TRIG_REDIR (sin) +F128_TRIG_REDIR (tan) + +F128_C_REDIR (log); +F128_C_REDIR (log10); +F128_C_REDIR (exp); +F128_C_REDIR (sqrt); +F128_C_REDIR (pow); + +F128_REDIR (__atan2f128) +F128_REDIR (__kernel_casinhf128); +F128_REDIR (__rintf128); +F128_REDIR (__floorf128); +F128_REDIR (__fabsf128); +F128_REDIR (__hypotf128); +extern _Float128 __scalbf128 (_Float128, _Float128); +F128_REDIR (__scalbf128); +F128_REDIR (__scalbnf128); +F128_REDIR (__scalblnf128); +F128_REDIR (__sincosf128); +F128_REDIR (__log1pf128); +F128_REDIR (__ilogbf128); +F128_REDIR (__nextupf128); +F128_REDIR (__ldexpf128); +F128_REDIR (__cargf128); +F128_REDIR (__cimagf128); +F128_REDIR (__crealf128); +F128_REDIR (__conjf128); +F128_REDIR (__cprojf128); +F128_REDIR (__cabsf128); +F128_REDIR (__fdimf128); +F128_REDIR (__fminf128); +F128_REDIR (__fmaxf128); +F128_REDIR (__fmodf128); +F128_REDIR (__fmaxmagf128); +F128_REDIR (__fminmagf128); +F128_REDIR (__nanf128); +F128_REDIR (__nextupf128); +F128_REDIR (__nextdownf128); +F128_REDIR (__llogbf128); +F128_REDIR (__log2f128); +F128_REDIR (__exp10f128); +F128_REDIR (__exp2f128); +F128_REDIR (__j0f128); +F128_REDIR (__j1f128); +F128_REDIR (__jnf128); +F128_REDIR (__y0f128); +F128_REDIR (__y1f128); +F128_REDIR (__ynf128); +F128_REDIR (__lgammaf128); +F128_REDIR_R (__lgammaf128, _r); +F128_REDIR (__tgammaf128); +F128_REDIR (__remainderf128); +F128_REDIR (__iseqsigf128); + +/* Assist creative renaming of various templates. */ +extern _Float128 __wrap_scalbnf128 (_Float128, int); +extern _Float128 __w_scalblnf128 (_Float128, long int); +extern _Float128 __w_log1pf128 (_Float128); +F128_REDIR (__wrap_scalbnf128); +F128_REDIR (__w_scalblnf128); +F128_REDIR (__w_log1pf128); +extern __typeof (canonicalizef128) __canonicalizef128; +F128_REDIR (__canonicalizef128); + +/* Ensure significandf128 gets renamed appropriately */ +extern _Float128 __significandieee128 (_Float128); +F128_REDIR (__significandieee128); + +/* This is hack. The build directory is favored over the sysdep directorys. + This causes the generated generic version of s_significandf128.c to build. + The only effective difference is the C symbol name. Workaround this special + case by redirecting the symbol name emitted from the template. */ +extern _Float128 __significandf128 (_Float128) asm ("__significandieee128_power9"); + +/* Apply redirects for multiarch build. */ +#include + +#endif /* !IS_IN(libc) && !defined(_F128_DISABLE_IFUNC) */ + +#endif /*_MATH_TYPE_MACROS_FLOAT128_PPC64_MULTI */ diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/math_private.h b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/math_private.h new file mode 100644 index 0000000000..342efc0fb8 --- /dev/null +++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/math_private.h @@ -0,0 +1,14 @@ +#ifndef MATH_PRIVATE_PPC64LE_MA +#define MATH_PRIVATE_PPC64LE_MA 1 + +#include_next + +#if !defined (_F128_DISABLE_IFUNC) + +/* math_private.h redeclares many float128_private.h renamed functions, but + we can't inclue float128_private.h here without causing more trouble. */ +#include + +#endif + +#endif /* MATH_PRIVATE_PPC64LE_MA */ diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/s_fmaf128-power9.c b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/s_fmaf128-power9.c deleted file mode 100644 index 98d4107429..0000000000 --- a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/s_fmaf128-power9.c +++ /dev/null @@ -1,26 +0,0 @@ -/* __fmaf128() PowerPC64LE POWER9 version. - Copyright (C) 2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include - -#undef libm_alias_float128 -#define libm_alias_float128(a, b) - -#define __fmaf128 __fmaf128_power9 - -#include diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/s_fmaf128-ppc64.c b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/s_fmaf128-ppc64.c deleted file mode 100644 index 405e287ff3..0000000000 --- a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/s_fmaf128-ppc64.c +++ /dev/null @@ -1,26 +0,0 @@ -/* __fmaf128() PowerPC64LE version. - Copyright (C) 2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#undef weak_alias -#define weak_alias(a, b) -#undef strong_alias -#define strong_alias(a, b) - -#define __fmaf128 __fmaf128_ppc64 - -#include diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/s_fmaf128.c b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/s_fmaf128.c deleted file mode 100644 index 3a370950f9..0000000000 --- a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/s_fmaf128.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Multiple versions of fmaf128. - Copyright (C) 2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include - -#define fmaf128 __redirect_fmaf128 -#include -#undef fmaf128 - -#include -#include "init-arch.h" - -extern __typeof (__redirect_fmaf128) __fmaf128_ppc64 attribute_hidden; -extern __typeof (__redirect_fmaf128) __fmaf128_power9 attribute_hidden; - -libc_ifunc_redirected (__redirect_fmaf128, __fmaf128, - (hwcap2 & PPC_FEATURE2_HAS_IEEE128) - ? __fmaf128_power9 - : __fmaf128_ppc64); - -libm_alias_float128 (__fma, fma) diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128-power9.c b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128-power9.c deleted file mode 100644 index e7414f4a59..0000000000 --- a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128-power9.c +++ /dev/null @@ -1,35 +0,0 @@ -/* POWER9 sqrt for _Float128 - Copyright (C) 2018-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file into - combinations with other programs, and to distribute those - combinations without any restriction coming from the use of this - file. (The Lesser General Public License restrictions do apply in - other respects; for example, they cover modification of the file, - and distribution when not linked into a combine executable.) - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include - -#define __sqrtf128 __sqrtf128_power9 - -#undef declare_mgen_alias -#define declare_mgen_alias(a, b) - -#include diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128-ppc64le.c b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128-ppc64le.c deleted file mode 100644 index e03ecb193f..0000000000 --- a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128-ppc64le.c +++ /dev/null @@ -1,35 +0,0 @@ -/* PPC64LE sqrt for _Float128 - Copyright (C) 2018-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file into - combinations with other programs, and to distribute those - combinations without any restriction coming from the use of this - file. (The Lesser General Public License restrictions do apply in - other respects; for example, they cover modification of the file, - and distribution when not linked into a combine executable.) - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include - -#define __sqrtf128 __sqrtf128_ppc64le - -#undef declare_mgen_alias -#define declare_mgen_alias(a, b) - -#include diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128.c b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128.c deleted file mode 100644 index e2db0a2864..0000000000 --- a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_sqrtf128.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Multiple versions of __sqrtf128. - Copyright (C) 2018-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#define NO_MATH_REDIRECT -#include -#include "init-arch.h" -#include - -extern __typeof (__sqrtf128) __sqrtf128_ppc64le attribute_hidden; -extern __typeof (__sqrtf128) __sqrtf128_power9 attribute_hidden; - -libc_ifunc (__sqrtf128, - (hwcap2 & PPC_FEATURE2_ARCH_3_00) - ? __sqrtf128_power9 - : __sqrtf128_ppc64le); -declare_mgen_alias (__sqrt, sqrt)