From patchwork Mon Nov 28 23:28:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 700220 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 3tSNCk2ZCpz9vDr for ; Tue, 29 Nov 2016 10:28:34 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="HAiP/JM7"; 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:date:from:to:subject:message-id:mime-version :content-type; q=dns; s=default; b=CHPE1tj1EwpnU6Gx232w3zHVcxv3t B1/I+xU1P82QNe02sFvrKCNBySzYUr/KcWifksrD+Hws6U/1c2dde/Wp7M5mbeVv gDNIGLyH6fHmh05hzvSOIciRV/cRDvDZINIbjq6FOGg7SxZ+9iDYREdAcQ+joSb1 0FpuVSXnICPpRU= 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:date:from:to:subject:message-id:mime-version :content-type; s=default; bh=2bWCNRNT82DmdpNvtCApd51IPwM=; b=HAi P/JM7Q21qK+7JAq+EFxB03BGS5iPX4jg/3A0xO9mjSpWX1bF62oQ4do8rmzdd7+S kbHHVvsOhYtq/6DF2jZVdJJvMESEUGGB+BA834wCLEteEVpCsJygVwwvd7+Nbnh0 2rhfIgvVhMSCzneZFlkdMh8JDjWaetheR5QEMLOg= Received: (qmail 13571 invoked by alias); 28 Nov 2016 23:28:24 -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 13556 invoked by uid 89); 28 Nov 2016 23:28:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.5 required=5.0 tests=AWL, BAYES_50, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy=Contributed, 67, 7, e_fmodF, s_fdimF X-HELO: relay1.mentorg.com Date: Mon, 28 Nov 2016 23:28:03 +0000 From: Joseph Myers To: Subject: Make ilogb wrappers type-generic [committed] Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) This patch converts the ilogb wrappers (which set errno directly rather than doing anything with __kernel_standard) to use the type-generic template machinery. This is intended as preparation for adding llogb. Tested for x86_64 and x86, and tested compile for other architectures with build-many-glibcs.py. Committed. 2016-11-28 Joseph Myers * math/w_ilogb_template.c: New file. Based on math/w_ilogb.c. * math/w_ilogb.c: Remove. * math/w_ilogbf.c: Likewise. * math/w_ilogbl.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_ilogb.c: Likewise. * sysdeps/ieee754/ldbl-opt/w_ilogbl.c: Likewise. * math/Makefile (gen-libm-calls): Add w_ilogbF. (libm-calls): Remove w_ilogbF. * sysdeps/ieee754/ldbl-opt/math-type-macros-double.h (LDOUBLE_ilogbl_libm_version): New macro. diff --git a/math/Makefile b/math/Makefile index 7196e5e..bcf627d 100644 --- a/math/Makefile +++ b/math/Makefile @@ -52,7 +52,7 @@ gen-libm-calls = cargF conjF cimagF crealF cabsF s_cacosF \ 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_fmaxF s_fminF \ - s_nanF s_iseqsigF s_canonicalizeF + s_nanF s_iseqsigF s_canonicalizeF w_ilogbF libm-calls = \ e_acosF e_acoshF e_asinF e_atan2F e_atanhF e_coshF e_expF e_fmodF \ @@ -67,7 +67,6 @@ libm-calls = \ w_atan2F w_atanhF w_coshF w_expF w_exp2F w_exp10F w_fmodF \ 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_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 \ diff --git a/math/w_ilogb.c b/math/w_ilogb.c deleted file mode 100644 index 3bbe5ec..0000000 --- a/math/w_ilogb.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 2012-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Adhemerval Zanella , 2011. - - 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 -#include -#include - -/* wrapper ilogb */ -int -__ilogb (double x) -{ - int r = __ieee754_ilogb (x); - if (__builtin_expect (r == FP_ILOGB0, 0) - || __builtin_expect (r == FP_ILOGBNAN, 0) - || __builtin_expect (r == INT_MAX, 0)) - { - __set_errno (EDOM); - __feraiseexcept (FE_INVALID); - } - return r; -} -weak_alias (__ilogb, ilogb) -#ifdef NO_LONG_DOUBLE -strong_alias (__ilogb, __ilogbl) -weak_alias (__ilogb, ilogbl) -#endif diff --git a/math/w_ilogb_template.c b/math/w_ilogb_template.c new file mode 100644 index 0000000..acc7002 --- /dev/null +++ b/math/w_ilogb_template.c @@ -0,0 +1,42 @@ +/* Wrapper to set errno for ilogb. + Copyright (C) 2012-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 +#include +#include + +/* wrapper ilogb */ +int +M_DECL_FUNC (__ilogb) (FLOAT x) +{ + int r = M_SUF (__ieee754_ilogb) (x); + if (__builtin_expect (r == FP_ILOGB0, 0) + || __builtin_expect (r == FP_ILOGBNAN, 0) + || __builtin_expect (r == INT_MAX, 0)) + { + __set_errno (EDOM); + __feraiseexcept (FE_INVALID); + } + return r; +} +declare_mgen_alias (__ilogb, ilogb) + +#if M_LIBM_NEED_COMPAT (ilogb) +declare_mgen_libm_compat (__ilogb, ilogb) +#endif diff --git a/math/w_ilogbf.c b/math/w_ilogbf.c deleted file mode 100644 index 92bf2df..0000000 --- a/math/w_ilogbf.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2012-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Adhemerval Zanella , 2011. - - 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 -#include -#include - -/* wrapper ilogbf */ -int -__ilogbf (float x) -{ - int r = __ieee754_ilogbf (x); - if (__builtin_expect (r == FP_ILOGB0, 0) - || __builtin_expect (r == FP_ILOGBNAN, 0) - || __builtin_expect (r == INT_MAX, 0)) - { - __set_errno (EDOM); - feraiseexcept (FE_INVALID); - } - return r; -} -weak_alias (__ilogbf, ilogbf) diff --git a/math/w_ilogbl.c b/math/w_ilogbl.c deleted file mode 100644 index 165772a7..0000000 --- a/math/w_ilogbl.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2012-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Adhemerval Zanella , 2011. - - 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 -#include -#include - -/* wrapper ilogbl */ -int -__ilogbl (long double x) -{ - int r = __ieee754_ilogbl (x); - if (__builtin_expect (r == FP_ILOGB0, 0) - || __builtin_expect (r == FP_ILOGBNAN, 0) - || __builtin_expect (r == INT_MAX, 0)) - { - __set_errno (EDOM); - feraiseexcept (FE_INVALID); - } - return r; -} -weak_alias (__ilogbl, ilogbl) diff --git a/sysdeps/ieee754/ldbl-opt/math-type-macros-double.h b/sysdeps/ieee754/ldbl-opt/math-type-macros-double.h index 2569607..545482e 100644 --- a/sysdeps/ieee754/ldbl-opt/math-type-macros-double.h +++ b/sysdeps/ieee754/ldbl-opt/math-type-macros-double.h @@ -47,6 +47,7 @@ #define LDOUBLE_fdiml_libm_version GLIBC_2_1 #define LDOUBLE_fmaxl_libm_version GLIBC_2_1 #define LDOUBLE_fminl_libm_version GLIBC_2_1 +#define LDOUBLE_ilogbl_libm_version GLIBC_2_0 #define LDOUBLE_nanl_libm_version GLIBC_2_1 /* Define compat symbols for long double on platforms diff --git a/sysdeps/ieee754/ldbl-opt/w_ilogb.c b/sysdeps/ieee754/ldbl-opt/w_ilogb.c deleted file mode 100644 index f518087..0000000 --- a/sysdeps/ieee754/ldbl-opt/w_ilogb.c +++ /dev/null @@ -1,5 +0,0 @@ -#include -#include -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0) -compat_symbol (libm, __ilogb, ilogbl, GLIBC_2_0); -#endif diff --git a/sysdeps/ieee754/ldbl-opt/w_ilogbl.c b/sysdeps/ieee754/ldbl-opt/w_ilogbl.c deleted file mode 100644 index 36f83f6..0000000 --- a/sysdeps/ieee754/ldbl-opt/w_ilogbl.c +++ /dev/null @@ -1,5 +0,0 @@ -#include -#undef weak_alias -#define weak_alias(n,a) -#include -long_double_symbol (libm, __ilogbl, ilogbl);