From patchwork Tue Aug 30 23:39:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. Murphy" X-Patchwork-Id: 664325 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3sP4km1D6Tz9s8x for ; Wed, 31 Aug 2016 09:40:15 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=puvpIuJw; dkim-atps=neutral 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:subject:date:in-reply-to:references :in-reply-to:references:message-id; q=dns; s=default; b=IbLtsQu6 WcTdwMNzvTFAmt6DUBjDNkJmUDZxWYVlrDWXs9bn2plRKtiD4kYYQqTW51hArHGY cBK3APjQkC+CBTw2PZsYqj6+tmrghj3M5unuDFvBZWeNpeBFIAs6OyWZwqwVveDH SB918uqR6GU9g3M2CKe0VLnjclHRvaHMHYs= 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:subject:date:in-reply-to:references :in-reply-to:references:message-id; s=default; bh=8qEzrV7vp23F5d 6B5i+CjMDPJ6E=; b=puvpIuJwLHqksmoq9vGu4iZP2KMDNa+9bkxB/WksJ5YOts TDCWTejfkn6X5G1i0UEzrWHd1HfBdYAL9jKn1zQvuCcP83nU4B7fMhxkqvQf+kLo rlpOhK+E5Y9uR61F1M6CosQ/REgttbqQZdCt3ZPUabJkTN1lYvdlhUv+LA1JE= Received: (qmail 35161 invoked by alias); 30 Aug 2016 23:39:55 -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 35019 invoked by uid 89); 30 Aug 2016 23:39:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW, RCVD_IN_SEMBACKSCATTER autolearn=no version=3.3.2 spammy=math_privateh, UD:math_private.h, math_private.h, 2.4.11 X-HELO: mx0a-001b2d01.pphosted.com X-IBM-Helo: d03dlp01.boulder.ibm.com X-IBM-MailFrom: murphyp@linux.vnet.ibm.com From: "Paul E. Murphy" To: libc-alpha@sourceware.org Subject: [PATCH 2/5] Make common nextdown implementation generic. Date: Tue, 30 Aug 2016 18:39:35 -0500 In-Reply-To: References: In-Reply-To: References: X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16083023-0028-0000-0000-0000057B1A03 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005680; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000184; SDB=6.00751825; UDB=6.00355389; IPR=6.00524631; BA=6.00004681; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012523; XFM=3.00000011; UTC=2016-08-30 23:39:41 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16083023-0029-0000-0000-00002ECF87B5 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-08-30_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=4 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1608300225 With the exception of those machines using the ldbl-opt in an Implies file, this is a trivial transformation. nextdownl is not subject to the non-trivial versioning rules of the other generated functions, so to keep things simple, it is handled as a one-off case in ldbl-opt to preserve the existing behavior. * math/Makefile: (gen-libm-calls): Add s_nextdown. (libm-calls): Remove above. * math/s_nextdown.c: Refactor into ... * math/s_nextdown_template.c: New file. * math/s_nextdownf.c: Removed. * math/s_nextdownl.c: Removed. * sysdeps/ieee754/ldbl-opt/s_nextdownl.c: New file. --- math/Makefile | 4 ++-- math/s_nextdown.c | 33 --------------------------------- math/s_nextdown_template.c | 29 +++++++++++++++++++++++++++++ math/s_nextdownf.c | 29 ----------------------------- math/s_nextdownl.c | 29 ----------------------------- sysdeps/ieee754/ldbl-opt/s_nextdownl.c | 5 +++++ 6 files changed, 36 insertions(+), 93 deletions(-) delete mode 100644 math/s_nextdown.c create mode 100644 math/s_nextdown_template.c delete mode 100644 math/s_nextdownf.c delete mode 100644 math/s_nextdownl.c create mode 100644 sysdeps/ieee754/ldbl-opt/s_nextdownl.c diff --git a/math/Makefile b/math/Makefile index d4b6d98..be6b8ac 100644 --- a/math/Makefile +++ b/math/Makefile @@ -49,7 +49,7 @@ gen-libm-calls = cargF conjF cimagF crealF cabsF s_cacosF \ s_cacoshF s_ccosF s_ccoshF s_casinF s_csinF s_casinhF \ k_casinhF s_csinhF k_casinhF s_csinhF s_catanhF s_catanF \ s_ctanF s_ctanhF s_cexpF s_clogF s_cprojF s_csqrtF \ - s_cpowF s_clog10F s_fdimF + s_cpowF s_clog10F s_fdimF s_nextdownF libm-calls = \ e_acosF e_acoshF e_asinF e_atan2F e_atanhF e_coshF e_expF e_fmodF \ @@ -70,7 +70,7 @@ libm-calls = \ s_fmaF s_lrintF s_llrintF s_lroundF s_llroundF e_exp10F w_log2F \ s_issignalingF $(calls:s_%=m_%) x2y2m1F \ gamma_productF lgamma_negF lgamma_productF \ - s_nextupF s_nextdownF $(gen-libm-calls) + s_nextupF $(gen-libm-calls) libm-compat-calls-ldouble-yes = w_lgamma_compatl k_standardl libm-compat-calls = w_lgamma_compatf w_lgamma_compat k_standard k_standardf \ diff --git a/math/s_nextdown.c b/math/s_nextdown.c deleted file mode 100644 index 06fd1c9..0000000 --- a/math/s_nextdown.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Return the greatest floating-point number less than X. - Copyright (C) 2016 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 - -/* Return the greatest floating-point number less than X. */ -double -__nextdown (double x) -{ - return -__nextup (-x); -} - -weak_alias (__nextdown, nextdown) -#ifdef NO_LONG_DOUBLE -strong_alias (__nextdown, __nextdownl) -weak_alias (__nextdown, nextdownl) -#endif diff --git a/math/s_nextdown_template.c b/math/s_nextdown_template.c new file mode 100644 index 0000000..f286dfd --- /dev/null +++ b/math/s_nextdown_template.c @@ -0,0 +1,29 @@ +/* Return the greatest floating-point number less than X. + Copyright (C) 2016 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 + +/* Return the greatest floating-point number less than X. */ +FLOAT +M_DECL_FUNC (__nextdown) (FLOAT x) +{ + return -M_SUF (__nextup) (-x); +} + +declare_mgen_alias (__nextdown, nextdown); diff --git a/math/s_nextdownf.c b/math/s_nextdownf.c deleted file mode 100644 index c0d4585..0000000 --- a/math/s_nextdownf.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Return the greatest floating-point number less than X. - Copyright (C) 2016 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 - -/* Return the greatest floating-point number less than X. */ -float -__nextdownf (float x) -{ - return -__nextupf (-x); -} - -weak_alias (__nextdownf, nextdownf) diff --git a/math/s_nextdownl.c b/math/s_nextdownl.c deleted file mode 100644 index e7607f5..0000000 --- a/math/s_nextdownl.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Return the greatest floating-point number less than X. - Copyright (C) 2016 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 - -/* Return the greatest floating-point number less than X. */ -long double -__nextdownl (long double x) -{ - return -__nextupl (-x); -} - -weak_alias (__nextdownl, nextdownl) diff --git a/sysdeps/ieee754/ldbl-opt/s_nextdownl.c b/sysdeps/ieee754/ldbl-opt/s_nextdownl.c new file mode 100644 index 0000000..c92c02e --- /dev/null +++ b/sysdeps/ieee754/ldbl-opt/s_nextdownl.c @@ -0,0 +1,5 @@ +/* nextdownl is not subject to complex aliasing rules. It was + added in glibc 2.24. */ +#define declare_mgen_alias(from, to) weak_alias (M_SUF (from), M_SUF (to)) +#include +#include