This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH V2] powerpc: Add a POWER8-optimized version of expf()



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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]