1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-07 06:43:00 +03:00
Files
glibc/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128_private.h
Joseph Myers ae31254432 Implement C23 compoundn
C23 adds various <math.h> function families originally defined in TS
18661-4.  Add the compoundn functions, which compute (1+X) to the
power Y for integer Y (and X at least -1).  The integer exponent has
type long long int in C23; it was intmax_t in TS 18661-4, and as with
other interfaces changed after their initial appearance in the TS, I
don't think we need to support the original version of the interface.

Note that these functions are "compoundn" with a trailing "n", *not*
"compound" (CORE-MATH has the wrong name, for example).

As with pown, I strongly encourage searching for worst cases for ulps
error for these implementations (necessarily non-exhaustively, given
the size of the input space).  I also expect a custom implementation
for a given format could be much faster as well as more accurate (I
haven't tested or benchmarked the CORE-MATH implementation for
binary32); this is one of the more complicated and less efficient
functions to implement in a type-generic way.

As with exp2m1 and exp10m1, this showed up places where the
powerpc64le IFUNC setup is not as self-contained as one might hope (in
this case, without the changes specific to powerpc64le, there were
undefined references to __GI___expf128).

Tested for x86_64 and x86, and with build-many-glibcs.py.
2025-05-09 15:17:27 +00:00

103 lines
3.0 KiB
C

/* _Float128 overrides for float128 in ppc64le multiarch env.
Copyright (C) 2020-2025 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
<https://www.gnu.org/licenses/>. */
#ifndef _FLOAT128_PRIVATE_PPC64LE
#define _FLOAT128_PRIVATE_PPC64LE 1
#ifndef _F128_ENABLE_IFUNC
/* multiarch is not supported. Do nothing and pass through. */
#include_next <float128_private.h>
#else
/* Include fenv.h now before turning off libm_hidden_proto.
At minimum, fereaiseexcept is needed. */
#include <fenv.h>
/* The PLT bypass trick used by libm_hidden_proto uses asm-renames.
If gcc detects a second rename to a different function, it will
emit errors. */
#undef libm_hidden_proto
#define libm_hidden_proto(f)
/* Always disable redirects. We supply these uniquely later on. */
#undef NO_MATH_REDIRECT
#define NO_MATH_REDIRECT
#include <math.h>
#undef NO_MATH_REDIRECT
#include_next <float128_private.h>
#include <float128-ifunc-macros.h>
/* Declare these now. These prototypes are not included
in any header. */
extern __typeof (cosf128) __ieee754_cosf128;
extern __typeof (asinhf128) __ieee754_asinhf128;
F128_REDIR (__ieee754_asinhf128)
F128_REDIR (__ieee754_cosf128)
F128_REDIR (__asinhf128)
F128_REDIR (__atanf128)
F128_REDIR (__cbrtf128)
F128_REDIR (__ceilf128)
F128_REDIR (__compoundnf128)
F128_REDIR (__cosf128)
F128_REDIR (__erfcf128)
F128_REDIR (__erff128)
F128_REDIR (__expf128)
F128_REDIR (__exp10m1f128);
F128_REDIR (__exp2m1f128);
F128_REDIR (__expm1f128)
F128_REDIR (__fabsf128)
F128_REDIR (__fdimf128)
F128_REDIR (__floorf128)
F128_REDIR (__fmaf128)
F128_REDIR (__fmaxf128)
F128_REDIR (__fminf128)
F128_REDIR (__frexpf128)
F128_REDIR (__ldexpf128)
F128_REDIR (__llrintf128)
F128_REDIR (__llroundf128)
F128_REDIR (__log1pf128)
F128_REDIR (__logbf128)
F128_REDIR (__logf128)
F128_REDIR (__lrintf128)
F128_REDIR (__lroundf128)
F128_REDIR (__modff128)
F128_REDIR (__nearbyintf128)
F128_REDIR (__remquof128)
F128_REDIR (__rintf128)
F128_REDIR (__roundevenf128)
F128_REDIR (__roundf128)
F128_REDIR (__scalblnf128)
F128_REDIR (__scalbnf128)
F128_REDIR (__sincosf128)
F128_REDIR (__sinf128)
F128_REDIR (__sqrtf128)
F128_REDIR (__tanhf128)
F128_REDIR (__tanf128)
F128_REDIR (__truncf128)
F128_REDIR (__lgamma_productf128)
#include <float128-ifunc-redirects-mp.h>
#include <float128-ifunc-redirects.h>
#endif /* _F128_ENABLE_IFUNC */
#endif /* _FLOAT128_PRIVATE_PPC64LE */