From patchwork Wed Jun 6 22:39:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tulio Magno Quites Machado Filho X-Patchwork-Id: 926058 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-92965-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="q0gMWYB8"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 411NvT0xjJz9s3R for ; Thu, 7 Jun 2018 08:41:40 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:in-reply-to:references :message-id; q=dns; s=default; b=xe79atamE9mH0u+eG6pB3nZAVwffe88 R4zZJ6yW0TXniykS1EioIHfLNGCWwxfyQxBfofwJOoe25ws7kAZWA+DwzUR//lhL EKedJFIrAkMUAiCeeUTlWprMWLZ/ZgCMAcscLGJhYaSZPJ1e1E3oN34NjiaCsxqC Xq0wfWLWb0Uw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:in-reply-to:references :message-id; s=default; bh=EmQVryFUZ4kFVyP+s3OALqlJhVY=; b=q0gMW YB8MpIFs0BhOmX8/3QYaFJTkDwdU5cfW/Ac9re9d26GFNg2NgoCLSd3eT7Cqt01I 0Oo3heqijbR1PfNP2LkGTM1eQqEOzHKDALq1Jx1h/xfu6z10zKi1ZAq10Udwo6kY V59KBFq+y1GWSoPDvX1ahRKyUx74GwXwT4nr88= Received: (qmail 69377 invoked by alias); 6 Jun 2018 22:41:28 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 56055 invoked by uid 89); 6 Jun 2018 22:41:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx0a-001b2d01.pphosted.com From: Tulio Magno Quites Machado Filho To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, gabriel@inconstante.eti.br, raji@linux.ibm.com Subject: [PATCH 1/9] ldbl-128ibm-compat: Create libm-alias-float128.h Date: Wed, 6 Jun 2018 19:39:01 -0300 In-Reply-To: <20180606223909.16675-1-tuliom@linux.ibm.com> References: <20180606223909.16675-1-tuliom@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18060622-0036-0000-0000-000009EC4D52 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009139; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000265; SDB=6.01043027; UDB=6.00534142; IPR=6.00822157; MB=3.00021491; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-06 22:41:10 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18060622-0037-0000-0000-000047969864 Message-Id: <20180606223909.16675-2-tuliom@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-06-06_10:, , signatures=0 Add a new libm-alias-float128.h in order to provide the __*ieee128 aliases for the existing *f128 that do not have a globally exported symbol. 2018-06-06 Tulio Magno Quites Machado Filho Gabriel F. T. Gomes * sysdeps/ieee754/ldbl-128ibm-compat/Versions: New file. * sysdeps/ieee754/ldbl-128ibm-compat/libm-alias-float128.h: New file. --- sysdeps/ieee754/ldbl-128ibm-compat/Versions | 129 +++++++++++++++++++++ .../ldbl-128ibm-compat/libm-alias-float128.h | 64 ++++++++++ 2 files changed, 193 insertions(+) create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/Versions create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/libm-alias-float128.h diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Versions b/sysdeps/ieee754/ldbl-128ibm-compat/Versions new file mode 100644 index 0000000000..af6b4b3f60 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm-compat/Versions @@ -0,0 +1,129 @@ +%include +%ifndef LDBL_IBM128_VERSION +% error "ldbl-128ibm-compat-abi.h must define LDBL_IBM128_VERSION" +%endif + +libm { + LDBL_IBM128_VERSION { + __acoshieee128; + __acosieee128; + __asinhieee128; + __asinieee128; + __atan2ieee128; + __atanhieee128; + __atanieee128; + __cabsieee128; + __cacoshieee128; + __cacosieee128; + __canonicalizeieee128; + __cargieee128; + __casinhieee128; + __casinieee128; + __catanhieee128; + __catanieee128; + __cbrtieee128; + __ccoshieee128; + __ccosieee128; + __ceilieee128; + __cexpieee128; + __cimagieee128; + __clog10ieee128; + __clogieee128; + __conjieee128; + __copysignieee128; + __coshieee128; + __cosieee128; + __cpowieee128; + __cprojieee128; + __crealieee128; + __csinhieee128; + __csinieee128; + __csqrtieee128; + __ctanhieee128; + __ctanieee128; + __erfcieee128; + __erfieee128; + __exp10ieee128; + __exp2ieee128; + __expieee128; + __expm1ieee128; + __f32addieee128; + __f32divieee128; + __f32mulieee128; + __f32subieee128; + __f64addieee128; + __f64divieee128; + __f64mulieee128; + __f64subieee128; + __f64xaddieee128; + __f64xdivieee128; + __f64xmulieee128; + __f64xsubieee128; + __fabsieee128; + __fdimieee128; + __floorieee128; + __fmaieee128; + __fmaxieee128; + __fmaxmagieee128; + __fminieee128; + __fminmagieee128; + __fmodieee128; + __frexpieee128; + __fromfpieee128; + __fromfpxieee128; + __gamma_productieee128; + __getpayloadieee128; + __hypotieee128; + __ilogbieee128; + __j0ieee128; + __j1ieee128; + __jnieee128; + __ldexpieee128; + __lgammaieee128; + __lgammaieee128_r; + __lgamma_negieee128; + __lgamma_productieee128; + __llogbieee128; + __llrintieee128; + __llroundieee128; + __log10ieee128; + __log1pieee128; + __log2ieee128; + __logbieee128; + __logieee128; + __lrintieee128; + __lroundieee128; + __modfieee128; + __nanieee128; + __nearbyintieee128; + __nextafterieee128; + __nextdownieee128; + __nextupieee128; + __powieee128; + __remainderieee128; + __remquoieee128; + __rintieee128; + __roundevenieee128; + __roundieee128; + __scalblnieee128; + __scalbnieee128; + __setpayloadieee128; + __setpayloadsigieee128; + __sincosieee128; + __sinhieee128; + __sinieee128; + __sqrtieee128; + __tanhieee128; + __tanieee128; + __tgammaieee128; + __totalorderieee128; + __totalordermagieee128; + __truncieee128; + __ufromfpieee128; + __ufromfpxieee128; + __x2y2m1ieee128; + __y0ieee128; + __y1ieee128; + __ynieee128; + } +} diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/libm-alias-float128.h b/sysdeps/ieee754/ldbl-128ibm-compat/libm-alias-float128.h new file mode 100644 index 0000000000..a21dfcaea5 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm-compat/libm-alias-float128.h @@ -0,0 +1,64 @@ +/* Define aliases for libm _Float128 functions. + Copyright (C) 2018 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 _LIBM_ALIAS_FLOAT128_H +#define _LIBM_ALIAS_FLOAT128_H + +#include +#include + +/* This macro should be used on all long double functions that are not part of + the _Float128 API in order to provide *ieee128 symbols without exposing + internal *f128 symbols. */ +#define libm_alias_float128_other_r_ldbl(from, to, r) \ + strong_alias (from ## f128 ## r, __ ## to ## ieee128 ## r) + +/* Define _FloatN / _FloatNx aliases (other than that for _Float128) + for a _Float128 libm function that has internal name FROM ## f128 + ## R and public names TO ## suffix ## R for each suffix of a + supported _FloatN / _FloatNx floating-point type with the same + format as _Float128. */ +#if __HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE +# define libm_alias_float128_other_r(from, to, r) \ + weak_alias (from ## f128 ## r, to ## f64x ## r); \ + libm_alias_float128_other_r_ldbl(from, to, r) +#else +# define libm_alias_float128_other_r(from, to, r) \ + libm_alias_float128_other_r_ldbl(from, to, r) +#endif + +/* Likewise, but without the R suffix. */ +#define libm_alias_float128_other(from, to) \ + libm_alias_float128_other_r (from, to, ) + +/* Define aliases for a _Float128 libm function that has internal name + FROM ## f128 ## R and public names TO ## suffix ## R for each + suffix of a supported floating-point type with the same format as + _Float128. This should only be used for functions where such + public names exist for _FloatN types, not for + implementation-namespace exported names (where there is one name + per format, not per type) or for obsolescent functions not provided + for _FloatN types. */ +#define libm_alias_float128_r(from, to, r) \ + weak_alias (from ## f128 ## r, to ## f128 ## r); \ + libm_alias_float128_other_r (from, to, r) + +/* Likewise, but without the R suffix. */ +#define libm_alias_float128(from, to) libm_alias_float128_r (from, to, ) + +#endif From patchwork Wed Jun 6 22:39:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tulio Magno Quites Machado Filho X-Patchwork-Id: 926059 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-92966-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="dDtCKTzn"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 411Nvd2xbrz9rxs for ; Thu, 7 Jun 2018 08:41:49 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:in-reply-to:references :message-id; q=dns; s=default; b=xhB7PSroj3uC1kyLXM5UyKfG60UR7hw hfkx9rRFw+ce75PjTpHvhI2Io8SwKCNzByDBX0SRbOGKSdOypSz35hzxqpBT+kPL yyOrWNw/65IpD/DN3nlGVe04UgtTGZqljB/OKyBAruBbFDbi16+67QBWFx4v3Tnf cNOvKltM4cJE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:in-reply-to:references :message-id; s=default; bh=zjN+U8EJLB+6DgqhA6rf5ZbTxY8=; b=dDtCK Tznz4CnVbxXgumiLXF4p8yasIga/23a9ZNl7qbdBA0qrgcQCU+e+Kq81+Vt7yrDa x6mHQN/pTdN7br6bj8+iw2qG1hInh74nhGsnTcYIC/jde7/taq+GG+Of5sZKW2g+ Jo82tr4gve9LJQRq01Fk3dCTCBJy5V4UDsIfEE= Received: (qmail 74334 invoked by alias); 6 Jun 2018 22:41:32 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 63703 invoked by uid 89); 6 Jun 2018 22:41:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx0a-001b2d01.pphosted.com From: Tulio Magno Quites Machado Filho To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, gabriel@inconstante.eti.br, raji@linux.ibm.com Subject: [PATCH 2/9] Move declare_mgen_finite_alias definition Date: Wed, 6 Jun 2018 19:39:02 -0300 In-Reply-To: <20180606223909.16675-1-tuliom@linux.ibm.com> References: <20180606223909.16675-1-tuliom@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18060622-0052-0000-0000-000002F9747E X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009139; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000265; SDB=6.01043027; UDB=6.00534142; IPR=6.00822157; MB=3.00021491; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-06 22:41:16 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18060622-0053-0000-0000-00005CEB174B Message-Id: <20180606223909.16675-3-tuliom@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-06-06_10:, , signatures=0 Move declare_mgen_finite_alias, declare_mgen_finite_alias_s and declare_mgen_finite_alias_x to a shared place in order to reuse them in other files that also declare _finite aliases. 2018-06-06 Tulio Magno Quites Machado Filho * math/e_exp2_template.c (declare_mgen_finite_alias, declare_mgen_finite_alias_s, declare_mgen_finite_alias_x): Move to... * sysdeps/generic/math-type-macros.h (declare_mgen_finite_alias, declare_mgen_finite_alias_s, declare_mgen_finite_alias_x): ... here. Signed-off-by: Tulio Magno Quites Machado Filho --- math/e_exp2_template.c | 7 ------- sysdeps/generic/math-type-macros.h | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/math/e_exp2_template.c b/math/e_exp2_template.c index 30ed4af49b..19f9780b05 100644 --- a/math/e_exp2_template.c +++ b/math/e_exp2_template.c @@ -21,13 +21,6 @@ #include #include -#define declare_mgen_finite_alias_x(from, to) \ - strong_alias (from, to ## _finite) -#define declare_mgen_finite_alias_s(from,to) \ - declare_mgen_finite_alias_x (from, to) -#define declare_mgen_finite_alias(from, to) \ - declare_mgen_finite_alias_s (M_SUF (from), M_SUF (to)) - FLOAT M_DECL_FUNC (__ieee754_exp2) (FLOAT x) { diff --git a/sysdeps/generic/math-type-macros.h b/sysdeps/generic/math-type-macros.h index 0e8ef16d7a..5250815253 100644 --- a/sysdeps/generic/math-type-macros.h +++ b/sysdeps/generic/math-type-macros.h @@ -74,6 +74,21 @@ # error "SET_NAN_PAYLOAD must be defined." #endif +#ifndef declare_mgen_finite_alias_x +#define declare_mgen_finite_alias_x(from, to) \ + strong_alias (from, to ## _finite) +#endif + +#ifndef declare_mgen_finite_alias_s +# define declare_mgen_finite_alias_s(from,to) \ + declare_mgen_finite_alias_x (from, to) +#endif + +#ifndef declare_mgen_finite_alias +# define declare_mgen_finite_alias(from, to) \ + declare_mgen_finite_alias_s (M_SUF (from), M_SUF (to)) +#endif + #define __M_CONCAT(a,b) a ## b #define __M_CONCATX(a,b) __M_CONCAT(a,b) From patchwork Wed Jun 6 22:39:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tulio Magno Quites Machado Filho X-Patchwork-Id: 926060 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-92967-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="PyyYiX7v"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 411Nvs01M5z9rxs for ; Thu, 7 Jun 2018 08:42:00 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:in-reply-to:references :message-id; q=dns; s=default; b=Q8cuAcm92s5o47prp9GVeAxbArYrdIE IiTcxv3zQF/ldByJy7o3KaxxNXy1713EZM93HGYhWte1IdbVIlsEinJxDr9jpc5d 4NxThrSVEFK31255DYHwCDW5ht1BihJGt/oUdzKGwKqwStCJ4fzNyFUSPmBzoyX5 djz0RSXjLx+M= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:in-reply-to:references :message-id; s=default; bh=HA6ug8SWYjT7m5TORkTsGv2dLbI=; b=PyyYi X7v8PpUxD8lErZhlfHOiF+bB1Z4Z1LjzxtjRCq6u2D9jOW2cBK7zgtK05o4uGLxb AHGfxsWryRjStLklyHwGoQ3DaORBRqy7DXgsrIHw0OwFDw/UYWDG1CwLf6uJA1ay uO1J2q1XVgjCYyAQ7WXPbNu7BtpPKJfh16XAlk= Received: (qmail 76997 invoked by alias); 6 Jun 2018 22:41:42 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 76165 invoked by uid 89); 6 Jun 2018 22:41:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx0a-001b2d01.pphosted.com From: Tulio Magno Quites Machado Filho To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, gabriel@inconstante.eti.br, raji@linux.ibm.com Subject: [PATCH 3/9] ldbl-128ibm-compat: Provide a generic scalb implementation Date: Wed, 6 Jun 2018 19:39:03 -0300 In-Reply-To: <20180606223909.16675-1-tuliom@linux.ibm.com> References: <20180606223909.16675-1-tuliom@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18060622-2213-0000-0000-000002B46BAA X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009139; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000265; SDB=6.01043027; UDB=6.00534142; IPR=6.00822157; MB=3.00021491; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-06 22:41:29 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18060622-2214-0000-0000-00005A630EB4 Message-Id: <20180606223909.16675-4-tuliom@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-06-06_10:, , signatures=0 Create templates for scalb and reuse them in ldbl-128ibm-compat in order to provide the local symbol __scalbf128 and the global symbol __scalbieee128. 2018-06-06 Tulio Magno Quites Machado Filho Gabriel F. T. Gomes * math/e_scalb_template.c: New file. * math/w_scalb_template.c: New file. * sysdeps/ieee754/ldbl-128ibm-compat/Makefile: New file. * sysdeps/ieee754/ldbl-128ibm-compat/Versions: Add __scalbieee128. * sysdeps/ieee754/ldbl-128ibm-compat/e_scalbf128.c: New file. * sysdeps/ieee754/ldbl-128ibm-compat/w_scalbf128.c: New file. --- math/e_scalb_template.c | 54 ++++++++++++++ math/w_scalb_template.c | 95 ++++++++++++++++++++++++ sysdeps/ieee754/ldbl-128ibm-compat/Makefile | 6 ++ sysdeps/ieee754/ldbl-128ibm-compat/Versions | 1 + sysdeps/ieee754/ldbl-128ibm-compat/e_scalbf128.c | 21 ++++++ sysdeps/ieee754/ldbl-128ibm-compat/w_scalbf128.c | 27 +++++++ 6 files changed, 204 insertions(+) create mode 100644 math/e_scalb_template.c create mode 100644 math/w_scalb_template.c create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/Makefile create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/e_scalbf128.c create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/w_scalbf128.c diff --git a/math/e_scalb_template.c b/math/e_scalb_template.c new file mode 100644 index 0000000000..02663424a7 --- /dev/null +++ b/math/e_scalb_template.c @@ -0,0 +1,54 @@ +/* Multiply by integral power of radix. + Copyright (C) 2018 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 +#include + +static FLOAT +__attribute__ ((noinline)) +invalid_fn (FLOAT x, FLOAT fn) +{ + if (M_SUF (__rint) (fn) != fn) + return (fn - fn) / (fn - fn); + else if (fn > M_LIT (65000.0)) + return M_SUF (__scalbn) (x, 65000); + else + return M_SUF (__scalbn) (x,-65000); +} + + +FLOAT +M_DECL_FUNC (__ieee754_scalb) (FLOAT x, FLOAT fn) +{ + if (__glibc_unlikely (isnan (x))) + return x * fn; + if (__glibc_unlikely (!isfinite (fn))) + { + if (isnan (fn) || fn > M_LIT (0.0)) + return x * fn; + if (x == M_LIT (0.0)) + return x; + return x / -fn; + } + if (__glibc_unlikely (M_FABS (fn) >= M_LIT (0x1p31) + || (FLOAT) (int) fn != fn)) + return invalid_fn (x, fn); + + return M_SCALBN (x, (int) fn); +} +declare_mgen_finite_alias (__ieee754_scalb, __scalb) diff --git a/math/w_scalb_template.c b/math/w_scalb_template.c new file mode 100644 index 0000000000..b42659e561 --- /dev/null +++ b/math/w_scalb_template.c @@ -0,0 +1,95 @@ +/* Wrapper to set errno for scalb. + Copyright (C) 2018 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 + . */ + +/* Only build wrappers from the templates for the types that define the macro + below. This macro is set in math-type-macros-.h in sysdeps/generic + for each floating-point type. */ +#if __USE_WRAPPER_TEMPLATE + +#include +#include +#include +#include + +#if LIBM_SVID_COMPAT +static FLOAT +__attribute__ ((noinline)) +M_DECL_FUNC (sysv_scalb) (FLOAT x, FLOAT fn) +{ + FLOAT z = M_SUF (__ieee754_scalb) (x, fn); + + if (__glibc_unlikely (isinf (z))) + { + if (isfinite (x)) + { + /* scalb overflow. */ + __set_errno (ERANGE); + return x > M_LIT (0.0) ? HUGE_VAL : -HUGE_VAL; + } + else + __set_errno (ERANGE); + } + else if (__builtin_expect (z == M_LIT (0.0), 0) && z != x) + { + /* scalb underflow. */ + __set_errno (ERANGE); + return M_LIT (0.0); + } + + return z; +} +#endif + + +/* Wrapper scalb */ +FLOAT +M_DECL_FUNC (__scalb) (FLOAT x, FLOAT fn) +{ +#if LIBM_SVID_COMPAT + if (__glibc_unlikely (_LIB_VERSION == _SVID_)) + return M_SUF (sysv_scalb) (x, fn); + else +#endif + { + FLOAT z = __ieee754_scalbl (x, fn); + + if (__glibc_unlikely (!isfinite (z) || z == M_LIT (0.0))) + { + if (isnan (z)) + { + if (!isnan (x) && !isnan (fn)) + __set_errno (EDOM); + } + else if (isinf (z)) + { + if (!isinf (x) && !isinf (fn)) + __set_errno (ERANGE); + } + else + { + /* z == 0. */ + if (x != M_LIT (0.0) && !isinf (fn)) + __set_errno (ERANGE); + } + } + return z; + } +} +declare_mgen_alias (__scalb, scalb); + +#endif /* __USE_WRAPPER_TEMPLATE. */ diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile new file mode 100644 index 0000000000..47d2632850 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile @@ -0,0 +1,6 @@ +ifeq ($(subdir),math) +# scalb is a libm-compat-call, so it gets excluded from f128. +# It's necessary to build it for f128 in order to provide long double symbols +# based on the f128 implementation. +libm-routines += w_scalbf128 +endif diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Versions b/sysdeps/ieee754/ldbl-128ibm-compat/Versions index af6b4b3f60..8133d874df 100644 --- a/sysdeps/ieee754/ldbl-128ibm-compat/Versions +++ b/sysdeps/ieee754/ldbl-128ibm-compat/Versions @@ -105,6 +105,7 @@ libm { __rintieee128; __roundevenieee128; __roundieee128; + __scalbieee128; __scalblnieee128; __scalbnieee128; __setpayloadieee128; diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/e_scalbf128.c b/sysdeps/ieee754/ldbl-128ibm-compat/e_scalbf128.c new file mode 100644 index 0000000000..355be95996 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm-compat/e_scalbf128.c @@ -0,0 +1,21 @@ +/* Get mantissa of long double. + Copyright (C) 2018 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 + +#include diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/w_scalbf128.c b/sysdeps/ieee754/ldbl-128ibm-compat/w_scalbf128.c new file mode 100644 index 0000000000..4094fbfb19 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm-compat/w_scalbf128.c @@ -0,0 +1,27 @@ +/* Get mantissa of long double. + Copyright (C) 2018 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 +#include + +#undef declare_mgen_alias +#define declare_mgen_alias(a,b) +#define __ieee754_scalbl __ieee754_scalbf128 +#include + +libm_alias_float128_other_r_ldbl (__scalb, scalb,) From patchwork Wed Jun 6 22:39:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tulio Magno Quites Machado Filho X-Patchwork-Id: 926061 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-92968-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="jNY2bYS2"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 411Nw54zV5z9rxs for ; Thu, 7 Jun 2018 08:42:13 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:in-reply-to:references :message-id; q=dns; s=default; b=gun45kJEYJKZOx/BwHO7V/ykVw1ymLq CQ8cjSBo7W/o8q/8LsHWvuuH2VqHRl27kn4N1HUFoPWsNf4jVaEtpGoY6YRILtgz TBRsJvf+aGqpxly7DSPXUZXJY3LhqXdx/Y4aLrhONU0X+jaVfWuNdrZmtkKVSZK6 zf8E33P6dFX8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:in-reply-to:references :message-id; s=default; bh=PWbBHQl6BORf81/9vjtmqyDyjLU=; b=jNY2b YS2uldR/95pwt4unfKUDYULID9ToMSfNajrFImyb/oPSP4v1pGi1u6veTeEb+cn5 mp7ApCCHLz7mVEPf6Bktw9vosW+mBrtdsK6Xb7cs7QortMdPG+TvuGTDKCd4H+R1 d1RvDzM0tEtJgWKoxiOGhokpNrH7KUE44otsm8= Received: (qmail 78091 invoked by alias); 6 Jun 2018 22:41:49 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 77187 invoked by uid 89); 6 Jun 2018 22:41:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-27.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx0a-001b2d01.pphosted.com From: Tulio Magno Quites Machado Filho To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, gabriel@inconstante.eti.br, raji@linux.ibm.com Subject: [PATCH 4/9] ldbl-128ibm-compat: Add a generic significand() implementation Date: Wed, 6 Jun 2018 19:39:04 -0300 In-Reply-To: <20180606223909.16675-1-tuliom@linux.ibm.com> References: <20180606223909.16675-1-tuliom@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18060622-2213-0000-0000-000002B46BAC X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009139; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000265; SDB=6.01043027; UDB=6.00534142; IPR=6.00822157; MB=3.00021491; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-06 22:41:38 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18060622-2214-0000-0000-00005A630EC9 Message-Id: <20180606223909.16675-5-tuliom@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-06-06_10:, , signatures=0 Create a template for significand and reuse it in the ldbl-128ibm-compat directory. 2018-06-06 Tulio Magno Quites Machado Filho * math/s_significand_template.c: New file. * sysdeps/ieee754/ldbl-128ibm-compat/Versions: Add __significandieee128. * sysdeps/ieee754/ldbl-128ibm-compat/s_significandf128.c: New file. * sysdeps/ieee754/ldbl-128ibm-compat/s_significandl.c: New file. Signed-off-by: Tulio Magno Quites Machado Filho --- math/s_significand_template.c | 33 ++++++++++++++++++++++ sysdeps/ieee754/ldbl-128ibm-compat/Versions | 1 + .../ieee754/ldbl-128ibm-compat/s_significandf128.c | 25 ++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 math/s_significand_template.c create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/s_significandf128.c diff --git a/math/s_significand_template.c b/math/s_significand_template.c new file mode 100644 index 0000000000..c95017e683 --- /dev/null +++ b/math/s_significand_template.c @@ -0,0 +1,33 @@ +/* Return the mantissa of a floating-point number. + Copyright (C) 2018 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 + . */ + +/* + * significand(x) computes just + * scalb(x, (long double) - ilogb(x)), + * for exercising the fraction-part(F) IEEE 754-1985 test vector. + */ + +#include +#include + +FLOAT +M_DECL_FUNC (__significand) (FLOAT x) +{ + return M_SUF (__ieee754_scalb) (x,(FLOAT) - M_SUF (__ilogb) (x)); +} +declare_mgen_alias (__significand, significand) diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Versions b/sysdeps/ieee754/ldbl-128ibm-compat/Versions index 8133d874df..06c19569c5 100644 --- a/sysdeps/ieee754/ldbl-128ibm-compat/Versions +++ b/sysdeps/ieee754/ldbl-128ibm-compat/Versions @@ -110,6 +110,7 @@ libm { __scalbnieee128; __setpayloadieee128; __setpayloadsigieee128; + __significandieee128; __sincosieee128; __sinhieee128; __sinieee128; diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/s_significandf128.c b/sysdeps/ieee754/ldbl-128ibm-compat/s_significandf128.c new file mode 100644 index 0000000000..4ae0fde6a5 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm-compat/s_significandf128.c @@ -0,0 +1,25 @@ +/* Get mantissa of long double. + Copyright (C) 2018 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 +#include + +#define __significandf128 __significandieee128 +#undef declare_mgen_alias +#define declare_mgen_alias(...) +#include From patchwork Wed Jun 6 22:39:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tulio Magno Quites Machado Filho X-Patchwork-Id: 926062 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-92969-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="DsiskkXc"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 411NwM20Vdz9rxs for ; Thu, 7 Jun 2018 08:42:27 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:in-reply-to:references :message-id; q=dns; s=default; b=QgY3gVFonTtAdpea7yMQ+i6lbcgM98h blQyqMrfx8qPNWq2Bal+BG/cw0J49xHsZXBXqHUGicKxC1yD0eaiSQ4l6pK8p1rv lWiu3DYIo80nZTOuss+1b6mmQiGpS9xxnF4Yqby5KncQM7BVxXSlyYBrOTUoTwBQ pOhKhjG0yD1c= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:in-reply-to:references :message-id; s=default; bh=GC34dTFrAkmKd0Y+HlTBCu98Sc4=; b=Dsisk kXcwBATNR1a4WdThH+Snes4STEE0lFQ6ItBkBYVZPQG4XPNWV6TZzfy/GQmApmbD ulodUCkZ6cOqUQwjVLDU721JNVGP1d9FKzGCIVX6vgKEUaTycEeDuWpUB+GjL93V t00IIDvLvYubpvw1J0jt60u2tZ6GbF6/NtkeA8= Received: (qmail 80662 invoked by alias); 6 Jun 2018 22:42:10 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 79581 invoked by uid 89); 6 Jun 2018 22:42:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-27.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx0a-001b2d01.pphosted.com From: Tulio Magno Quites Machado Filho To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, gabriel@inconstante.eti.br, raji@linux.ibm.com Subject: [PATCH 5/9] ldbl-128ibm-compat: Provide ISO C functions not provided by the _Float128 API Date: Wed, 6 Jun 2018 19:39:05 -0300 In-Reply-To: <20180606223909.16675-1-tuliom@linux.ibm.com> References: <20180606223909.16675-1-tuliom@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18060622-2213-0000-0000-000002B46BAD X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009139; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000265; SDB=6.01043027; UDB=6.00534142; IPR=6.00822157; MB=3.00021491; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-06 22:41:53 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18060622-2214-0000-0000-00005A630EE1 Message-Id: <20180606223909.16675-6-tuliom@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-06-06_10:, , signatures=0 These functions do not exist in the float128 api, but they need to be provided for long double (*l api) because they are part of ISO C. This patch only adds the exported symbols that are used by user programs, i.e. __gammaieee128 and __dremieee128. 2018-06-06 Tulio Magno Quites Machado Filho Gabriel F. T. Gomes * sysdeps/ieee754/ldbl-128ibm-compat/Versions: Add __dremieee128 and __gammaieee128. * sysdeps/ieee754/ldbl-128ibm-compat/w_lgammaf128.c: New file. * sysdeps/ieee754/ldbl-128ibm-compat/w_remainderf128.c: New file. --- sysdeps/ieee754/ldbl-128ibm-compat/Versions | 2 ++ sysdeps/ieee754/ldbl-128ibm-compat/w_lgammaf128.c | 22 ++++++++++++++++++++++ .../ieee754/ldbl-128ibm-compat/w_remainderf128.c | 22 ++++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/w_lgammaf128.c create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/w_remainderf128.c diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Versions b/sysdeps/ieee754/ldbl-128ibm-compat/Versions index 06c19569c5..b7efe84918 100644 --- a/sysdeps/ieee754/ldbl-128ibm-compat/Versions +++ b/sysdeps/ieee754/ldbl-128ibm-compat/Versions @@ -41,6 +41,7 @@ libm { __csqrtieee128; __ctanhieee128; __ctanieee128; + __dremieee128; __erfcieee128; __erfieee128; __exp10ieee128; @@ -71,6 +72,7 @@ libm { __frexpieee128; __fromfpieee128; __fromfpxieee128; + __gammaieee128; __gamma_productieee128; __getpayloadieee128; __hypotieee128; diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/w_lgammaf128.c b/sysdeps/ieee754/ldbl-128ibm-compat/w_lgammaf128.c new file mode 100644 index 0000000000..2b213783da --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm-compat/w_lgammaf128.c @@ -0,0 +1,22 @@ +/* Deprecated gammal functions. + Copyright (C) 2018 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 +#include + +libm_alias_float128_other_r_ldbl(__lgamma, gamma,) diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/w_remainderf128.c b/sysdeps/ieee754/ldbl-128ibm-compat/w_remainderf128.c new file mode 100644 index 0000000000..218b8d8a75 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm-compat/w_remainderf128.c @@ -0,0 +1,22 @@ +/* Deprecated dreml functions. + Copyright (C) 2018 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 +#include + +libm_alias_float128_other_r_ldbl (__remainder, drem, ); From patchwork Wed Jun 6 22:39:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tulio Magno Quites Machado Filho X-Patchwork-Id: 926063 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-92970-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="Ccbj6ODn"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 411Nwv6Jhrz9rxs for ; Thu, 7 Jun 2018 08:42:55 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:in-reply-to:references :message-id; q=dns; s=default; b=FJcFaPKbbjRmWkuHdl/DhzaokDqvHtO sXB+17hsFf/m9cn/vVcgejGMPnALuWOObbT97J/DJ9WyDfUqoLDqUsrk3ug9vXNF wfLxFhy5XuSq3+kzUa/ASl9qmeHRKuGBy2H2lgut4Ig2TUVEj9nao9jKJK1igFUV Px1m88moNDeA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:in-reply-to:references :message-id; s=default; bh=UybgHEm5xDull/MgEdxremdvo6Q=; b=Ccbj6 ODnwufZeee+VPKJ5DDoHbtN9O5ukjK3VmMhGQNZmhw0HAZzfq3H4CcljYhHmPQx8 UJ/cgyWs8UZbIxoE41A+nBLFNdzbLMLslrfp448S8QpYc/jwzInrbHJ37lbnCttJ i6qIFBROzz332psq/aIxkAzEgg3Ibtl9rPQIO0= Received: (qmail 83413 invoked by alias); 6 Jun 2018 22:42:35 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 81791 invoked by uid 89); 6 Jun 2018 22:42:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-27.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx0a-001b2d01.pphosted.com From: Tulio Magno Quites Machado Filho To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, gabriel@inconstante.eti.br, raji@linux.ibm.com Subject: [PATCH 6/9] ldbl-128ibm-compat: Provide nexttoward functions Date: Wed, 6 Jun 2018 19:39:06 -0300 In-Reply-To: <20180606223909.16675-1-tuliom@linux.ibm.com> References: <20180606223909.16675-1-tuliom@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18060622-0036-0000-0000-000009EC4DAC X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009139; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000265; SDB=6.01043027; UDB=6.00534142; IPR=6.00822157; MB=3.00021491; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-06 22:42:12 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18060622-0037-0000-0000-000047969931 Message-Id: <20180606223909.16675-7-tuliom@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-06-06_10:, , signatures=0 From: "Gabriel F. T. Gomes" The functions in the nexttoward family are special, in the sense that they always have a long double argument, regardless of their suffix (i.e.: nexttowardf and nexttoward have a long double argument, besides the float and double arguments). On top of that, they are also special because nexttoward functions are not part of the _FloatN API, hence __nexttowardf128 do not exist. This patch adds 4 new function implementations for the new long double format: __nexttoward_to_ieee128 __nexttowardf_to_ieee128 __nexttowardieee128 (as an alias to __nextafterieee128) 2018-06-06 Gabriel F. T. Gomes Tulio Magno Quites Machado Filho * sysdeps/ieee754/ldbl-128ibm-compat/Versions: Add __nexttowardf_to_ieee128, __nexttowardieee128 and __nexttoward_to_ieee128. * sysdeps/ieee754/ldbl-128ibm-compat/s_nextafterf128.c: New file. * sysdeps/ieee754/ldbl-128ibm-compat/s_nexttowardf128.c: New file. --- sysdeps/ieee754/ldbl-128ibm-compat/Versions | 3 ++ .../ieee754/ldbl-128ibm-compat/s_nextafterf128.c | 20 ++++++++++++ .../ieee754/ldbl-128ibm-compat/s_nexttowardf128.c | 38 ++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/s_nextafterf128.c create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/s_nexttowardf128.c diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Versions b/sysdeps/ieee754/ldbl-128ibm-compat/Versions index b7efe84918..5f240cb687 100644 --- a/sysdeps/ieee754/ldbl-128ibm-compat/Versions +++ b/sysdeps/ieee754/ldbl-128ibm-compat/Versions @@ -100,6 +100,9 @@ libm { __nearbyintieee128; __nextafterieee128; __nextdownieee128; + __nexttowardf_to_ieee128; + __nexttowardieee128; + __nexttoward_to_ieee128; __nextupieee128; __powieee128; __remainderieee128; diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/s_nextafterf128.c b/sysdeps/ieee754/ldbl-128ibm-compat/s_nextafterf128.c new file mode 100644 index 0000000000..419068f8b1 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm-compat/s_nextafterf128.c @@ -0,0 +1,20 @@ +/* Provide nexttowardl and nextafterl implementations for IEEE long double. + Copyright (C) 2018 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) diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/s_nexttowardf128.c b/sysdeps/ieee754/ldbl-128ibm-compat/s_nexttowardf128.c new file mode 100644 index 0000000000..4403783a56 --- /dev/null +++ b/sysdeps/ieee754/ldbl-128ibm-compat/s_nexttowardf128.c @@ -0,0 +1,38 @@ +/* Provide nexttoward[|f] implementations for IEEE long double. + Copyright (C) 2018 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 + +/* Build nexttoward functions with binary128 format. */ +#undef weak_alias +#define weak_alias(from, to) +#undef libm_alias_ldouble +#define libm_alias_ldouble(from, to) +#undef __nexttoward +#define __nexttoward __nexttoward_to_ieee128 +#include + +#undef weak_alias +#define weak_alias(from, to) +#undef libm_alias_ldouble +#define libm_alias_ldouble(from, to) +#undef __nexttowardf +#define __nexttowardf __nexttowardf_to_ieee128 +#include + +#include From patchwork Wed Jun 6 22:39:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tulio Magno Quites Machado Filho X-Patchwork-Id: 926064 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-92971-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="gZ7DayXX"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 411NxN1SYnz9rxs for ; Thu, 7 Jun 2018 08:43:19 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:in-reply-to:references :message-id; q=dns; s=default; b=A+me+D2VgZHBjBVJ6AYgR/aUTwM59uJ A2O3qnJdVmhth0XXxHiZ7qN2YfV/IPLO0tuYVF+Q0puz/hiuksx/VXAEGdf3LZCM cMUFIFsU+5UxDHrrBi8m/fu+ucgjfRnwox3ZF5P1yUpxfy/whtZrORNuhlFauV+e MLaGKYamGxVc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:in-reply-to:references :message-id; s=default; bh=E2CjDMLRgJ4pmJ/2zGEpU3Ta/s4=; b=gZ7Da yXXKKqUO36S6pg9R5WLuicYNBkDXnP86vYq73rIFKitsdB1Q4FarkGcULpVUkdV7 b2CzpVfyHA9DVdRJ2tXn4dobp+Ha2HpXObt4iikWKEXxCTIOYth2WPiv4EchYXUj 22DV4fuRGk94IH0Yyxl66b46m8xsgMnveFLcjk= Received: (qmail 84365 invoked by alias); 6 Jun 2018 22:42:46 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 83483 invoked by uid 89); 6 Jun 2018 22:42:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-27.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=meanwhile, tan, fractional, ys X-HELO: mx0a-001b2d01.pphosted.com From: Tulio Magno Quites Machado Filho To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, gabriel@inconstante.eti.br, raji@linux.ibm.com Subject: [PATCH 7/9] Refactor math-finite.h and introduce mathcalls-redir.h Date: Wed, 6 Jun 2018 19:39:07 -0300 In-Reply-To: <20180606223909.16675-1-tuliom@linux.ibm.com> References: <20180606223909.16675-1-tuliom@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18060622-2213-0000-0000-000002B46BB0 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009139; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000265; SDB=6.01043027; UDB=6.00534142; IPR=6.00822157; MB=3.00021491; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-06 22:42:19 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18060622-2214-0000-0000-00005A630F0D Message-Id: <20180606223909.16675-8-tuliom@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-06-06_10:, , signatures=0 On a new enough compiler, redirecting the same function twice can cause -Werror=pragmas errors. This issue may appear when redirecting an ISO C floating point function to a different ABI at the same time that finite redirections are expected. This patch moves all of the common redirections done in math-finite.h to a new header called mathcalls-redir.h. The new header uses 2 new macros to classify whether a function should be redirected or not: - __MATH_REDIR_FINITE: redirects the functions that are part of the finite ABI when set to 1. - __MATH_REDIR_NON_FINITE: redirects all the other math functions when set to 1. With this mechanism, math-finite.h can redirect its functions by using __MATH_REDIR_FINITE = 1 and __MATH_REDIR_NON_FINITE = 0. mathcalls-redir.h also provides alternative redirection destinations in order to support functions that should not be redirected to the same name pattern of the rest of the functions, i.e.: __fpclassify, __signbit, __iseqsig, __issignaling, isinf, finite and isnan, which will be redirected to __*f128 instead of __*ieee128 used for the rest. In another change, math-finite.h inline functions are modified in order to benefit from functions that have already been redirected. Macro __REDIRTO_PUBLIC_F is used to reuse functions that are already available in the API, e.g. lgammal is is an inline function that calls __lgammal_r_finite, which has already been redirected via assembly to __lgammaf128_r_finite. The inline function could be directly redirected to its respective f128 as it isn't guaranteed to be available in the API. 2018-06-06 Tulio Magno Quites Machado Filho * include/bits/mathcalls-redir.h: New file * math/Makefile (headers): Add bits/mathcalls-redir.h. * math/bits/math-finite.h: Move most of the functions to bits/mathcalls-redir.h. * math/bits/mathcalls-redir.h: New file. * math/math.h: Define __REDIRTO_PUBLIC_X before including bits/math-finite.h. Undefine it afterwards. Signed-off-by: Tulio Magno Quites Machado Filho --- include/bits/mathcalls-redir.h | 1 + math/Makefile | 3 +- math/bits/math-finite.h | 151 +++----------- math/bits/mathcalls-redir.h | 460 +++++++++++++++++++++++++++++++++++++++++ math/math.h | 34 +++ 5 files changed, 530 insertions(+), 119 deletions(-) create mode 100644 include/bits/mathcalls-redir.h create mode 100644 math/bits/mathcalls-redir.h diff --git a/include/bits/mathcalls-redir.h b/include/bits/mathcalls-redir.h new file mode 100644 index 0000000000..74a009eb1d --- /dev/null +++ b/include/bits/mathcalls-redir.h @@ -0,0 +1 @@ +#include diff --git a/math/Makefile b/math/Makefile index ea141cbf99..a1a248a1a4 100644 --- a/math/Makefile +++ b/math/Makefile @@ -29,7 +29,8 @@ headers := math.h bits/mathcalls.h bits/mathinline.h \ bits/libm-simd-decl-stubs.h bits/iscanonical.h \ bits/flt-eval-method.h bits/fp-fast.h bits/fp-logb.h \ bits/long-double.h bits/mathcalls-helper-functions.h \ - bits/floatn.h bits/floatn-common.h bits/mathcalls-narrow.h + bits/floatn.h bits/floatn-common.h bits/mathcalls-narrow.h \ + bits/mathcalls-redir.h # FPU support code. aux := setfpucw fpu_control diff --git a/math/bits/math-finite.h b/math/bits/math-finite.h index 0799fe7b29..90dd9d896b 100644 --- a/math/bits/math-finite.h +++ b/math/bits/math-finite.h @@ -20,96 +20,33 @@ # error "Never use directly; include instead." #endif -#define __REDIRFROM(...) __REDIRFROM_X(__VA_ARGS__) - -#define __REDIRTO(...) __REDIRTO_X(__VA_ARGS__) - -#define __MATH_REDIRCALL_X(from, args, to) \ - extern _Mdouble_ __REDIRECT_NTH (from, args, to) -#define __MATH_REDIRCALL(function, reentrant, args) \ - __MATH_REDIRCALL_X \ - (__REDIRFROM (function, reentrant), args, \ - __REDIRTO (function, reentrant)) -#define __MATH_REDIRCALL_2(from, reentrant, args, to) \ - __MATH_REDIRCALL_X \ - (__REDIRFROM (from, reentrant), args, \ - __REDIRTO (to, reentrant)) - -#define __MATH_REDIRCALL_INTERNAL(function, reentrant, args) \ - __MATH_REDIRCALL_X \ - (__REDIRFROM (__CONCAT (__, function), \ - __CONCAT (reentrant, _finite)), \ - args, __REDIRTO (function, _r)) - - -/* acos. */ -__MATH_REDIRCALL (acos, , (_Mdouble_)); - -#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 -/* acosh. */ -__MATH_REDIRCALL (acosh, , (_Mdouble_)); -#endif +#define __REDIRFROM_F(...) __REDIRFROM_X(__VA_ARGS__) -/* asin. */ -__MATH_REDIRCALL (asin, , (_Mdouble_)); +#define __REDIRTO_F(...) __REDIRTO_X(__VA_ARGS__) -/* atan2. */ -__MATH_REDIRCALL (atan2, , (_Mdouble_, _Mdouble_)); +/* Redirects to a function that is part of the API. */ +#define __REDIRTO_PUBLIC_F(...) __REDIRTO_PUBLIC_X(__VA_ARGS__) -#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 -/* atanh. */ -__MATH_REDIRCALL (atanh, , (_Mdouble_)); -#endif -/* cosh. */ -__MATH_REDIRCALL (cosh, , (_Mdouble_)); +#define __MATH_REDIR_X(type, from, args, to) \ + extern type __REDIRECT_NTH (from, args, to) +#define __MATH_REDIRCALL(function, reentrant, args) \ + __MATH_REDIR_X (_Mdouble_, \ + __REDIRFROM_F (function, reentrant), args, \ + __REDIRTO_F (function, reentrant)) -/* exp. */ -__MATH_REDIRCALL (exp, , (_Mdouble_)); +#define __MATH_REDIRCALL_INTERNAL(function, reentrant, args) \ + __MATH_REDIR_X (_Mdouble_, \ + __REDIRFROM_F (__CONCAT (__, function), \ + __CONCAT (reentrant, _finite)), \ + args, __REDIRTO_F (function, _r)) -#if __GLIBC_USE (IEC_60559_FUNCS_EXT) -/* exp10. */ -__MATH_REDIRCALL (exp10, , (_Mdouble_)); -#endif -#ifdef __USE_ISOC99 -/* exp2. */ -__MATH_REDIRCALL (exp2, , (_Mdouble_)); -#endif - -/* fmod. */ -__MATH_REDIRCALL (fmod, , (_Mdouble_, _Mdouble_)); - -#if defined __USE_XOPEN || defined __USE_ISOC99 -/* hypot. */ -__MATH_REDIRCALL (hypot, , (_Mdouble_, _Mdouble_)); -#endif - -#if (__MATH_DECLARING_DOUBLE && (defined __USE_MISC || defined __USE_XOPEN)) \ - || (!__MATH_DECLARING_DOUBLE && defined __USE_MISC) -/* j0. */ -__MATH_REDIRCALL (j0, , (_Mdouble_)); - -/* y0. */ -__MATH_REDIRCALL (y0, , (_Mdouble_)); - -/* j1. */ -__MATH_REDIRCALL (j1, , (_Mdouble_)); - -/* y1. */ -__MATH_REDIRCALL (y1, , (_Mdouble_)); - -/* jn. */ -__MATH_REDIRCALL (jn, , (int, _Mdouble_)); - -/* yn. */ -__MATH_REDIRCALL (yn, , (int, _Mdouble_)); -#endif - -#ifdef __USE_MISC -/* lgamma_r. */ -__MATH_REDIRCALL (lgamma, _r, (_Mdouble_, int *)); -#endif +#define __MATH_REDIR_FINITE 1 +#define __MATH_REDIR_NON_FINITE 0 +#include +#undef __MATH_REDIR_FINITE +#undef __MATH_REDIR_NON_FINITE /* Redirect __lgammal_r_finite to __lgamma_r_finite when __NO_LONG_DOUBLE_MATH is set and to itself otherwise. It also redirects __lgamma_r_finite and @@ -120,13 +57,13 @@ __MATH_REDIRCALL_INTERNAL (lgamma, _r, (_Mdouble_, int *)); && defined __extern_always_inline) /* lgamma. */ __extern_always_inline _Mdouble_ -__NTH (__REDIRFROM (lgamma, ) (_Mdouble_ __d)) +__NTH (__REDIRFROM_F (lgamma, ) (_Mdouble_ __d)) { # if defined __USE_MISC || defined __USE_XOPEN - return __REDIRTO (lgamma, _r) (__d, &signgam); + return __REDIRTO_PUBLIC_F (lgamma, _r) (__d, &signgam); # else int __local_signgam = 0; - return __REDIRTO (lgamma, _r) (__d, &__local_signgam); + return __REDIRTO_PUBLIC_F (lgamma, _r) (__d, &__local_signgam); # endif } #endif @@ -135,30 +72,13 @@ __NTH (__REDIRFROM (lgamma, ) (_Mdouble_ __d)) && defined __extern_always_inline) && !__MATH_DECLARING_FLOATN /* gamma. */ __extern_always_inline _Mdouble_ -__NTH (__REDIRFROM (gamma, ) (_Mdouble_ __d)) +__NTH (__REDIRFROM_F (gamma, ) (_Mdouble_ __d)) { - return __REDIRTO (lgamma, _r) (__d, &signgam); + return __REDIRTO_PUBLIC_F (lgamma, _r) (__d, &signgam); } #endif -/* log. */ -__MATH_REDIRCALL (log, , (_Mdouble_)); - -/* log10. */ -__MATH_REDIRCALL (log10, , (_Mdouble_)); - -#ifdef __USE_ISOC99 -/* log2. */ -__MATH_REDIRCALL (log2, , (_Mdouble_)); -#endif - -/* pow. */ -__MATH_REDIRCALL (pow, , (_Mdouble_, _Mdouble_)); -#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 -/* remainder. */ -__MATH_REDIRCALL (remainder, , (_Mdouble_, _Mdouble_)); -#endif #if ((__MATH_DECLARING_DOUBLE \ && (defined __USE_MISC \ @@ -169,29 +89,24 @@ __MATH_REDIRCALL (remainder, , (_Mdouble_, _Mdouble_)); __MATH_REDIRCALL (scalb, , (_Mdouble_, _Mdouble_)); #endif -/* sinh. */ -__MATH_REDIRCALL (sinh, , (_Mdouble_)); - -/* sqrt. */ -__MATH_REDIRCALL (sqrt, , (_Mdouble_)); - #if defined __USE_ISOC99 && defined __extern_always_inline /* tgamma. */ +# if __HAVE_DISTINCT_FLOAT128 && !__HAVE_FLOAT128_UNLIKE_LDBL +__MATH_REDIRCALL_INTERNAL (gamma, _r, (_Mdouble_, int *)); +# else extern _Mdouble_ -__REDIRFROM (__gamma, _r_finite) (_Mdouble_, int *); +__REDIRFROM_F (__gamma, _r_finite) (_Mdouble_, int *); +# endif __extern_always_inline _Mdouble_ -__NTH (__REDIRFROM (tgamma, ) (_Mdouble_ __d)) +__NTH (__REDIRFROM_F (tgamma, ) (_Mdouble_ __d)) { int __local_signgam = 0; - _Mdouble_ __res = __REDIRTO (gamma, _r) (__d, &__local_signgam); + _Mdouble_ __res = __REDIRTO_PUBLIC_F (gamma, _r) (__d, &__local_signgam); return __local_signgam < 0 ? -__res : __res; } #endif -#undef __REDIRFROM -#undef __REDIRTO #undef __MATH_REDIRCALL -#undef __MATH_REDIRCALL_2 #undef __MATH_REDIRCALL_INTERNAL -#undef __MATH_REDIRCALL_X +#undef __MATH_REDIR_X diff --git a/math/bits/mathcalls-redir.h b/math/bits/mathcalls-redir.h new file mode 100644 index 0000000000..0f1f325647 --- /dev/null +++ b/math/bits/mathcalls-redir.h @@ -0,0 +1,460 @@ +/* Redirections of math functions. + Copyright (C) 2018 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 + . */ + +/* Functions classified as __MATH_REDIR_FINITE == 1 provide finite + implementations. + Meanwhile functions classified as __MATH_REDIR_NON_FINITE == 1 do not + provide finite implementations. + This distinction is required to avoid duplicated redirections when a finite + implementation is requested. */ + +#ifndef _MATH_H +# error "Never use directly; include instead." +#endif + +#define __REDIRFROM(...) __REDIRFROM_X(__VA_ARGS__) + +#define __REDIRTO(...) __REDIRTO_X(__VA_ARGS__) + +#define __REDIRTO_ALT(...) __REDIRTO_ALT_X(__VA_ARGS__) + +/* Floating point types may not have a public API available. In those cases, + functions must be redirected via assembly or via a public API. */ + +#define __MATH_REDIR(function, reentrant, args) \ + __MATH_REDIR_X (_Mdouble_, \ + __REDIRFROM (function, reentrant), args, \ + __REDIRTO (function, reentrant)) + +#define __MATH_REDIR_T(type, function, reentrant, args) \ + __MATH_REDIR_X (type, \ + __REDIRFROM (function, reentrant), args, \ + __REDIRTO (function, reentrant)) + +#define __MATH_REDIR_TO_ALT(type, from, reentrant, args, to) \ + __MATH_REDIR_X (type, \ + __REDIRFROM (from, reentrant), args, \ + __REDIRTO_ALT (to, reentrant)) + +#define __MATH_REDIR_ALT(type, function, reentrant, args) \ + __MATH_REDIR_X (type, \ + __REDIRFROM (function, reentrant), args, \ + __REDIRTO_ALT (function, reentrant)) + +/* Helper functions. */ + +#if __MATH_REDIR_NON_FINITE == 1 +/* Classify given number. */ +__MATH_REDIR_TO_ALT (int, __fpclassify,, (_Mdouble_ __value), fpclassify); + +/* Test for negative number. */ +__MATH_REDIR_TO_ALT (int, __signbit,, (_Mdouble_ __value), signbit); + +/* Test equality. */ +__MATH_REDIR_TO_ALT (int, __iseqsig,, (_Mdouble_ __x, _Mdouble_ __y), iseqsig); + +/* Test for signaling NaN. */ +__MATH_REDIR_TO_ALT (int, __issignaling,, (_Mdouble_ __value), issignaling); +#endif /* __MATH_REDIR_NON_FINITE == 1 */ + + +/* Trigonometric functions. */ + +#if __MATH_REDIR_FINITE == 1 +/* Arc cosine of X. */ +__MATH_REDIR (acos,, (_Mdouble_ __x)); +/* Arc sine of X. */ +__MATH_REDIR (asin,, (_Mdouble_ __x)); +/* Arc tangent of Y/X. */ +__MATH_REDIR (atan2,, (_Mdouble_ __y, _Mdouble_ __x)); +#endif /* __MATH_REDIR_FINITE == 1 */ + +#if __MATH_REDIR_NON_FINITE == 1 +/* Arc tangent of X. */ +__MATH_REDIR (atan,, (_Mdouble_ __x)); +/* Cosine of X. */ +__MATH_REDIR (cos,, (_Mdouble_ __x)); +/* Sine of X. */ +__MATH_REDIR (sin,, (_Mdouble_ __x)); +/* Tangent of X. */ +__MATH_REDIR (tan,, (_Mdouble_ __x)); +#endif /* __MATH_REDIR_NON_FINITE == 1 */ + + +/* Hyperbolic functions. */ + +#if __MATH_REDIR_FINITE == 1 +/* Hyperbolic cosine of X. */ +__MATH_REDIR (cosh,, (_Mdouble_ __x)); +/* Hyperbolic sine of X. */ +__MATH_REDIR (sinh,, (_Mdouble_ __x)); + +# if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 +/* Hyperbolic arc cosine of X. */ +__MATH_REDIR (acosh,, (_Mdouble_ __x)); +/* Hyperbolic arc tangent of X. */ +__MATH_REDIR (atanh,, (_Mdouble_ __x)); +# endif /* defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 */ +#endif /* __MATH_REDIR_FINITE == 1 */ + +#if __MATH_REDIR_NON_FINITE == 1 +# if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 +/* Hyperbolic arc sine of X. */ +__MATH_REDIR (asinh,, (_Mdouble_ __x)); +# endif + +/* Hyperbolic tangent of X. */ +__MATH_REDIR (tanh,, (_Mdouble_ __x)); + +# ifdef __USE_GNU +/* Cosine and sine of X. */ +__MATH_REDIR_T (void, sincos,, + (_Mdouble_ __x, _Mdouble_ *__sinx, _Mdouble_ *__cosx)); +# endif /* defined __USE_GNU */ +#endif /* __MATH_REDIR_NON_FINITE == 1 */ + + +/* Exponential and logarithmic functions. */ + +#if __MATH_REDIR_FINITE == 1 +/* Exponential function of X. */ +__MATH_REDIR (exp,, (_Mdouble_ __x)); + +/* Natural logarithm of X. */ +__MATH_REDIR (log,, (_Mdouble_ __x)); + +/* Base-ten logarithm of X. */ +__MATH_REDIR (log10,, (_Mdouble_ __x)); + +# if __GLIBC_USE (IEC_60559_FUNCS_EXT) +/* Compute exponent to base ten. */ +__MATH_REDIR (exp10,, (_Mdouble_ __x)); +# endif /*__GLIBC_USE (IEC_60559_FUNCS_EXT) */ + +# ifdef __USE_ISOC99 +/* Compute base-2 exponential of X. */ +__MATH_REDIR (exp2,, (_Mdouble_ __x)); + +/* Compute base-2 logarithm of X. */ +__MATH_REDIR (log2,, (_Mdouble_ __x)); +# endif /* defined __USE_ISOC99 */ +#endif /* __MATH_REDIR_FINITE == 1 */ + +#if __MATH_REDIR_NON_FINITE == 1 +/* Break VALUE into a normalized fraction and an integral power of 2. */ +__MATH_REDIR (frexp,, (_Mdouble_ __x, int *__exponent)); + +/* X times (two to the EXP power). */ +__MATH_REDIR (ldexp,, (_Mdouble_ __x, int __exponent)); + +/* Break VALUE into integral and fractional parts. */ +__MATH_REDIR (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr)); + +# if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 +/* Return exp(X) - 1. */ +__MATH_REDIR (expm1,, (_Mdouble_ __x)); + +/* Return log(1 + X). */ +__MATH_REDIR (log1p,, (_Mdouble_ __x)); + +/* Return the base 2 signed integral exponent of X. */ +__MATH_REDIR (logb,, (_Mdouble_ __x)); +# endif /* defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 */ +#endif /* __MATH_REDIR_NON_FINITE == 1 */ + + +/* Power functions. */ + +#if __MATH_REDIR_FINITE == 1 +/* Return X to the Y power. */ +__MATH_REDIR (pow,, (_Mdouble_ __x, _Mdouble_ __y)); + +/* Return the square root of X. */ +__MATH_REDIR (sqrt,, (_Mdouble_ __x)); + +# if defined __USE_XOPEN || defined __USE_ISOC99 +/* Return `sqrt(X*X + Y*Y)'. */ +__MATH_REDIR (hypot,, (_Mdouble_ __x, _Mdouble_ __y)); +# endif +#endif /* __MATH_REDIR_FINITE == 1 */ + +#if __MATH_REDIR_NON_FINITE == 1 +#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 +/* Return the cube root of X. */ +__MATH_REDIR (cbrt,, (_Mdouble_ __x)); +#endif +#endif /* __MATH_REDIR_NON_FINITE == 1 */ + + +/* Nearest integer, absolute value, and remainder functions. */ + +#if __MATH_REDIR_FINITE == 1 +/* Floating-point modulo remainder of X/Y. */ +__MATH_REDIR (fmod,, (_Mdouble_ __x, _Mdouble_ __y)); +#endif /* __MATH_REDIR_FINITE == 1 */ + +#if __MATH_REDIR_NON_FINITE == 1 +/* Smallest integral value not less than X. */ +__MATH_REDIR (ceil,, (_Mdouble_ __x)); + +/* Absolute value of X. */ +__MATH_REDIR (fabs,, (_Mdouble_ __x)); + +/* Largest integer not greater than X. */ +__MATH_REDIR (floor,, (_Mdouble_ __x)); + +# ifdef __USE_MISC +# if ((!defined __cplusplus \ + || __cplusplus < 201103L /* isinf conflicts with C++11. */ \ + || __MATH_DECLARING_DOUBLE == 0)) /* isinff or isinfl don't. */ \ + && !__MATH_DECLARING_FLOATN +/* Return 0 if VALUE is finite or NaN, +1 if it + is +Infinity, -1 if it is -Infinity. */ +__MATH_REDIR_ALT (int, isinf,, (_Mdouble_ __value)); +# endif + +# if !__MATH_DECLARING_FLOATN +/* Return nonzero if VALUE is finite and not NaN. */ +__MATH_REDIR_ALT (int, finite,, (_Mdouble_ __value)); +/* Return the remainder of X/Y. */ +__MATH_REDIR (drem,, (_Mdouble_ __x, _Mdouble_ __y)); + +/* Return the fractional part of X after dividing out `ilogb (X)'. */ +__MATH_REDIR (significand,, (_Mdouble_ __x)); +# endif + +# endif /* Use misc. */ + +# ifdef __USE_ISOC99 +/* Return X with its signed changed to Y's. */ +__MATH_REDIR (copysign,, (_Mdouble_ __x, _Mdouble_ __y)); +# endif + +# ifdef __USE_ISOC99 +/* Return representation of qNaN for double type. */ +__MATH_REDIR (nan,, (const char *__tagb)); +# endif + + +# if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K) +# if ((!defined __cplusplus \ + || __cplusplus < 201103L /* isnan conflicts with C++11. */ \ + || __MATH_DECLARING_DOUBLE == 0)) /* isnanf or isnanl don't. */ \ + && !__MATH_DECLARING_FLOATN +/* Return nonzero if VALUE is not a number. */ +__MATH_REDIR_ALT (int, isnan,, (_Mdouble_ __value)); +# endif +# endif +#endif /* __MATH_REDIR_NON_FINITE == 1 */ + + +#if __MATH_REDIR_FINITE == 1 +# if defined __USE_MISC || (defined __USE_XOPEN && __MATH_DECLARING_DOUBLE) +/* Bessel functions. */ +__MATH_REDIR (j0,, (_Mdouble_)); +__MATH_REDIR (j1,, (_Mdouble_)); +__MATH_REDIR (jn,, (int, _Mdouble_)); +__MATH_REDIR (y0,, (_Mdouble_)); +__MATH_REDIR (y1,, (_Mdouble_)); +__MATH_REDIR (yn,, (int, _Mdouble_)); +# endif + +# ifdef __USE_MISC +/* Reentrant version of lgamma. This function uses the global variable + `signgam'. The reentrant version instead takes a pointer and stores + the value through it. */ +__MATH_REDIR (lgamma,_r, (_Mdouble_, int *__signgamp)); +# endif + +# if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 +/* Return the remainder of integer divison X / Y with infinite precision. */ +__MATH_REDIR (remainder,, (_Mdouble_ __x, _Mdouble_ __y)); +# endif +#endif /* __MATH_REDIR_FINITE == 1 */ + + +#if __MATH_REDIR_NON_FINITE == 1 +# if defined __USE_XOPEN || defined __USE_ISOC99 +/* Error and gamma functions. */ +__MATH_REDIR (erf,, (_Mdouble_)); +__MATH_REDIR (erfc,, (_Mdouble_)); +__MATH_REDIR (lgamma,, (_Mdouble_)); +# endif + +# ifdef __USE_ISOC99 +/* True gamma function. */ +__MATH_REDIR (tgamma,, (_Mdouble_)); +# endif + +# if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K) +# if !__MATH_DECLARING_FLOATN +/* Obsolete alias for `lgamma'. */ +__MATH_REDIR (gamma,, (_Mdouble_)); +# endif +# endif + + +# if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 +/* Return the integer nearest X in the direction of the + prevailing rounding mode. */ +__MATH_REDIR (rint,, (_Mdouble_ __x)); + +/* Return X + epsilon if X < Y, X - epsilon if X > Y. */ +__MATH_REDIR (nextafter,, (_Mdouble_ __x, _Mdouble_ __y)); +# if defined __USE_ISOC99 && !defined __LDBL_COMPAT && !__MATH_DECLARING_FLOATN +__MATH_REDIR (nexttoward,, (_Mdouble_ __x, long double __y)); +# endif + +# if __GLIBC_USE (IEC_60559_BFP_EXT) || __MATH_DECLARING_FLOATN +/* Return X - epsilon. */ +__MATH_REDIR (nextdown,, (_Mdouble_ __x)); +/* Return X + epsilon. */ +__MATH_REDIR (nextup,, (_Mdouble_ __x)); +# endif + +# ifdef __USE_ISOC99 +/* Return X times (2 to the Nth power). */ +__MATH_REDIR (scalbn,, (_Mdouble_ __x, int __n)); +# endif + +/* Return the binary exponent of X, which must be nonzero. */ +__MATH_REDIR_T (int, ilogb,, (_Mdouble_ __x)); +# endif + +# if __GLIBC_USE (IEC_60559_BFP_EXT) || __MATH_DECLARING_FLOATN +/* Like ilogb, but returning long int. */ +__MATH_REDIR_T (long int, llogb,, (_Mdouble_ __x)); +# endif + +# ifdef __USE_ISOC99 +/* Return X times (2 to the Nth power). */ +__MATH_REDIR (scalbln,, (_Mdouble_ __x, long int __n)); + +/* Round X to integral value in floating-point format using current + rounding direction, but do not raise inexact exception. */ +__MATH_REDIR (nearbyint,, (_Mdouble_ __x)); + +/* Round X to nearest integral value, rounding halfway cases away from + zero. */ +__MATH_REDIR (round,, (_Mdouble_ __x)); + +/* Round X to the integral value in floating-point format nearest but + not larger in magnitude. */ +__MATH_REDIR (trunc,, (_Mdouble_ __x)); + +/* Compute remainder of X and Y and put in *QUO a value with sign of x/y + and magnitude congruent `mod 2^n' to the magnitude of the integral + quotient x/y, with n >= 3. */ +__MATH_REDIR (remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo)); + + +/* Conversion functions. */ + +/* Round X to nearest integral value according to current rounding + direction. */ +__MATH_REDIR_T (long int, lrint,, (_Mdouble_ __x)); +__extension__ +__MATH_REDIR_T (long long int, llrint,, (_Mdouble_ __x)); + +/* Round X to nearest integral value, rounding halfway cases away from + zero. */ +__MATH_REDIR_T (long int, lround,, (_Mdouble_ __x)); +__extension__ +__MATH_REDIR_T (long long int, llround,, (_Mdouble_ __x)); + + +/* Return positive difference between X and Y. */ +__MATH_REDIR (fdim,, (_Mdouble_ __x, _Mdouble_ __y)); + +/* Return maximum numeric value from X and Y. */ +__MATH_REDIR (fmax,, (_Mdouble_ __x, _Mdouble_ __y)); + +/* Return minimum numeric value from X and Y. */ +__MATH_REDIR (fmin,, (_Mdouble_ __x, _Mdouble_ __y)); + +/* Multiply-add function computed as a ternary operation. */ +__MATH_REDIR (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z)); +# endif /* Use ISO C99. */ + +# if __GLIBC_USE (IEC_60559_BFP_EXT) || __MATH_DECLARING_FLOATN +/* Round X to nearest integer value, rounding halfway cases to even. */ +__MATH_REDIR (roundeven,, (_Mdouble_ __x)); + +/* Round X to nearest signed integer value, not raising inexact, with + control of rounding direction and width of result. */ +__MATH_REDIR_T (__intmax_t, fromfp,, (_Mdouble_ __x, int __round, + unsigned int __width)); + +/* Round X to nearest unsigned integer value, not raising inexact, + with control of rounding direction and width of result. */ +__MATH_REDIR_T (__uintmax_t, ufromfp,, (_Mdouble_ __x, int __round, + unsigned int __width)); + +/* Round X to nearest signed integer value, raising inexact for + non-integers, with control of rounding direction and width of + result. */ +__MATH_REDIR_T (__intmax_t, fromfpx,, (_Mdouble_ __x, int __round, + unsigned int __width)); + +/* Round X to nearest unsigned integer value, raising inexact for + non-integers, with control of rounding direction and width of + result. */ +__MATH_REDIR_T (__uintmax_t, ufromfpx,, (_Mdouble_ __x, int __round, + unsigned int __width)); + +/* Return value with maximum magnitude. */ +__MATH_REDIR (fmaxmag,, (_Mdouble_ __x, _Mdouble_ __y)); + +/* Return value with minimum magnitude. */ +__MATH_REDIR (fminmag,, (_Mdouble_ __x, _Mdouble_ __y)); + +/* Total order operation. */ +__MATH_REDIR_T (int, totalorder,, (_Mdouble_ __x, _Mdouble_ __y)); + +/* Total order operation on absolute values. */ +__MATH_REDIR_T (int, totalordermag,, (_Mdouble_ __x, _Mdouble_ __y)); + +/* Canonicalize floating-point representation. */ +__MATH_REDIR_T (int, canonicalize,, (_Mdouble_ *__cx, const _Mdouble_ *__x)); + +/* Get NaN payload. */ +__MATH_REDIR (getpayload,, (const _Mdouble_ *__x)); + +/* Set quiet NaN payload. */ +__MATH_REDIR_T (int, setpayload,, (_Mdouble_ *__x, _Mdouble_ __payload)); + +/* Set signaling NaN payload. */ +__MATH_REDIR_T (int, setpayloadsig,, (_Mdouble_ *__x, _Mdouble_ __payload)); +# endif + +# if (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \ + && __MATH_DECLARING_DOUBLE \ + && !defined __USE_XOPEN2K8)) \ + && !__MATH_DECLARING_FLOATN +/* Return X times (2 to the Nth power). */ +__MATH_REDIR (scalb,, (_Mdouble_ __x, _Mdouble_ __n)); +# endif +#endif /* __MATH_REDIR_NON_FINITE == 1 */ + +#undef __MATH_REDIR +#undef __MATH_REDIR_T +#undef __MATH_REDIR_TO_ALT +#undef __MATH_REDIR_ALT +#undef __REDIRTO_ALT +#undef __REDIRTO +#undef __REDIRFROM diff --git a/math/math.h b/math/math.h index ddee4e4083..3edf275e26 100644 --- a/math/math.h +++ b/math/math.h @@ -1252,12 +1252,15 @@ iszero (__T __val) function ## reentrant # define __REDIRTO_X(function, reentrant) \ __ ## function ## reentrant ## _finite +# define __REDIRTO_PUBLIC_X(function, reentrant) \ + __REDIRTO_X(function, reentrant) # include # undef _Mdouble_ # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN # undef __REDIRFROM_X # undef __REDIRTO_X +# undef __REDIRTO_PUBLIC_X /* When __USE_ISOC99 is defined, include math-finite for float and long double, as well. */ @@ -1271,12 +1274,15 @@ iszero (__T __val) function ## f ## reentrant # define __REDIRTO_X(function, reentrant) \ __ ## function ## f ## reentrant ## _finite +# define __REDIRTO_PUBLIC_X(function, reentrant) \ + __REDIRTO_X(function, reentrant) # include # undef _Mdouble_ # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN # undef __REDIRFROM_X # undef __REDIRTO_X +# undef __REDIRTO_PUBLIC_X /* Include bits/math-finite.h for long double. */ # ifdef __MATH_DECLARE_LDOUBLE @@ -1288,9 +1294,13 @@ iszero (__T __val) # ifdef __NO_LONG_DOUBLE_MATH # define __REDIRTO_X(function, reentrant) \ __ ## function ## reentrant ## _finite +# define __REDIRTO_PUBLIC_X(function, reentrant) \ + __REDIRTO_X(function, reentrant) # else # define __REDIRTO_X(function, reentrant) \ __ ## function ## l ## reentrant ## _finite +# define __REDIRTO_PUBLIC_X(function, reentrant) \ + __REDIRTO_X(function, reentrant) # endif # include # undef _Mdouble_ @@ -1298,6 +1308,7 @@ iszero (__T __val) # undef __MATH_DECLARING_FLOATN # undef __REDIRFROM_X # undef __REDIRTO_X +# undef __REDIRTO_PUBLIC_X # endif # endif /* __USE_ISOC99. */ @@ -1314,6 +1325,8 @@ iszero (__T __val) # if __HAVE_DISTINCT_FLOAT16 # define __REDIRTO_X(function, reentrant) \ __ ## function ## f16 ## reentrant ## _finite +# define __REDIRTO_PUBLIC_X(function, reentrant) \ + __REDIRTO_X(function, reentrant) # else # error "non-disinct _Float16" # endif @@ -1323,6 +1336,7 @@ iszero (__T __val) # undef __MATH_DECLARING_FLOATN # undef __REDIRFROM_X # undef __REDIRTO_X +# undef __REDIRTO_PUBLIC_X # endif # if (__HAVE_DISTINCT_FLOAT32 || (__HAVE_FLOAT32 && !defined _LIBC)) \ @@ -1339,12 +1353,15 @@ iszero (__T __val) # define __REDIRTO_X(function, reentrant) \ __ ## function ## f ## reentrant ## _finite # endif +# define __REDIRTO_PUBLIC_X(function, reentrant) \ + __REDIRTO_X(function, reentrant) # include # undef _Mdouble_ # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN # undef __REDIRFROM_X # undef __REDIRTO_X +# undef __REDIRTO_PUBLIC_X # endif # if (__HAVE_DISTINCT_FLOAT64 || (__HAVE_FLOAT64 && !defined _LIBC)) \ @@ -1361,12 +1378,15 @@ iszero (__T __val) # define __REDIRTO_X(function, reentrant) \ __ ## function ## reentrant ## _finite # endif +# define __REDIRTO_PUBLIC_X(function, reentrant) \ + __REDIRTO_X(function, reentrant) # include # undef _Mdouble_ # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN # undef __REDIRFROM_X # undef __REDIRTO_X +# undef __REDIRTO_PUBLIC_X # endif # if (__HAVE_DISTINCT_FLOAT128 || (__HAVE_FLOAT128 && !defined _LIBC)) \ @@ -1379,9 +1399,13 @@ iszero (__T __val) # if __HAVE_DISTINCT_FLOAT128 # define __REDIRTO_X(function, reentrant) \ __ ## function ## f128 ## reentrant ## _finite +# define __REDIRTO_PUBLIC_X(function, reentrant) \ + __REDIRTO_X(function, reentrant) # else # define __REDIRTO_X(function, reentrant) \ __ ## function ## l ## reentrant ## _finite +# define __REDIRTO_PUBLIC_X(function, reentrant) \ + __REDIRTO_X(function, reentrant) # endif # include # undef _Mdouble_ @@ -1389,6 +1413,7 @@ iszero (__T __val) # undef __MATH_DECLARING_FLOATN # undef __REDIRFROM_X # undef __REDIRTO_X +# undef __REDIRTO_PUBLIC_X # endif # if (__HAVE_DISTINCT_FLOAT32X || (__HAVE_FLOAT32X && !defined _LIBC)) \ @@ -1405,12 +1430,15 @@ iszero (__T __val) # define __REDIRTO_X(function, reentrant) \ __ ## function ## reentrant ## _finite # endif +# define __REDIRTO_PUBLIC_X(function, reentrant) \ + __REDIRTO_X(function, reentrant) # include # undef _Mdouble_ # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN # undef __REDIRFROM_X # undef __REDIRTO_X +# undef __REDIRTO_PUBLIC_X # endif # if (__HAVE_DISTINCT_FLOAT64X || (__HAVE_FLOAT64X && !defined _LIBC)) \ @@ -1430,12 +1458,15 @@ iszero (__T __val) # define __REDIRTO_X(function, reentrant) \ __ ## function ## f128 ## reentrant ## _finite # endif +# define __REDIRTO_PUBLIC_X(function, reentrant) \ + __REDIRTO_X(function, reentrant) # include # undef _Mdouble_ # undef __MATH_DECLARING_DOUBLE # undef __MATH_DECLARING_FLOATN # undef __REDIRFROM_X # undef __REDIRTO_X +# undef __REDIRTO_PUBLIC_X # endif # if (__HAVE_DISTINCT_FLOAT128X || (__HAVE_FLOAT128X && !defined _LIBC)) \ @@ -1448,6 +1479,8 @@ iszero (__T __val) # if __HAVE_DISTINCT_FLOAT128X # define __REDIRTO_X(function, reentrant) \ __ ## function ## f128x ## reentrant ## _finite +# define __REDIRTO_PUBLIC_X(function, reentrant) \ + __REDIRTO_X(function, reentrant) # else # error "non-disinct _Float128x" # endif @@ -1457,6 +1490,7 @@ iszero (__T __val) # undef __MATH_DECLARING_FLOATN # undef __REDIRFROM_X # undef __REDIRTO_X +# undef __REDIRTO_PUBLIC_X # endif #endif /* __FINITE_MATH_ONLY__ > 0. */ From patchwork Wed Jun 6 22:39:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tulio Magno Quites Machado Filho X-Patchwork-Id: 926065 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-92972-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="XurO9Sd4"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 411Nxh2pKLz9rxs for ; Thu, 7 Jun 2018 08:43:36 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:in-reply-to:references :message-id; q=dns; s=default; b=uyw7Xe5TejWM+d3vRwKv5e7H5BFQJAo 4q1SkEmC6AwEc85s6B9XQ7QlfhsFxzpGs07piS8E/yKGkH7Qb3gpI6gHVI0DzYyn 1G1+G41Xal5UmtV+QQbrc7vCwCLNrll2j2+P/jlIfE+EiTxB2WJ2J/lTIPCaiBcn ptf01kmwXZx0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:in-reply-to:references :message-id; s=default; bh=rW6Bx2qjrjBcySQSYm+2sKas23U=; b=XurO9 Sd4TbIrsCklkbUth0c+sFvTjJfkW2qqlOjElIOkdBOZmAWo/d1mDiP8vSOyVNTIr aZFcAXGTLvgBnQhXpKLjZcCmVh3ctvtFshxUw+Ewy1IjyVVPTS9BcIuE0glOtJ2F OLplsLBu3DpGp6Bd1axTZ2ZY+kCBG0SbB19lGY= Received: (qmail 84719 invoked by alias); 6 Jun 2018 22:42:50 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 83430 invoked by uid 89); 6 Jun 2018 22:42:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-27.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx0a-001b2d01.pphosted.com From: Tulio Magno Quites Machado Filho To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, gabriel@inconstante.eti.br, raji@linux.ibm.com Subject: [PATCH 8/9] ldbl-128ibm-compat: Redirect long double functions to f128/ieee128 functions Date: Wed, 6 Jun 2018 19:39:08 -0300 In-Reply-To: <20180606223909.16675-1-tuliom@linux.ibm.com> References: <20180606223909.16675-1-tuliom@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18060622-0016-0000-0000-000008E84BBD X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009139; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000265; SDB=6.01043027; UDB=6.00534142; IPR=6.00822157; MB=3.00021491; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-06 22:42:27 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18060622-0017-0000-0000-00003F2594B4 Message-Id: <20180606223909.16675-9-tuliom@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-06-06_10:, , signatures=0 Modify the headers to redirect long double functions to global __*f128 symbols or to __*ieee128 otherwise. Most of the functions benefit from math-redir.h. The only exceptions are nexttowardf and nexttoward that need especial treatment. 2018-06-06 Tulio Magno Quites Machado Filho * include/math.h [__HAVE_DISTINCT_FLOAT128 && !__HAVE_FLOAT128_UNLIKE_LDBL]: Avoid redirecting __finitel, __isinfl, __isnanl, __fpclassifyl, __issignalingl, __expl, __expml and sqrtl as they conflict with the redirections from math/math.h. * sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h [__HAVE_DISTINCT_FLOAT128 && !__HAVE_FLOAT128_UNLIKE_LDBL]: Likewise for function iscanonical(_Float128). * math/math.h [__HAVE_DISTINCT_FLOAT128 && !__HAVE_FLOAT128_UNLIKE_LDBL]: Redirect long double functions to __*f128 or _*ieee128, reusing mathcalls-redir.h. Signed-off-by: Tulio Magno Quites Machado Filho --- include/math.h | 12 +++++- math/math.h | 57 +++++++++++++++++++++++++- sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h | 6 ++- 3 files changed, 70 insertions(+), 5 deletions(-) diff --git a/include/math.h b/include/math.h index e21d34b868..57d77cfd13 100644 --- a/include/math.h +++ b/include/math.h @@ -18,7 +18,9 @@ hidden_proto (__finitef) hidden_proto (__isinff) hidden_proto (__isnanf) -# ifndef __NO_LONG_DOUBLE_MATH +# if !defined __NO_LONG_DOUBLE_MATH \ + && (!__HAVE_DISTINCT_FLOAT128 \ + || (__HAVE_DISTINCT_FLOAT128 && __HAVE_FLOAT128_UNLIKE_LDBL)) hidden_proto (__finitel) hidden_proto (__isinfl) hidden_proto (__isnanl) @@ -40,7 +42,9 @@ libm_hidden_proto (__exp) libm_hidden_proto (__expf) libm_hidden_proto (__roundeven) -# ifndef __NO_LONG_DOUBLE_MATH +# if !defined __NO_LONG_DOUBLE_MATH \ + && (!__HAVE_DISTINCT_FLOAT128 \ + || (__HAVE_DISTINCT_FLOAT128 && __HAVE_FLOAT128_UNLIKE_LDBL)) libm_hidden_proto (__fpclassifyl) libm_hidden_proto (__issignalingl) libm_hidden_proto (__expl) @@ -61,7 +65,11 @@ libm_hidden_proto (__expm1f128) float (sqrtf) (float) asm ("__ieee754_sqrtf"); double (sqrt) (double) asm ("__ieee754_sqrt"); # ifndef __NO_LONG_DOUBLE_MATH +/* Do not redirect sqrtl twice when the long double already redirects it. */ +# if !__HAVE_DISTINCT_FLOAT128 \ + || (__HAVE_DISTINCT_FLOAT128 && __HAVE_FLOAT128_UNLIKE_LDBL) long double (sqrtl) (long double) asm ("__ieee754_sqrtl"); +# endif # endif # if __HAVE_DISTINCT_FLOAT128 > 0 _Float128 (sqrtf128) (_Float128) asm ("__ieee754_sqrtf128"); diff --git a/math/math.h b/math/math.h index 3edf275e26..6ad6c7f6d0 100644 --- a/math/math.h +++ b/math/math.h @@ -348,6 +348,42 @@ extern long double __REDIRECT_NTH (nexttowardl, # define __MATH_DECLARE_LDOUBLE 1 # include # include + +/* Provide ieee long double function redirection. */ +# if !defined __LDBL_COMPAT \ + && __HAVE_DISTINCT_FLOAT128 && !__HAVE_FLOAT128_UNLIKE_LDBL +# define __REDIRFROM_X(function, reentrant) \ + function ## l ## reentrant +# define __REDIRTO_X(function, reentrant) \ + __ ## function ## ieee128 ## reentrant +# define __REDIRTO_ALT_X(function, reentrant) \ + __ ## function ## f128 ## reentrant +# define __MATH_REDIR_X(type, from, args, to) \ + extern type __REDIRECT_NTH (from, args, to); \ + extern type __REDIRECT_NTH (__CONCAT(__,from), args, to); +# if defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0 +/* Do not redirect when finite functions are requested. Leave this job to + bits/math-finite.h. */ +# define __MATH_REDIR_FINITE 0 +# else +# define __MATH_REDIR_FINITE 1 +# endif +# define __MATH_REDIR_NON_FINITE 1 +# include +/* Redirect all nexttoward functions when redirecting long double. */ +__MATH_REDIR_X (float, nexttowardf, (float __x, long double __y), \ + __REDIRTO_X (nexttowardf_to_,)); +__MATH_REDIR_X (double, nexttoward, (double __x, long double __y), \ + __REDIRTO_X (nexttoward_to_,)); + +# undef __MATH_REDIR_NON_FINITE +# undef __MATH_REDIR_FINITE +# undef __MATH_REDIR_X +# undef __REDIRTO_ALT_X +# undef __REDIRTO_X +# undef __REDIRFROM_X +# endif + # undef _Mdouble_ # undef __MATH_PRECNAME # undef __MATH_DECLARING_DOUBLE @@ -511,6 +547,11 @@ extern long double __REDIRECT_NTH (nexttowardl, # ifdef __LDBL_COMPAT # define __MATHCALL_REDIR_NAME(name) f ## name # undef __MATHCALL_NARROW +# define __MATHCALL_NARROW(func, redir, nargs) \ + __MATHCALL_NARROW_REDIR (func, redir, nargs) +# elif __HAVE_DISTINCT_FLOAT128 && !__HAVE_FLOAT128_UNLIKE_LDBL +# define __MATHCALL_REDIR_NAME(name) f32 ## name ## f128 +# undef __MATHCALL_NARROW # define __MATHCALL_NARROW(func, redir, nargs) \ __MATHCALL_NARROW_REDIR (func, redir, nargs) # endif @@ -518,7 +559,8 @@ extern long double __REDIRECT_NTH (nexttowardl, # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME -# ifdef __LDBL_COMPAT +# if defined __LDBL_COMPAT \ + || (__HAVE_DISTINCT_FLOAT128 && !__HAVE_FLOAT128_UNLIKE_LDBL) # undef __MATHCALL_REDIR_NAME # undef __MATHCALL_NARROW # define __MATHCALL_NARROW(func, redir, nargs) \ @@ -531,6 +573,11 @@ extern long double __REDIRECT_NTH (nexttowardl, # ifdef __LDBL_COMPAT # define __MATHCALL_REDIR_NAME(name) __nldbl_d ## name ## l # undef __MATHCALL_NARROW +# define __MATHCALL_NARROW(func, redir, nargs) \ + __MATHCALL_NARROW_REDIR (func, redir, nargs) +# elif __HAVE_DISTINCT_FLOAT128 && !__HAVE_FLOAT128_UNLIKE_LDBL +# define __MATHCALL_REDIR_NAME(name) f64 ## name ## f128 +# undef __MATHCALL_NARROW # define __MATHCALL_NARROW(func, redir, nargs) \ __MATHCALL_NARROW_REDIR (func, redir, nargs) # endif @@ -538,7 +585,8 @@ extern long double __REDIRECT_NTH (nexttowardl, # undef _Mret_ # undef _Marg_ # undef __MATHCALL_NAME -# ifdef __LDBL_COMPAT +# if defined __LDBL_COMPAT \ + || (__HAVE_DISTINCT_FLOAT128 && !__HAVE_FLOAT128_UNLIKE_LDBL) # undef __MATHCALL_REDIR_NAME # undef __MATHCALL_NARROW # define __MATHCALL_NARROW(func, redir, nargs) \ @@ -1296,6 +1344,11 @@ iszero (__T __val) __ ## function ## reentrant ## _finite # define __REDIRTO_PUBLIC_X(function, reentrant) \ __REDIRTO_X(function, reentrant) +# elif __HAVE_DISTINCT_FLOAT128 && !__HAVE_FLOAT128_UNLIKE_LDBL +# define __REDIRTO_X(function, reentrant) \ + __ ## function ## f128 ## reentrant ## _finite +# define __REDIRTO_PUBLIC_X(function, reentrant) \ + __ ## function ## l ## reentrant ## _finite # else # define __REDIRTO_X(function, reentrant) \ __ ## function ## l ## reentrant ## _finite diff --git a/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h b/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h index 60c54cca46..f54e5d9ddb 100644 --- a/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h +++ b/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h @@ -50,7 +50,11 @@ extern "C++" { inline int iscanonical (float __val) { return __iscanonicalf (__val); } inline int iscanonical (double __val) { return __iscanonical (__val); } inline int iscanonical (long double __val) { return __iscanonicall (__val); } -# if __HAVE_DISTINCT_FLOAT128 +/* When using an IEEE 128-bit long double, _Float128 is defined as long double + in C++. */ +# if __HAVE_DISTINCT_FLOAT128 \ + && (!defined __cplusplus \ + || defined __cplusplus && __HAVE_FLOAT128_UNLIKE_LDBL) inline int iscanonical (_Float128 __val) { return __iscanonicalf128 (__val); } # endif } From patchwork Wed Jun 6 22:39:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tulio Magno Quites Machado Filho X-Patchwork-Id: 926066 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-92973-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="AGhHjjEB"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 411Nxy62t2z9rxs for ; Thu, 7 Jun 2018 08:43:50 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:in-reply-to:references :message-id; q=dns; s=default; b=FFi3FFvr659WG1KMS77Mt/OPjk6Yj2X bNyNqdFXIlDooTfF/N++gRPqQcg2SWi8Wjf7Q3eaV4PzcXo9XYEAvLnoJ7soE5aj v2eDXkMRXaaOCk0pXYRb5XOo1HCFA6EQMFSzICI8bsSuvMp+EX1y9vrbb3gYK8t2 te3pe8lwQ/7s= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:in-reply-to:references :message-id; s=default; bh=o54c5hf5qdMWUVVe7CBO+1Z/v3c=; b=AGhHj jEBqBDfVo8Bp0ZldXZ8VyhNXxEpwFuqRs56bI1lHphSvpQXidkZ1mYn+so+jmCX5 oc4UvwatFAFfoSKMahrcimwcT/BcPyhBpf/MxzBOflNpxAw+HkdFEhW++V8fL4j4 Jk42Xcgm8gKu0bUtFg5EaSx1INehEpFPQjZ2SE= Received: (qmail 86778 invoked by alias); 6 Jun 2018 22:43:14 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 84982 invoked by uid 89); 6 Jun 2018 22:42:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-27.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx0a-001b2d01.pphosted.com From: Tulio Magno Quites Machado Filho To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, gabriel@inconstante.eti.br, raji@linux.ibm.com, Rajalakshmi Srinivasaraghavan Subject: [PATCH 9/9] ldbl-128ibm-compat: Redirect complex math functions Date: Wed, 6 Jun 2018 19:39:09 -0300 In-Reply-To: <20180606223909.16675-1-tuliom@linux.ibm.com> References: <20180606223909.16675-1-tuliom@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18060622-0068-0000-0000-000003047342 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009139; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000265; SDB=6.01043027; UDB=6.00534142; IPR=6.00822157; MB=3.00021491; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-06 22:42:42 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18060622-0069-0000-0000-000044980C58 Message-Id: <20180606223909.16675-10-tuliom@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-06-06_10:, , signatures=0 From: Rajalakshmi Srinivasaraghavan The API doesn't change, i.e. compilers using a long double format compatible with the IEEE 128-bit extended precision format are redirected from *l functions to __*ieee128 symbols using the same mechanism already used with -mlong-double-64 for complex math functions. 2018-06-06 Rajalakshmi Srinivasaraghavan * math/complex.h [__HAVE_DISTINCT_FLOAT128 && !__HAVE_FLOAT128_UNLIKE_LDBL]: Redirect long double functions to __*ieee128. --- math/complex.h | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/math/complex.h b/math/complex.h index 544e7acd82..097d6dcb6f 100644 --- a/math/complex.h +++ b/math/complex.h @@ -95,11 +95,15 @@ __BEGIN_DECLS #define __MATHCALL(function, args) \ __MATHDECL (_Mdouble_complex_,function, args) -#define __MATHDECL(type, function, args) \ +#define __MATHDECL_IMPL(type, function, args) \ __MATHDECL_1(type, function, args); \ __MATHDECL_1(type, __CONCAT(__,function), args) -#define __MATHDECL_1(type, function, args) \ +#define __MATHDECL(type, function, args) \ + __MATHDECL_IMPL(type, function, args) +#define __MATHDECL_1_IMPL(type, function, args) \ extern type __MATH_PRECNAME(function) args __THROW +#define __MATHDECL_1(type, function, args) \ + __MATHDECL_1_IMPL(type, function, args) #define _Mdouble_ double #define __MATH_PRECNAME(name) name @@ -122,11 +126,31 @@ __BEGIN_DECLS # undef __MATHDECL_1 # define __MATHDECL_1(type, function, args) \ extern type __REDIRECT_NTH(__MATH_PRECNAME(function), args, function) +# elif __HAVE_DISTINCT_FLOAT128 && !__HAVE_FLOAT128_UNLIKE_LDBL +# undef __MATHDECL_1 +# undef __MATHDECL +# define __REDIR_TO(function) \ + __ ## function ## ieee128 +# define __MATHDECL_1(type, function, alias, args) \ + extern type __REDIRECT_NTH(__MATH_PRECNAME(function), args, alias) +#define __MATHDECL(type, function, args) \ + __MATHDECL_1(type, function, __REDIR_TO(function), args); \ + __MATHDECL_1(type, __CONCAT(__,function), __REDIR_TO(function), args) # endif # define _Mdouble_ long double # define __MATH_PRECNAME(name) name##l # include +# if !defined __LDBL_COMPAT \ + && __HAVE_DISTINCT_FLOAT128 && !__HAVE_FLOAT128_UNLIKE_LDBL +# undef __REDIR_TO +# undef __MATHDECL_1 +# undef __MATHDECL +#define __MATHDECL(type, function, args) \ + __MATHDECL_IMPL(type, function, args) +# define __MATHDECL_1(type, function, args) \ + __MATHDECL_1_IMPL(type, function, args) +# endif #endif #undef _Mdouble_ #undef __MATH_PRECNAME