From patchwork Tue Aug 30 23:39:36 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: 664326 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 3sP4kz01bWz9s8x for ; Wed, 31 Aug 2016 09:40:26 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=OBBarCJj; 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=I5Etkn7h qq5wctcOgYvWyMA0iFGjEgnqsY7hbHjp/ZYUaVZJ64xHdkunWmZhVW0UPliUEijv Sgrfs82RM5sS9Eh823Lk1Qx63en8yCej4qLx+Jglmo/woPelAwHCld6rmP46NdoC JHR4FFVWP2+ME4BrkWq8ObPgud1NjgsTVJ8= 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=2GghTXbcg2JAyn wK0Jqmqc+W+HE=; b=OBBarCJjlW+LyZXPR6izpVVUcRc120S7Em7NxjZmqACziN mpiXMMX5L8/1jScI+WffX3hHc79A7pgy4HKDGQvLp3oS6LcF0epyU2gusHRdlO87 uX74gW3zt/39l4MGZxNRaydbIIW4xaNR6PGFOKipugi/9gEN4WnkZ3K5gK+Ds= Received: (qmail 35213 invoked by alias); 30 Aug 2016 23:39:56 -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 35018 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=drepper, UD:math_ldbl_opt.h, math_ldbl_opth, math_ldbl_opt.h X-HELO: mx0a-001b2d01.pphosted.com X-IBM-Helo: d01dlp02.pok.ibm.com X-IBM-MailFrom: murphyp@linux.vnet.ibm.com From: "Paul E. Murphy" To: libc-alpha@sourceware.org Subject: [PATCH 3/5] Make common fmax implementation generic. Date: Tue, 30 Aug 2016 18:39:36 -0500 In-Reply-To: References: In-Reply-To: References: X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16083023-0040-0000-0000-000001327C6D 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:42 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16083023-0041-0000-0000-0000050D8D2B Message-Id: <90e26382d1e6952eae2a027bc48ebf83d9d1b963.1472599898.git.murphyp@linux.vnet.ibm.com> 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 Also update aarch64 to ensure the correct s_fmin.c is included. The include order favors including the generated copy. * math/Makefile: (gen-libm-calls): Add s_fmax. (libm-calls): Remove above. * math/s_fmax.c: Refactor into ... * math/s_fmax_template.c: New file. * math/s_fmaxf.c: Removed. * math/s_fmaxl.c: Removed. * sysdeps/ieee754/ldbl-opt/math-type-macros-double.h: (LDOUBLE_fmaxl_libm_version): New macro. * sysdeps/ieee754/ldbl-opt/s_fmax.c: Removed. * sysdeps/ieee754/ldbl-opt/s_fmaxl.c: Removed. * sysdeps/aarch64/fpu/s_fmax.c: Append fpu/ to include of s_fmin.c to pick the aarch64 version of the file. * sysdeps/aarch64/fpu/s_fmaxf.c: Likewise. * sysdeps/aarch64/fpu/s_fminf.c: Likewise. --- math/Makefile | 4 +-- math/s_fmax.c | 32 ---------------------- math/s_fmax_template.c | 32 ++++++++++++++++++++++ math/s_fmaxf.c | 28 ------------------- math/s_fmaxl.c | 28 ------------------- sysdeps/aarch64/fpu/s_fmax.c | 2 +- sysdeps/aarch64/fpu/s_fmaxf.c | 2 +- sysdeps/aarch64/fpu/s_fminf.c | 2 +- sysdeps/ieee754/ldbl-opt/math-type-macros-double.h | 1 + sysdeps/ieee754/ldbl-opt/s_fmax.c | 5 ---- sysdeps/ieee754/ldbl-opt/s_fmaxl.c | 5 ---- 11 files changed, 38 insertions(+), 103 deletions(-) delete mode 100644 math/s_fmax.c create mode 100644 math/s_fmax_template.c delete mode 100644 math/s_fmaxf.c delete mode 100644 math/s_fmaxl.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_fmax.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_fmaxl.c diff --git a/math/Makefile b/math/Makefile index be6b8ac..09c4c56 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_nextdownF + s_cpowF s_clog10F s_fdimF s_nextdownF s_fmaxF libm-calls = \ e_acosF e_acoshF e_asinF e_atan2F e_atanhF e_coshF e_expF e_fmodF \ @@ -65,7 +65,7 @@ libm-calls = \ w_tgammaF w_hypotF w_j0F w_j1F w_jnF w_lgammaF w_lgammaF_r \ w_logF w_log10F w_powF w_remainderF w_scalbF w_sinhF w_sqrtF \ w_ilogbF \ - s_fpclassifyF s_fmaxF s_fminF s_nanF s_truncF \ + s_fpclassifyF s_fminF s_nanF s_truncF \ s_remquoF e_log2F e_exp2F s_roundF s_nearbyintF s_sincosF \ s_fmaF s_lrintF s_llrintF s_lroundF s_llroundF e_exp10F w_log2F \ s_issignalingF $(calls:s_%=m_%) x2y2m1F \ diff --git a/math/s_fmax.c b/math/s_fmax.c deleted file mode 100644 index 9a8efce..0000000 --- a/math/s_fmax.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Return maximum numeric value of X and Y. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - 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 - - -double -__fmax (double x, double y) -{ - return (isgreaterequal (x, y) || isnan (y)) ? x : y; -} -weak_alias (__fmax, fmax) -#ifdef NO_LONG_DOUBLE -strong_alias (__fmax, __fmaxl) -weak_alias (__fmax, fmaxl) -#endif diff --git a/math/s_fmax_template.c b/math/s_fmax_template.c new file mode 100644 index 0000000..dea53d4 --- /dev/null +++ b/math/s_fmax_template.c @@ -0,0 +1,32 @@ +/* Return maximum numeric value of X and Y. + Copyright (C) 1997-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + 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 + +FLOAT +M_DECL_FUNC (__fmax) (FLOAT x, FLOAT y) +{ + return (isgreaterequal (x, y) || isnan (y)) ? x : y; +} + +declare_mgen_alias (__fmax, fmax); + +#if M_LIBM_NEED_COMPAT (fmax) +declare_mgen_libm_compat (__fmax, fmax) +#endif diff --git a/math/s_fmaxf.c b/math/s_fmaxf.c deleted file mode 100644 index c241963..0000000 --- a/math/s_fmaxf.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Return maximum numeric value of X and Y. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - 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 - - -float -__fmaxf (float x, float y) -{ - return (isgreaterequal (x, y) || isnan (y)) ? x : y; -} -weak_alias (__fmaxf, fmaxf) diff --git a/math/s_fmaxl.c b/math/s_fmaxl.c deleted file mode 100644 index 3b22735..0000000 --- a/math/s_fmaxl.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Return maximum numeric value of X and Y. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 1997. - - 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 - - -long double -__fmaxl (long double x, long double y) -{ - return (isgreaterequal (x, y) || isnan (y)) ? x : y; -} -weak_alias (__fmaxl, fmaxl) diff --git a/sysdeps/aarch64/fpu/s_fmax.c b/sysdeps/aarch64/fpu/s_fmax.c index bc41ec4..c90de34 100644 --- a/sysdeps/aarch64/fpu/s_fmax.c +++ b/sysdeps/aarch64/fpu/s_fmax.c @@ -18,4 +18,4 @@ #define FUNC fmax #define INSN "fmaxnm" -#include +#include diff --git a/sysdeps/aarch64/fpu/s_fmaxf.c b/sysdeps/aarch64/fpu/s_fmaxf.c index 6a234bb..fe9d4f3 100644 --- a/sysdeps/aarch64/fpu/s_fmaxf.c +++ b/sysdeps/aarch64/fpu/s_fmaxf.c @@ -20,4 +20,4 @@ #define INSN "fmaxnm" #define TYPE float #define REGS "s" -#include +#include diff --git a/sysdeps/aarch64/fpu/s_fminf.c b/sysdeps/aarch64/fpu/s_fminf.c index 7860957..97c9839 100644 --- a/sysdeps/aarch64/fpu/s_fminf.c +++ b/sysdeps/aarch64/fpu/s_fminf.c @@ -19,4 +19,4 @@ #define FUNC fminf #define TYPE float #define REGS "s" -#include +#include diff --git a/sysdeps/ieee754/ldbl-opt/math-type-macros-double.h b/sysdeps/ieee754/ldbl-opt/math-type-macros-double.h index e9b1508..5644df0 100644 --- a/sysdeps/ieee754/ldbl-opt/math-type-macros-double.h +++ b/sysdeps/ieee754/ldbl-opt/math-type-macros-double.h @@ -45,6 +45,7 @@ #define LDOUBLE_clog10l_libm_version GLIBC_2_1 #define LDOUBLE___clog10l_libm_version GLIBC_2_1 #define LDOUBLE_fdiml_libm_version GLIBC_2_1 +#define LDOUBLE_fmaxl_libm_version GLIBC_2_1 /* Define compat symbols for long double on platforms where it was not always a distinct type. */ diff --git a/sysdeps/ieee754/ldbl-opt/s_fmax.c b/sysdeps/ieee754/ldbl-opt/s_fmax.c deleted file mode 100644 index 11e7591..0000000 --- a/sysdeps/ieee754/ldbl-opt/s_fmax.c +++ /dev/null @@ -1,5 +0,0 @@ -#include -#include -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __fmax, fmaxl, GLIBC_2_1); -#endif diff --git a/sysdeps/ieee754/ldbl-opt/s_fmaxl.c b/sysdeps/ieee754/ldbl-opt/s_fmaxl.c deleted file mode 100644 index 98221b2..0000000 --- a/sysdeps/ieee754/ldbl-opt/s_fmaxl.c +++ /dev/null @@ -1,5 +0,0 @@ -#include -#undef weak_alias -#define weak_alias(n,a) -#include -long_double_symbol (libm, __fmaxl, fmaxl);