This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH V2] powerpc: Add a POWER8-optimized version of expf()
- From: "Paul E. Murphy" <murphyp at linux dot vnet dot ibm dot com>
- To: Tulio Magno Quites Machado Filho <tuliom at linux dot vnet dot ibm dot com>, libc-alpha at sourceware dot org
- Cc: munroesj at linux dot vnet dot ibm dot com
- Date: Tue, 28 Jun 2016 17:08:21 -0500
- Subject: Re: [PATCH V2] powerpc: Add a POWER8-optimized version of expf()
- Authentication-results: sourceware.org; auth=none
- References: <277c499f-08dc-bad5-c364-377dd28ef8cc at linux dot vnet dot ibm dot com> <1467054190-1634-1-git-send-email-tuliom at linux dot vnet dot ibm dot com>
On 06/27/2016 02:03 PM, Tulio Magno Quites Machado Filho wrote:
> diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf.c
> new file mode 100644
> index 0000000..097e0a6
> --- /dev/null
> +++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/e_expf.c
> @@ -0,0 +1,34 @@
> +/* Multiple versions of ieee754_expf.
> + 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
> + <http://www.gnu.org/licenses/>. */
> +
> +#if defined SHARED
> +# include <math.h>
> +# include <math_ldbl_opt.h>
> +# include <shlib-compat.h>
> +# include "init-arch.h"
> +
> +extern __typeof (__ieee754_expf) __ieee754_expf_ppc64 attribute_hidden;
> +extern __typeof (__ieee754_expf) __ieee754_expf_power8 attribute_hidden;
> +
> +libc_ifunc (__ieee754_expf,
> + (hwcap2 & PPC_FEATURE2_ARCH_2_07)
> + ? __ieee754_expf_power8
> + : __ieee754_expf_ppc64);
> +
> +strong_alias (__ieee754_expf, __expf_finite)
> +#endif
This appears like it would fail to export the __ieee754_expf symbol
when linking statically. Could it be handled similarly to s_isnanf.c?
Otherwise, the patch is OK to me.
> diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
> index f918f52..7f37c81 100644
> --- a/sysdeps/powerpc/fpu/libm-test-ulps
> +++ b/sysdeps/powerpc/fpu/libm-test-ulps
> @@ -1588,8 +1588,10 @@ ildouble: 2
> ldouble: 2
>
> Function: "exp_upward":
> +float: 1
> double: 1
> idouble: 1
> +ifloat: 1
> ildouble: 1
> ldouble: 1
>
I think the tiny increase in ULPS is acceptable given the speedup this
version brings. Tulio, it is probably worth noting a rough estimate in
the commit message.